Option C
在PE之間起MP-ebgp鄰居,直接傳遞客戶的***v4路由。實現的關鍵在PE的鄰居關係的建立。
一種方法是在ASBR上宣告PE的環回口路由,然後在ASBR上將學到的對端PE的環回口重分發進IGP;
另一種方法就是PE和ASBR之間起ipv4 的鄰居關係;
第一種方法在傳遞的過程中需要2層標籤;第二種需要3層標籤。
關於標籤的傳遞:R4和R5之間、R5和R6之間、R6和R7之間要爲PE環回口的bgp路由分配標籤,只能由bgp來分配,就需要在bgp鄰居之間send-label。R5和R6之間要運行LDP,並且要環回口建立鄰居。
此處僅列出R2、R4、R5
R1的配置爲普通PE-CE路由協議
R2的配置:
ip vrf A
rd 100:29
route-target export 100:29
route-target import 100:29
!
mpls label range 200 299
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 23.1.1.2 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip vrf forwarding A
ip address 12.1.1.2 255.255.255.0
!
!
router eigrp 90
network 2.2.2.2 0.0.0.0
network 23.1.1.0 0.0.0.255
no auto-summary
!
router ospf 110 vrf A
log-adjacency-changes
redistribute bgp 100 subnets
network 12.1.1.0 0.0.0.255 area 0
!
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 9.9.9.9 remote-as 200
neighbor 9.9.9.9 ebgp-multihop 255
neighbor 9.9.9.9 update-source Loopback0
!
address-family ipv4
no synchronization
no auto-summary
exit-address-family
!
address-family ***v4
neighbor 9.9.9.9 activate
neighbor 9.9.9.9 send-community extended
exit-address-family
!
address-family ipv4 vrf A
no synchronization
redistribute ospf 110 vrf A match internal external 1 external 2 nssa-external 1 nssa-external 2
exit-address-family
R4的關鍵配置:
mpls label range 400 499
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
ip address 45.1.1.4 255.255.255.0
mpls bgp forwarding
!
interface Ethernet0/1
ip address 34.1.1.4 255.255.255.0
mpls ip
!
router eigrp 90
network 4.4.4.4 0.0.0.0
network 34.1.1.0 0.0.0.255
redistribute bgp 100 metric 10000 100 255 1 1500 route-map R9
no auto-summary
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
neighbor 45.1.1.5 remote-as 120
neighbor 45.1.1.5 send-label
no auto-summary
!
access-list 1 permit 9.9.9.9
!
route-map R9 permit 10
match ip address 1
!
R5:
mpls label range 500 599
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
ip address 56.1.1.5 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 45.1.1.5 255.255.255.0
mpls bgp forwarding
!
!
router ospf 110
log-adjacency-changes
network 5.5.5.5 0.0.0.0 area 0
network 56.1.1.0 0.0.0.255 area 0
!
router bgp 120
no synchronization
bgp log-neighbor-changes
neighbor 6.6.6.6 remote-as 120
neighbor 6.6.6.6 update-source Loopback0
neighbor 6.6.6.6 next-hop-self
neighbor 6.6.6.6 send-label
neighbor 45.1.1.4 remote-as 100
neighbor 45.1.1.4 send-label
no auto-summary
!
R1#traceroute 10.10.10.10 source l0
Type escape sequence to abort.
Tracing the route to 10.10.10.10
1 12.1.1.2 0 msec 0 msec 0 msec
2 23.1.1.3 [MPLS: Labels 302/904 Exp 0] 0 msec 0 msec 0 msec
3 34.1.1.4 [MPLS: Labels 404/904 Exp 0] 0 msec 4 msec 4 msec
4 45.1.1.5 [MPLS: Labels 503/904 Exp 0] 4 msec 4 msec 4 msec
5 56.1.1.6 [MPLS: Labels 603/904 Exp 0] 8 msec 4 msec 4 msec
6 67.1.1.7 [MPLS: Labels 703/904 Exp 0] 4 msec 8 msec 4 msec
7 78.1.1.8 [MPLS: Labels 801/904 Exp 0] 4 msec 4 msec 8 msec
8 19.1.1.9 [MPLS: Label 904 Exp 0] 4 msec 4 msec 4 msec
9 19.1.1.10 4 msec * 0 msec
第二種方法:將PE的環回口用bgp傳遞,下面僅將左側的AS用bgp傳遞,右邊還是重分發到IGP,看區別
R1#traceroute 10.10.10.10 sou l0
Type escape sequence to abort.
Tracing the route to 10.10.10.10
1 12.1.1.2 4 msec 0 msec 0 msec
2 23.1.1.3 [MPLS: Labels 301/404/904 Exp 0] 0 msec 0 msec 0 msec
3 34.1.1.4 [MPLS: Labels 404/904 Exp 0] 0 msec 0 msec 0 msec
4 45.1.1.5 [MPLS: Labels 502/904 Exp 0] 4 msec 0 msec 0 msec
5 56.1.1.6 [MPLS: Labels 602/904 Exp 0] 0 msec 0 msec 0 msec
6 67.1.1.7 [MPLS: Labels 703/904 Exp 0] 0 msec 0 msec 0 msec
7 78.1.1.8 [MPLS: Labels 801/904 Exp 0] 0 msec 4 msec 0 msec
8 19.1.1.9 [MPLS: Label 904 Exp 0] 0 msec 0 msec 0 msec
9 19.1.1.10 0 msec * 4 msec
R2和R4的配置如下:
R2:
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
neighbor 9.9.9.9 remote-as 200
neighbor 9.9.9.9 ebgp-multihop 255
neighbor 9.9.9.9 update-source Loopback0
!
address-family ipv4
no synchronization
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-label
no auto-summary
exit-address-family
!
address-family ***v4
neighbor 9.9.9.9 activate
neighbor 9.9.9.9 send-community extended
exit-address-family
!
address-family ipv4 vrf A
no synchronization
redistribute ospf 110 vrf A match internal external 1 external 2 nssa-external 1 nssa-external 2
exit-address-family
R4:
router eigrp 90
network 4.4.4.4 0.0.0.0
network 34.1.1.0 0.0.0.255
no auto-summary
router bgp 100
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 45.1.1.5 remote-as 120
!
address-family ipv4
no synchronization
network 2.2.2.2 mask 255.255.255.255
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 next-hop-self
neighbor 2.2.2.2 send-label
neighbor 45.1.1.5 activate
neighbor 45.1.1.5 send-label
no auto-summary
exit-address-family