MPLS基本概念 MPLS(Multiprotocol Label Switching,多协议标签交换) CE(Customer Edge,用户网络边缘)设备 PE(Provider Edge,服务提供商网络边缘)设备 LSR(Label Switching Router,标签交换路由器)
- MPLS(Multiprotocol Label Switching,多协议标签交换)
- CE(Customer Edge,用户网络边缘)设备
- PE(Provider Edge,服务提供商网络边缘)设备
- LSR(Label Switching Router,标签交换路由器)
- 具有标签分发能力和标签交换能力的设备。
- AC(Attachment Circult)接入电路
- 连接CE-PE的物理电路或虚拟电路。
- PW(Pseudo-Wire,伪线)
- 两个PE之间虚拟双向连接。
- MPLS PW由一对方向相反的单向LSP构成。
- 例如:peer 2.2.2.3 pw-id 100 in-label 100 out-label 200
- 对应:peer 2.2.2.1 pw-id 100 in-label 200 out-label 100
- 公网隧道(Tunnel)
- 用来承载PW的隧道。可以承载多条PW。
- 交叉连接(cross connect)
- 两条物理电路或两条虚链路串连成一条连接。
- 有三种:AC-AC AC-PW PW-PW
- Site ID
- 用户网络站点在×××内的唯一标识。
- 不同×××内站点的site ID可以相同。
- RD
- 用来区分不同×××内site ID相同的站点。
- 在site ID前增加RD,通过RD+site ID可以唯一标识网络中的一个站点。
- 标签快(一组标签的集合)
- LB(Label Base,初始标签)
- LR(Label Range,标签范围)
- LO(Label-block Offset,标签块偏移)
- ××× target
- MPLS L2使用BGP扩展团体属性 target(也称Route target)来控制BGP L2***信息的发布。
- LDP(Label Distribution Protocol,标签分发协议)
- 用来动态建立LSP。通过LDP,LSR可以把网络层的IP路由信息映射到MPLS的标签交换路径上。
注意
此处的接口对应关系: e0 对应 gi1/0 e1 对应 gi2/0 e2 对应 gi3/0 依次类推
本地mpls交换配置举例
[CE1]display current-configuration interface GigabitEthernet 1/0 # interface GigabitEthernet1/0 port link-mode route ip address 100.1.1.1 255.255.255.0 # return [CE2]display current-configuration interface GigabitEthernet 2/0 # interface GigabitEthernet2/0 port link-mode route ip address 100.1.1.2 255.255.255.0 # return [PE]display current-configuration l2*** enable xconnect-group ***1 connection ***1 ac interface GigabitEthernet1/0 ac interface GigabitEthernet2/0 PE验证: [PE]display l2*** forwarding ac Total number of cross-connections: 1 Total number of ACs: 2 AC Xconnect-group Name Link ID GE1/0 ***1 0 GE2/0 ***1 1 [PE] CE1验证: [CE1]ping 100.1.1.2 Ping 100.1.1.2 (100.1.1.2): 56 data bytes, press CTRL_C to break 56 bytes from 100.1.1.2: icmp_seq=0 ttl=255 time=26.309 ms 56 bytes from 100.1.1.2: icmp_seq=1 ttl=255 time=5.527 ms 56 bytes from 100.1.1.2: icmp_seq=2 ttl=255 time=3.591 ms 56 bytes from 100.1.1.2: icmp_seq=3 ttl=255 time=2.355 ms 56 bytes from 100.1.1.2: icmp_seq=4 ttl=255 time=4.193 ms --- Ping statistics for 100.1.1.2 --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 2.355/8.395/26.309/9.015 ms
静态PW配置举例
配置CE1
[CE1]vlan 100 [CE1-vlan100]quit [CE1]interface vlan 100 [CE1-Vlan-interface100]ip add 100.1.1.1 24 [CE1-Vlan-interface100]quit [CE1]interface GigabitEthernet 1/0 [CE1-GigabitEthernet1/0]port link-mode bridge [CE1-GigabitEthernet1/0]port link-type trunk [CE1-GigabitEthernet1/0]port trunk permit vlan all [CE1-GigabitEthernet1/0]quit
配置PE1
# 配置LSR ID [PE1]interface LoopBack 0 [PE1-LoopBack0]ip add 2.2.2.1 32 [PE1-LoopBack0]quit [PE1]mpls lsr-id 2.2.2.1 # 开启L2×××功能 [PE1]l2*** enable # 全局使能LDP [PE1]mpls ldp [PE1-ldp]quit # 配置连接P路由器的接口,在接口上使能LDP [PE1]interface GigabitEthernet 2/0 [PE1-GigabitEthernet2/0]ip add 1.1.1.1 24 [PE1-GigabitEthernet2/0]mpls enable [PE1-GigabitEthernet2/0]mpls ldp enable [PE1-GigabitEthernet2/0]quit #在PE1上运行ospf,用于建立LSP [PE1]ospf 1 router-id 2.2.2.1 [PE1-ospf-1]area 0 [PE1-ospf-1-area-0.0.0.0]network 2.2.2.1 0.0.0.0 [PE1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255 [PE1-ospf-1-area-0.0.0.0]quit [PE1-ospf-1]quit # 创建交叉连接组***100 [PE1]xconnect-group ***100 # 在该交叉连接组内创建名称为svc的交叉连接 [PE1-xcg-***100]connection svc # 将连接CE1的接口与此交叉连接关联 [PE1-xcg-***100-svc]ac interface GigabitEthernet 1/0 # 并在交叉连接内创建静态PW,以便将AC和PW关联。 [PE1-xcg-***100-svc]peer 2.2.2.3 pw-id 100 in-label 100 out-label 200 [PE1-xcg-***100-svc-2.2.2.3-100]quit [PE1-xcg-***100-svc]quit [PE1-xcg-***100]quit
配置P
[P]interface LoopBack 0 [P-LoopBack0]ip add 2.2.2.2 32 [P-LoopBack0]quit [P]mpls lsr-id 2.2.2.2 [P]mpls ldp [P-ldp]quit [P]interface GigabitEthernet 2/0 [P-GigabitEthernet2/0]ip add 1.1.1.2 24 [P-GigabitEthernet2/0]mpls ldp enable [P-GigabitEthernet2/0]quit [P]interface GigabitEthernet 1/0 [P-GigabitEthernet1/0]ip add 3.3.3.1 24 [P-GigabitEthernet1/0]mpls enable [P-GigabitEthernet1/0]mpls ldp enable [P-GigabitEthernet1/0]quit [P]ospf 1 router-id 2.2.2.2 [P-ospf-1]area 0 [P-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [P-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255 [P-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255 [P-ospf-1-area-0.0.0.0]quit [P-ospf-1]quit
配置PE2
[PE2]interface LoopBack 0 [PE2-LoopBack0]ip add 2.2.2.3 32 [PE2-LoopBack0]quit [PE2]mpls lsr-id 2.2.2.3 [PE2]l2*** enable [PE2]mpls ldp [PE2-ldp]quit [PE2]interface GigabitEthernet 1/0 [PE2-GigabitEthernet1/0]ip add 3.3.3.2 24 [PE2-GigabitEthernet1/0]mpls enable [PE2-GigabitEthernet1/0]mpls ldp enable [PE2-GigabitEthernet1/0]quit [PE2]ospf 1 router-id 2.2.2.3 [PE2-ospf-1]area 0 [PE2-ospf-1-area-0.0.0.0]network 2.2.2.3 0.0.0.0 [PE2-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255 [PE2-ospf-1-area-0.0.0.0]quit [PE2-ospf-1]quit #创建交叉连接组***100,在该交叉连接组内创建名为svc的交叉连接,将连接CE2的接口与此交叉连接关联,并在交叉连接内创建静态PW,以便将AC和PW关联。 [PE2]xconnect-group ***100 [PE2-xcg-***100]connection svc [PE2-xcg-***100-svc]ac interface gigabitethernet 2/0 [PE2-xcg-***100-svc]peer 2.2.2.1 pw-id 100 in-label 200 out-label 100 [PE2-xcg-***100-svc-2.2.2.1-100]quit [PE2-xcg-***100-svc]quit [PE2-xcg-***100]quit
配置CE2
[CE2]vlan 100 [CE2-vlan100]quit [CE2]interface vlan 100 [CE2-Vlan-interface100]ip add 100.1.1.2 24 [CE2-Vlan-interface100]quit [CE2]interface GigabitEthernet 2/0 [CE2-GigabitEthernet2/0]port link-mode bridge [CE2-GigabitEthernet2/0]port link-type trunk [CE2-GigabitEthernet2/0]port trunk permit vlan all [CE2-GigabitEthernet2/0]quit
验证
P路由器验证ospf
[P]display ospf peer OSPF Process 1 with Router ID 2.2.2.2 Neighbor Brief Information Area: 0.0.0.0 Router ID Address Pri Dead-Time State Interface 2.2.2.3 3.3.3.2 1 39 Full/BDR GE1/0 2.2.2.1 1.1.1.1 1 38 Full/DR GE2/0
PE路由器查看PW信息
PW是静态的。
[PE1]display l2*** pw Flags: M - main, B - backup, H - hub link, S - spoke link, N - no split horizon Total number of PWs: 1 1 up, 0 blocked, 0 down, 0 defect, 0 idle, 0 duplicate Xconnect-group Name: ***100 Peer PW ID/Rmt Site In/Out Label Proto Flag Link ID State 2.2.2.3 100 100/200 Static M 1 Up
CE路由器验证icmp
[CE1]ping 100.1.1.2 Ping 100.1.1.2 (100.1.1.2): 56 data bytes, press CTRL_C to break 56 bytes from 100.1.1.2: icmp_seq=0 ttl=255 time=74.608 ms 56 bytes from 100.1.1.2: icmp_seq=1 ttl=255 time=7.494 ms 56 bytes from 100.1.1.2: icmp_seq=2 ttl=255 time=9.578 ms 56 bytes from 100.1.1.2: icmp_seq=3 ttl=255 time=7.447 ms 56 bytes from 100.1.1.2: icmp_seq=4 ttl=255 time=9.788 ms --- Ping statistics for 100.1.1.2 --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 7.447/21.783/74.608/26.431 ms [CE1]dis arp Type: S-Static D-Dynamic O-Openflow R-Rule M-Multiport I-Invalid IP address MAC address VLAN Interface Aging Type 100.1.1.2 7425-8ae3-7c02 100 GE1/0 20 D
动态PW配置举例
动态和静态的区别就在于创建PW的时候,没有指定in-label和out-label
如下:
[PE1]display current-configuration | begin xconnect xconnect-group ***100 connection ldp ac interface GigabitEthernet1/0 peer 2.2.2.3 pw-id 100 ---------------------------------------------------------------------- [PE2]display current-configuration | begin xconnect xconnect-group ***a100 #配置name是可以不一样的 connection ***100 #配置name是可以不一样的 ac interface GigabitEthernet2/0 peer 2.2.2.1 pw-id 100
验证:PW是LDP。
[PE1]display l2*** pw Flags: M - main, B - backup, H - hub link, S - spoke link, N - no split horizon Total number of PWs: 1 1 up, 0 blocked, 0 down, 0 defect, 0 idle, 0 duplicate Xconnect-group Name: ***100 Peer PW ID/Rmt Site In/Out Label Proto Flag Link ID State 2.2.2.3 100 917631/917629 LDP M 1 Up [PE2]display l2*** pw Flags: M - main, B - backup, H - hub link, S - spoke link, N - no split horizon Total number of PWs: 1 1 up, 0 blocked, 0 down, 0 defect, 0 idle, 0 duplicate Xconnect-group Name: ***a100 Peer PW ID/Rmt Site In/Out Label Proto Flag Link ID State 2.2.2.1 100 917629/917631 LDP M 1 Up