MPLS方式解決BGP路由黑洞

1、實驗拓撲
MPLS方式解決BGP路由黑洞
2、各端口基本互聯配置,各路由器開啓環回口 R1-R4:AS100 ;R1、R5:AS 200;R4、R6:AS 300
3、實驗目的:要求CE1與CE2環回口互通
4、a、原理
按上圖配置好BGP,R5使用環回口pingR6換回口是不通的,原因是在R2,R3上出現的路由黑洞(沒有1.1.1.1和6.6.6.6的路由),所以R1與R6互ping都不通。
R5#ping 6.6.6.6 source 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5
.....
Success rate is 0 percent (0/5)
解決BGP路由黑洞有很多種,我們其中最簡單的一種通過MPLS來解決,只需要在IBGP端口運行MPLS IP。
配置好MPLS後再ping,可以互通
Router#ping 6.6.6.6 source 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/3 ms
b、原因
MPLS將不爲通過BGP學習到的路由條目分發標籤號;
但是在訪問BGP學習的目標時,封裝該目標BGP下一跳地址所在網段的標籤號;
使中間未運行BGP協議的路由器,基於標籤號將流量轉發到BGP的下一跳處,來避免路由黑洞。
c、查看FIB表,跟蹤標籤情況
R1#sh ip cef detail
6.6.6.0/24, epoch 0, flags [rib only nolabel, rib defined all labels]
recursive via 4.4.4.4
recursive via 4.4.4.0/24
nexthop 12.12.12.2 Ethernet0/0 label 201
到R1 查看FIB表,發現去往6.6.6.6標籤號爲201
d、查看LFIB表,跟蹤標籤情況
R1#sh mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
100 Pop Label 2.2.2.0/24 0 Et0/0 12.12.12.2
101 203 3.3.3.0/24 0 Et0/0 12.12.12.2
102 201 4.4.4.0/24 0 Et0/0 12.12.12.2
103 Pop Label 23.23.23.0/24 0 Et0/0 12.12.12.2
104 202 34.34.34.0/24 0 Et0/0 12.12.12.2

在查找LFIB表 走4.4.4.4出去,欺騙了R2和R3,最後在R4彈出標籤,到6.6.6.6
e、查看入出標籤情況
Router#sh mpls ip binding
1.1.1.0/24
in label: imp-null
out label: 200 lsr: 2.2.2.2:0
2.2.2.0/24
in label: 100
out label: imp-null lsr: 2.2.2.2:0 inuse
3.3.3.0/24
in label: 101
out label: 203 lsr: 2.2.2.2:0 inuse
4.4.4.0/24
in label: 102
out label: 201 lsr: 2.2.2.2:0 inuse
12.12.12.0/24
in label: imp-null
out label: imp-null lsr: 2.2.2.2:0
15.15.15.0/24
in label: imp-null
23.23.23.0/24
in label: 103
out label: imp-null lsr: 2.2.2.2:0 inuse
34.34.34.0/24
in label: 104
out label: 202 lsr: 2.2.2.2:0 inuse
通過標籤可以看到:label 201是mpls分配給igp路由4.4.4.0的。

5、配置:

R1:
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Ethernet0/0
ip address 12.12.12.1 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 15.15.15.1 255.255.255.0

router eigrp 100
network 1.1.1.0 0.0.0.255
network 12.12.12.0 0.0.0.255
!
router bgp 100
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 15.15.15.5 remote-as 200

R2:
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Ethernet0/0
ip address 12.12.12.2 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 23.23.23.2 255.255.255.0
mpls ip

router eigrp 100
network 2.2.2.0 0.0.0.255
network 12.12.12.0 0.0.0.255
network 23.23.23.0 0.0.0.255

R3:

!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Ethernet0/0
ip address 23.23.23.3 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 34.34.34.3 255.255.255.0
mpls ip

router eigrp 100
network 3.3.3.0 0.0.0.255
network 23.23.23.0 0.0.0.255
network 34.34.34.0 0.0.0.255

R4:
!
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface Ethernet0/0
ip address 34.34.34.4 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 46.46.46.4 255.255.255.0

!
router eigrp 100
network 4.4.4.0 0.0.0.255
network 34.34.34.0 0.0.0.255
!
router bgp 100
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 4.4.4.0 mask 255.255.255.0
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 1.1.1.1 next-hop-self
neighbor 46.46.46.6 remote-as 300

R5:
!
interface Loopback0
ip address 5.5.5.5 255.255.255.0
!
interface Ethernet0/0
ip address 15.15.15.5 255.255.255.0

!
router bgp 200
bgp router-id 5.5.5.5
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 15.15.15.1 remote-as 100

!
R6:
interface Loopback0
ip address 6.6.6.6 255.255.255.0
!
interface Ethernet0/0
ip address 46.46.46.6 255.255.255.0
!
router bgp 300
bgp router-id 6.6.6.6
bgp log-neighbor-changes
network 6.6.6.0 mask 255.255.255.0
neighbor 46.46.46.4 remote-as 100

最後我們可以總結出:在mpls網絡中,mpls會給igp路由分配label,cef會給採用mpls分配好的label並且給下一跳是該igp的bgp路由分配該igp的label,數據在轉發的時候是按照cef表進行的,這樣那些沒有在mpls中分配標籤的bgp路由也可以按照標籤進行轉發。

6、相關配置命令詳解

1、啓用CEF

2、指定使用的標籤分發協議 (可選)

3、MPLS LDP router-id lo0 fo強制更改 (可選)

4、MPLS label range 200 299 (可選)

5、運行LDP

6、修改MTU值 (可選)

查詢命令:

show mpls interfaces //查看啓用MPLS的接口

show mpls ldp neighbor //查看LDP的鄰居表

show mpls ldp bindings //查看LIB表

show mpls forwarding-table //查看標籤轉發表LFIB

show mpls ip binding //可以直接看到一條路由的入標籤和出標籤

show ip cef //查看FIB表

show mpls ldp discovery detail //可看到transport-address

基本命令:

rouer(config)#ip cef

rouer(config)#int s0/0

rouer(config-if)#mpls ip //在接口下啓用MPLS

可選命令:

rouer(config)#mpls label protocol ldp //指定使用LDP

rouer(config)#mpls ldp router-id lo0 //指定lo0爲router-id

rouer(config)#mpls label range 200 299 //指定路由器分配標籤的範圍,需要重新建立TCP連接

rouer(config-if)#mpls ldp discovery transport-address interface //指定自已的transport-address

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章