|
| 1 | +# MPLS |
| 2 | + |
| 3 | + |
| 4 | +多协议标签交换,是通过将一个标签追加到任意类型的数据包上,而运作的(Multiprotocol Label Switching(MPLS) functions by appending a label to any type of packet)。随后数据包就根据该标签的值,而非任何`Layer 3`信息,经由网络设施得以转发。给数据包打上标签,提供了非常高效的转发,且令到 MPLS 可工作在极大范围的现有技术上。通过简单地将一个标签添加到数据包头部中, MPLS 就可在许多物理与数据链路层的广域网实现中使用(The labeling of the packet provides very efficient forwarding and allows MPLS to work with a wide range of undelying technologies. By simply adding a label in the packet header, MPLS can be used in many Physical and Data Link Layer WAN implementations)。 |
| 5 | + |
| 6 | +MPLS的标签,是放在`Layer 2`头部与`Layer 3`头部之间的。使用 MPLS 技术,仅在数据包进入服务提供商云时,才会加入额外开销。在进入 MPLS 网络后,相比传统的`Layer 3`网络,数据包交换的完成要快得多,因为 MPLS 的包交换只是基于 MPLS 标签的交换,而不是要拆封整个的`Layer 3`头部(By using MPLS, overhead is added only when the packet enters the service provider cloud. After entering the MPLS network, packet switching is done much faster than in traditional Layer 3 networks because it is based only on swapping the MPLS label, instead of stripping the entire Layer 3 header)。 |
| 7 | + |
| 8 | +MPLS有两种不同样式(MPLS comes in two different flavours): |
| 9 | + |
| 10 | +- 帧模式的 MPLS (Frame Mode MPLS) |
| 11 | +- (数据)单元模式的 MPLS (Cell Mode MPLS) |
| 12 | + |
| 13 | +帧模式的 MPLS 是最为流行的 MPLS 类型,而在此场景中,标签是放在`Layer 2`头部与`Layer 3`头部之间的(因此 MPLS 通常被视为一种`Layer 2.5`的技术)。单元模式的 MPLS 用在`ATM`网络中,并使用`ATM`头部中的一些字段,作为标签。 |
| 14 | + |
| 15 | +兼容 MPLS 的路由器(MPLS-capable routers),也被叫做标签交换路由器(Label Switched Routers, LSRs),同时这些路由器也有两种样式: |
| 16 | + |
| 17 | +- 边沿标签交换路由器(服务提供商边沿路由器,Edge LSR(PE<Provider Edge> routers)) |
| 18 | +- 服务提供商标签交换路由器(P(Provider) LSR) |
| 19 | + |
| 20 | +`PE routers`(服务提供商边沿路由器),是那些关注标签分布的服务提供商边沿设备(`PE routers` are Provider Edge devices that take care of label distribution);它们根据标签对数据包进行转发,并负责标签的插入与移除。`P routers`就是服务提供商路由器,它们的职责包括 _标签式转发_,以及基于标签的高效率包转发(`P routers` are Provider routers and their responsibility consists of _label forwarding_ and efficient packet forwarding based labels)。 |
| 21 | + |
| 22 | +> **注**:请参考[这里](http://blog.51cto.com/sirstma/1860720)。 |
| 23 | +
|
| 24 | +## 基本的串行线路配置(Basic Serial Line Configuration) |
| 25 | + |
| 26 | +在不打算改变默认的`HDLC`(High-level Data Link Control,高级数据链路控制,思科专有)封装时,那么为建立 WAN 连接,仅需完成下面的步骤: |
| 27 | + |
| 28 | +1. 给接口添加一个 IP 地址 |
| 29 | +2. 开启接口(以`no shutdown`命令) |
| 30 | +3. 确保在数据通信设备侧有一个时钟速率(Ensure there is a clock rate on the DCE side) |
| 31 | + |
| 32 | +在连接了数据通信设备电缆时的配置如下: |
| 33 | + |
| 34 | +```console |
| 35 | +Router#config t |
| 36 | +Router(config)#interface Serial0 |
| 37 | +Router(config-if)#ip address 192.168.1.1 255.255.255.0 |
| 38 | +Router(config-if)#clock rate 64000 |
| 39 | +Router(config-if)#no shutdown |
| 40 | +Router(config-if)#^Z |
| 41 | +Router# |
| 42 | +``` |
| 43 | + |
| 44 | +## 以太网上的点对点协议(Point-to-Point over Ethernet, PPPoE) |
| 45 | + |
| 46 | +以太网上的点对点协议,是一个用于在以太网帧内部,封装点对点协议帧的网络协议(Point-to-Point Protocol over Ethernet(PPPoE) is a network protocol used to encapsulate PPP frames inside Ethernet frames)。 |
| 47 | + |
| 48 | +要实现客户部署非对称数字订户线路,他们就必须支持在极大安装基数的老旧桥接的客户处设备上的点对点样式的认证与授权。`PPPoE`技术提供了将主机网络经由简单的桥接访问设备,连接到远端访问集中器,或聚合集中器的能力(As customers deploy ADSL, they must support PPP-style authentication and authorisation over a large installed base of legacy bridging customer premises equipment(CPE). PPPoE provides the ability to connect a network of hosts over a simple bridging access device to a remote access concentrator or aggregation concentrator)。在此模型下,每台主机都使用其自身的点对点协议栈,因此呈现给用户的是一个熟悉的用户界面。访问控制、计费与服务类型(type of service),可基于每名用户,而不是基于每个地点完成。 |
| 49 | + |
| 50 | +如同在[RFC 2516](http://man.chinaunix.net/develop/rfc/RFC2516.txt)中所指明的那样, PPPoE 有两个不同阶段:发现阶段与会话阶段(As specified in RFC 2516, PPPoE has two distinct stages: a discovery stage and a session stage)。在主机发起一个 PPPoE 会话时,其必须首先进行发现,以找到可满足客户端请求的服务器,并找到对等点的以太网 MAC 地址而建立一个 PPPoE 会话 ID 。在 PPP 定义一个对等点到对等点的关系时,发现本质上就是一个客户端服务器的关系(While PPP defines a peer-to-peer relationship, discovery is inherently a client-server relationship)。 |
| 51 | + |
| 52 | +### PPPoE的配置 |
| 53 | + |
| 54 | +下面的小节涵盖了服务器(互联网服务提供商处)与客户端 PPPoE 的配置。之所以包含此内容,是因为现在 CCNA 大纲强制要求考生知道如何配置 PPPoE 。 |
| 55 | + |
| 56 | +#### 服务器的配置 |
| 57 | + |
| 58 | +创建 PPPoE 服务器配置的第一步,是定义一个将对传入连接进行管理的宽带聚合组(broadband aggregation group, BBA group)。该宽带聚合组必须关联到某个虚拟模板: |
| 59 | + |
| 60 | +```console |
| 61 | +Router(config)#bba-group pppoe GROUP |
| 62 | +Router(config-bba-group)#virtual-template 1 |
| 63 | +``` |
| 64 | + |
| 65 | +下一步为面向客户端的接口,创建出一个虚拟模板。在虚拟模板上,需要配置一个 IP 地址以及一个可从中为客户端分配到协商地址的地址池(The next step is to create a virtual template for the customer-facing interface. On the virtual template you need to configure an IP address and a pool of address from which clients are assigned a negotiated address): |
| 66 | + |
| 67 | +```console |
| 68 | +Router(config)#interface virtual-template 1 |
| 69 | +Router(config-if)#ip address 10.10.10.1 255.255.255.0 |
| 70 | +Router(config-if)#peer default ip address pool POOL |
| 71 | +``` |
| 72 | + |
| 73 | +该 IP 地址池是在全局配置模式中定义的。这与 DHCP 地址池的配置类似: |
| 74 | + |
| 75 | +```console |
| 76 | +Router(config)#ip local pool POOL 10.10.10.2 10.10.10.254 |
| 77 | +``` |
| 78 | + |
| 79 | +最后一步就是在面向客户端的接口上开启该 PPPoE 分组: |
| 80 | + |
| 81 | +```console |
| 82 | +Router(config)#interface FastEthernet0/0 |
| 83 | +Router(config-if)#no ip address |
| 84 | +Router(config-if)#pppoe enable group GROUP |
| 85 | +Router(config-if)#no shutdown |
| 86 | +``` |
| 87 | + |
| 88 | +#### 客户端的配置(Client Configuration) |
| 89 | + |
| 90 | +在客户端侧上,必须创建出一个拨号器接口(On the client side a dialer interface has to be created)。拨号器接口将对 PPPoE 连接进行管理。可将手动 IP 地址分配给拨号器接口,或将其设置为从服务器请求一个 IP 地址(使用`ip address negotiated`命令): |
| 91 | + |
| 92 | +```console |
| 93 | +Router(config)#interface dialer1 |
| 94 | +Router(config-if)#dialer pool 1 |
| 95 | +Router(config-if)#encapsulation ppp |
| 96 | +Router(config-if)#ip address negotiated |
| 97 | +Router(config)#interface FastEthernet0/0 |
| 98 | +Router(config-if)#no ip address |
| 99 | +Router(config-if)#pppoe-client dial-pool-number 1 |
| 100 | +Router(config-if)#no shutdown |
| 101 | +``` |
| 102 | + |
| 103 | +### 关于认证( Authentication ) |
| 104 | + |
| 105 | +为了令到 PPPoE 连接安全,可使用两种方法: |
| 106 | + |
| 107 | +- 口令认证协议(Password Authentication Protocol, PAP) - 不安全的、以明文方式发送凭据(包含用户名与口令) |
| 108 | +- 询问握手协议(Challenge Handshake Authentication Protocol, CHAP) - 安全的(明文的用户名与经`MD5`散列化的口令),是首选方式 |
| 109 | + |
| 110 | +可如下配置`PAP`: |
| 111 | + |
| 112 | +_服务器侧_: |
| 113 | + |
| 114 | +```console |
| 115 | +Server(config)#username Client password Password |
| 116 | +Server(config)#interface virtual-template 1 |
| 117 | +Server(config-if)#ppp authentication pap |
| 118 | +Server(config-if)#ppp pap sent-username Server password Password |
| 119 | +``` |
| 120 | + |
| 121 | +_客户端_: |
| 122 | + |
| 123 | +```console |
| 124 | +Client(config)#username Server password Password |
| 125 | +Client(config)#interface dialer 1 |
| 126 | +Client(config-if)#ppp authentication pap |
| 127 | +Client(config-if)#ppp pap sent-username Client password Password |
| 128 | +``` |
| 129 | + |
| 130 | +`CHAP`可如下进行配置: |
| 131 | + |
| 132 | +_服务器侧_: |
| 133 | + |
| 134 | +```console |
| 135 | +Server(config)#username Client password Password |
| 136 | +Server(config)#interface virtual-template 1 |
| 137 | +Server(config-if)#ppp authentication chap |
| 138 | +``` |
| 139 | + |
| 140 | +_客户端_: |
| 141 | + |
| 142 | +```console |
| 143 | +Client(config)#username Server password Password |
| 144 | +Client(config)#interface dialer 1 |
| 145 | +Client(config-if)#ppp authentication chap |
| 146 | +``` |
| 147 | + |
| 148 | +### PPPoE的验证与故障排除(PPPoE Verification and Troubleshooting) |
| 149 | + |
| 150 | +在 PPPoE 会话成功形成后,客户端控制台上将出现下面的消息: |
| 151 | + |
| 152 | +```console |
| 153 | +%DIALER-6-BIND: Interface Vi1 bound to profile Di1 |
| 154 | +%LINK-3-UPDOWN: Interface Virtual-Access1, changed state to up |
| 155 | +%LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access1, changed state to up |
| 156 | +``` |
| 157 | + |
| 158 | +在客户端路由器上使用下面的命令,可对拨号器接口,以及从 PPPoE 服务器处获取到的(协商到的) IP 地址进行检查: |
| 159 | + |
| 160 | +```console |
| 161 | +Router#show ip interface brief |
| 162 | +Interface IP-Address OK? Method Status Protocol |
| 163 | +Virtual-Access1 unassigned YES unset up/up |
| 164 | +Dialer1 10.10.10.2 YES IPCP up/up |
| 165 | +``` |
| 166 | + |
| 167 | +在客户端路由器上可使用下面的命令,显示出 PPPoE 会话的状态: |
| 168 | + |
| 169 | +```console |
| 170 | +Router#show pppoe session |
| 171 | +1 client session |
| 172 | +Uniq ID PPPoE RemMAC Port Source VA State |
| 173 | + SID LocMAC VA-st |
| 174 | +N/A 16 ca00.4843.0008 Fa0/0 Di1 Vi1 UP |
| 175 | + ca01.4843.0008 UP |
| 176 | +``` |
| 177 | + |
| 178 | +一些对于 PPPoE 连接进行故障排除有用的命令如下: |
| 179 | + |
| 180 | +```console |
| 181 | +Router#debug ppp ? |
| 182 | + authentication CHAP and PAP authentication |
| 183 | + bap BAP protocol transactions |
| 184 | + cbcp Callback Control Protocol negotiation |
| 185 | + elog PPP ELOGs |
| 186 | + error Protocol errors and error statistics |
| 187 | + forwarding PPP layer 2 forwarding |
| 188 | + mppe MPPE Events |
| 189 | + multilink Multilink activity |
| 190 | + negotiation Protocol parameter negotiation |
| 191 | + packet Low-level PPP packet dump |
| 192 | +``` |
| 193 | + |
| 194 | +## WAN连接的故障排除(Troubleshooting WAN Connections) |
| 195 | + |
| 196 | +在试图启动一条广域网连接(现在先不管 PPP 与帧中继连接)时,可运用开放系统互联模型: |
| 197 | + |
| 198 | +`Layer 1` -- 对线缆进行检查,以确保其连接正确。其外还要检查一下有没有执行`no shutdown`命令,以及在数据通信设备侧有没有应用一个时钟速率。 |
| 199 | + |
| 200 | +```console |
| 201 | +RouterA#show controllers serial 0 |
| 202 | +HD unit 0, idb = 0x1AE828, driver structure at 0x1B4BA0 |
| 203 | +buffer size 1524 HD unit 0, V.35 DTE cable |
| 204 | + |
| 205 | +RouterA#show ip interface brief |
| 206 | +Interface IP-Address OK? Method Status Protocol |
| 207 | +Serial0 11.0.0.1 YES unset administratively down down |
| 208 | +Ethernet0 10.0.0.1 YES unset up up |
| 209 | +``` |
| 210 | + |
| 211 | +`Layer 2` -- 检查以确保对接口应用了正确的封装。确保链路的另一侧有着同样的封装类型。 |
| 212 | + |
| 213 | +```console |
| 214 | +RouterB#show interface Serial0 |
| 215 | +Serial1 is down, line protocol is down |
| 216 | +Hardware is HD64570 |
| 217 | +Internet address is 12.0.0.1/24 |
| 218 | +MTU 1500 bytes, BW 1544 Kbit, DLY 1000 usec, rely 255/255, load 1/255 |
| 219 | +Encapsulation HDLC, loopback not set, keepalive set (10 sec) |
| 220 | +``` |
| 221 | + |
| 222 | +`Layer 3` -- IP地址与子网掩码对不对,子网掩码与另一侧是不是匹配。 |
| 223 | + |
| 224 | +```console |
| 225 | +RouterB#show interface Serial0 |
| 226 | +Serial1 is down, line protocol is down |
| 227 | +Hardware is HD64570 |
| 228 | +Internet address is 12.0.0.1/24 |
| 229 | +MTU 1500 bytes, BW 1544 Kbit, DLY 1000 usec, rely 255/255, load 1/255 |
| 230 | +Encapsulation HDLC, loopback not set, keepalive set (10 sec) |
| 231 | +``` |
| 232 | + |
| 233 | +## 第 41 天问题 |
| 234 | + |
| 235 | +1. Name at least three WAN categories. |
| 236 | +2. The need for NBMA appears when there is no native `_______` support for a group of systems that want to communicate over the same network. |
| 237 | +3. In NBMA environments you still need to bind the Layer 3 address (IP address) to the Layer 2 address (DLCI). This can be done in an automated fashion, using a technology called Inverse ARP. True or false? |
| 238 | +4. Name 2 NBMA interface types. |
| 239 | +5. `_______` requires DTE and DCE and is the default encapsulation type on Cisco routers. |
| 240 | +6. `_______` technologies involve the use of carrier Ethernet in Metropolitan Area Networks (MANs). |
| 241 | +7. T1 is a standard often used in what geographical regions? |
| 242 | +8. What are the two flavours of ISDN? |
| 243 | +9. `_______` is the most common form of DSL connection that functions over standard telephone lines. It offers unequal download and upload throughput, with the download rate being higher than the upload rate. |
| 244 | +10. `_______` functions by appending a label to any type of packet. |
| 245 | + |
| 246 | + |
| 247 | +## 第 41 天答案 |
| 248 | + |
| 249 | +1. Circuit-switched, cell-switched, broadband, leased-line, and packet-switched. |
| 250 | +2. Broadcast. |
| 251 | +3. True. |
| 252 | +4. Multipoint and Point-to-Point. |
| 253 | +5. HDLC. |
| 254 | +6. Metro Ethernet. |
| 255 | +7. North America, Japan, and South Korea. |
| 256 | +8. BRI and PRI. |
| 257 | +9. ADSL. |
| 258 | +10. MPLS. |
| 259 | + |
| 260 | + |
| 261 | +## 第 41 天实验 |
| 262 | + |
| 263 | +### PPPoE实验 |
| 264 | + |
| 265 | +在两台路由器之间,以本课程模块中所给出的信息,配置带有 CHAP 的 PPPoE : |
| 266 | + |
| 267 | +__服务器配置__: |
| 268 | + |
| 269 | +```console |
| 270 | +Router(config)#bba-group pppoe GROUP |
| 271 | +Router(config-bba-group)#virtual-template 1 |
| 272 | +Router(config)#interface virtual-template 1 |
| 273 | +Router(config-if)#ip address 10.10.10.1 255.255.255.0 |
| 274 | +Router(config-if)#peer default ip address pool POOL |
| 275 | +Router(config)#ip local pool POOL 10.10.10.2 10.10.10.254 |
| 276 | +Router(config)#interface FastEthernet0/0 |
| 277 | +Router(config-if)#no ip address |
| 278 | +Router(config-if)#pppoe enable group GROUP |
| 279 | +Router(config-if)#no shutdown |
| 280 | +``` |
| 281 | + |
| 282 | +__客户端配置__: |
| 283 | + |
| 284 | +```console |
| 285 | +Router(config)#interface dialer1 |
| 286 | +Router(config-if)#dialer pool 1 |
| 287 | +Router(config-if)#encapsulation ppp |
| 288 | +Router(config-if)#ip address negotiated |
| 289 | +Router(config)#interface FastEthernet0/0 |
| 290 | +Router(config-if)#no ip address |
| 291 | +Router(config-if)#pppoe-client dial-pool-number 1 |
| 292 | +Router(config-if)#no shutdown |
| 293 | +``` |
| 294 | + |
| 295 | +__询问握手认证协议( CHAP )配置__: |
| 296 | + |
| 297 | +```console |
| 298 | +Server(config)#username Client password Password |
| 299 | +Server(config)#interface virtual-template 1 |
| 300 | +Server(config-if)#ppp authentication chap |
| 301 | +Client(config)#username Server password Password |
| 302 | +Client(config)#interface dialer 1 |
| 303 | +Client(config-if)#ppp authentication chap |
| 304 | +``` |
| 305 | + |
| 306 | +__对配置进行验证__: |
| 307 | + |
| 308 | +```console |
| 309 | +Router#show pppoe session |
| 310 | +1 client session |
| 311 | +Uniq ID PPPoE RemMAC Port Source VA State |
| 312 | + SID LocMAC VA-st |
| 313 | +N/A 16 ca00.4843.0008 Fa0/0 Di1 Vi1 UP |
| 314 | + ca01.4843.0008 UP |
| 315 | +``` |
| 316 | + |
| 317 | +请访问[www.in60days.com](http://www.in60days.com)并自由观看作者完成该实验。 |
| 318 | + |
| 319 | + |
| 320 | +(End) |
| 321 | + |
| 322 | + |
0 commit comments