实验拓扑:

 

跨运营商的MPLS ×××解决方案1_第1张图片

配置:

R1(CE):

interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 1.0.0.0
network 192.168.12.0
no auto-summary

R2(PE1)

ip vrf a
rd 1:1
route-target export 1:1
route-target import 1:1
route-target import 2:2
mpls label range 200 299
mpls label protocol ldp

interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding a
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 100
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
!
router rip
!
address-family ipv4 vrf a
redistribute bgp 100 metric transparent
network 192.168.12.0
no auto-summary
version 2
exit-address-family
!
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
!
address-family ***v4
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 send-community extended
exit-address-family
!
address-family ipv4 vrf a
redistribute rip
no synchronization
exit-address-family

mpls ldp router-id Loopback0

R3(RR):

mpls label range 300 399
mpls label protocol ldp

interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.34.3 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet0/1
ip address 192.168.23.3 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 100
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 6.6.6.6 remote-as 200
neighbor 6.6.6.6 ebgp-multihop 255
neighbor 6.6.6.6 update-source Loopback0
!
address-family ***v4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
neighbor 2.2.2.2 route-reflector-client
neighbor 6.6.6.6 activate
neighbor 6.6.6.6 send-community extended
neighbor 6.6.6.6 next-hop-unchanged
exit-address-family
!
mpls ldp router-id Loopback0

R4(PE-ASBR):

mpls label range 400 499
mpls label protocol ldp

interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.34.4 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet0/1
ip address 192.168.45.4 255.255.255.0
duplex auto
speed auto
!
router ospf 100
router-id 4.4.4.4
log-adjacency-changes
redistribute bgp 100 subnets
network 4.4.4.4 0.0.0.0 area 0
network 192.168.34.0 0.0.0.255 area 0
!
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 192.168.45.5 remote-as 200
!
address-family ipv4
neighbor 192.168.45.5 activate
no auto-summary
no synchronization
network 2.2.2.2 mask 255.255.255.255
network 3.3.3.3 mask 255.255.255.255
exit-address-family
!
mpls ldp router-id Loopback0

R5(PE-ASBR):

mpls label range 500 599
mpls label protocol ldp

interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.56.5 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet0/1
ip address 192.168.45.5 255.255.255.0
duplex auto
speed auto
!
router ospf 200
router-id 5.5.5.5
log-adjacency-changes
redistribute bgp 200 subnets
network 5.5.5.5 0.0.0.0 area 0
network 192.168.56.0 0.0.0.255 area 0
!
router bgp 200
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 192.168.45.4 remote-as 100
!
address-family ipv4
neighbor 192.168.45.4 activate
no auto-summary
no synchronization
network 6.6.6.6 mask 255.255.255.255
network 7.7.7.7 mask 255.255.255.255
exit-address-family
!
mpls ldp router-id Loopback0

R6(RR):

mpls label range 600 699
mpls label protocol ldp

interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.56.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet0/1
ip address 192.168.67.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 200
router-id 6.6.6.6
log-adjacency-changes
network 6.6.6.6 0.0.0.0 area 0
network 192.168.56.0 0.0.0.255 area 0
network 192.168.67.0 0.0.0.255 area 0
!
router bgp 200
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 ebgp-multihop 255
neighbor 3.3.3.3 update-source Loopback0
neighbor 7.7.7.7 remote-as 200
neighbor 7.7.7.7 update-source Loopback0
!
address-family ***v4
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 send-community extended
neighbor 3.3.3.3 next-hop-unchanged
neighbor 7.7.7.7 activate
neighbor 7.7.7.7 send-community extended
neighbor 7.7.7.7 route-reflector-client
exit-address-family
!
mpls ldp router-id Loopback0

R7(PE):

mpls label range 700 799
mpls label protocol ldp

interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding b
ip address 192.168.78.7 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.67.7 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 200
router-id 7.7.7.7
log-adjacency-changes
network 7.7.7.7 0.0.0.0 area 0
network 192.168.67.0 0.0.0.255 area 0
!
router rip
!
address-family ipv4 vrf b
redistribute bgp 200 metric transparent
network 192.168.78.0
no auto-summary
version 2
exit-address-family
!
router bgp 200
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 6.6.6.6 remote-as 200
neighbor 6.6.6.6 update-source Loopback0
!
address-family ***v4
neighbor 6.6.6.6 activate
neighbor 6.6.6.6 send-community extended
exit-address-family
!
address-family ipv4 vrf b
redistribute rip
no synchronization
exit-address-family
!
mpls ldp router-id Loopback0

R8(CE):

interface Loopback0
ip address 8.8.8.8 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.78.8 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 8.0.0.0
network 192.168.78.0
no auto-summary

验证:

分析:

数据从R8(CE)发出进入R7的vrf b

跨运营商的MPLS ×××解决方案1_第2张图片

从上图可以到数据包 打双层标签,

204是ISPA R2给1.1.1.1分配的标签并且通过MP-EBGP带到R7

跨运营商的MPLS ×××解决方案1_第3张图片 

603是R6 给1.1.1.1下一跳2.2.2.2分配的标签

数据包进入R6,

从上图可以看出603 是untagged 标签全部被弹出,一个没有标签的数据包发送给R5,

到R5以后不带标签的数据包R5无法处理丢弃,所以导致数据包无法到达对端。

解决方案:

R4:

router bgp 100
address-family ipv4
neighbor 192.168.45.5 send-label

R5:

router bgp 200
address-family ipv4
neighbor 192.168.45.4send-label

查看:

从上图可以看出 已经分配了标签也就是说 R6到R5的数据包不是IPV4 变成了标签交换。

验证:

跨运营商的MPLS ×××解决方案1_第4张图片

结论:

在mpls ××× 中LDP 标签要贯通整个MP-BGP的路径数据包才可以通信。