還是這張圖,R2,R3fa1/0shu同理R5,R7。
這次MP-EBGP鄰居建立在RR上,因爲R4,R5沒有必要收到這麼多***v4的前綴,而R3,R6上都有。
既然R3,R6要建立MP-EBGP鄰居關係,首先要知道對方環回口的地址,怎麼得到對方環回口的地址呢?
通過BGP即圖中藍色的部分。
R2(config)#router bgp 10
R2(config-router)#add ipv4
R2(config-router-af)#nei 3.3.3.3 ac
R3(config)#router bgp 10
R3(config-router)#add ipv4
R3(config-router-af)#nei 2.2.2.2 ac
R3(config-router-af)#nei 2.2.2.2 route-reflector-client
R3(config-router-af)#nei 4.4.4.4 ac
R3(config-router-af)#nei 4.4.4.4 route-reflector-client
R4(config)#router bgp 10
R4(config-router)#add v
R4(config-router-af)#nei 3.3.3.3 ac
R4(config-router-af)#nei 3.3.3.3 route-reflector-client
R4(config-router)#nei 45.45.45.5 remote 20
R4(config-router)#add ipv4
R4(config-router-af)#nei 45.45.45.5 ac
鄰居關係已經建立,現在在BGP中宣告環回口地址。宣告完之後查看:
R3#show ip bgp
Network Next Hop Metric LocPrf Weight Path
r>i2.2.2.2/32 2.2.2.2 0 100 0 i
*> 3.3.3.3/32 0.0.0.0 0 32768 i
r>i4.4.4.4/32 4.4.4.4 0 100 0 i
* i5.5.5.5/32 45.45.45.5 0 100 0 20 i
* i6.6.6.6/32 45.45.45.5 0 100 0 20 i
* i7.7.7.7/32 45.45.45.5 0 100 0 20 i
對於R5,R6,R7的路由沒有最優,採用Next-hop-self的方式解決
R4(config-router-af)#nei 3.3.3.3 next-hop-self (在add ipv4中)
R3#show ip bgp
Network Next Hop Metric LocPrf Weight Path
r>i2.2.2.2/32 2.2.2.2 0 100 0 i
*> 3.3.3.3/32 0.0.0.0 0 32768 i
r>i4.4.4.4/32 4.4.4.4 0 100 0 i
*>i5.5.5.5/32 4.4.4.4 0 100 0 20 i
*>i6.6.6.6/32 4.4.4.4 0 100 0 20 i
*>i7.7.7.7/32 4.4.4.4 0 100 0 20 i
既然學習到了對端的地址,那麼就可以建立MP-BGP關係
R3(config)#router bgp 10
R3(config-router)#nei 6.6.6.6 remote 20
R3(config-router)#nei 6.6.6.6 up lo 0
R3(config-router)#nei 6.6.6.6 e
R3(config-router)#add ***v
R3(config-router-af)#nei 6.6.6.6 ac
現在已經學習到了路由,控制層面的問題解決了,但是ping的通嗎?
R1#show ip route ospf
8.0.0.0/32 is subnetted, 1 subnets
O IA 8.8.8.8 [110/11] via 12.12.12.2, 00:00:26, FastEthernet0/0
78.0.0.0/24 is subnetted, 1 subnets
O IA 78.78.78.0 [110/11] via 12.12.12.2, 00:00:25, FastEthernet0/0
R1#ping 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
問題出在哪呢?
R2#show ip bgp ***v4 all labels
Route Distinguisher: 10:2 (abc)
1.1.1.1/32 12.12.12.1 203/nolabel
8.8.8.8/32 6.6.6.6 205/603
12.12.12.0/24 0.0.0.0 204/aggregate(abc)
78.78.78.0/24 6.6.6.6 206/602
Route Distinguisher: 10:7
8.8.8.8/32 6.6.6.6 nolabel/603
78.78.78.0/24 6.6.6.6 nolabel/602
從R6收到了一個標籤,木問題。
然後查看R3:
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
300 Pop tag 2.2.2.2/32 0 Fa0/0 23.23.23.2
301 Pop tag 4.4.4.4/32 590 Fa0/1 34.34.34.4
302 204 10:2:12.12.12.0/24 \
0 Fa0/0 23.23.23.2
303 203 10:2:1.1.1.1/32 0 Fa0/0 23.23.23.2
304 Untagged 7.7.7.7/32 0 Fa0/1 34.34.34.4
305 Untagged 6.6.6.6/32 0 Fa0/1 34.34.34.4
306 Untagged 5.5.5.5/32 0 Fa0/1 34.34.34.4
對於6.6.6.6的路由是Untag的!到達不了下一跳。
爲什麼呢?
因爲這條路由是BGP路由!對於BGP路由只分配下一跳的標籤而不分配路由的標籤。
解決方法:
將BGP的路由在ASBR(R4,R5)上重分發進IGP。
R4(config)#router ospf 1
R4(config-router)#redistribute bgp 10 subnets
R5(config)#router ospf 1
R5(config-router)#redistribute bgp 20 subnets
查看現象,還是沒有分配標籤!
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
300 Pop tag 2.2.2.2/32 0 Fa0/0 23.23.23.2
301 Pop tag 4.4.4.4/32 590 Fa0/1 34.34.34.4
302 204 10:2:12.12.12.0/24 \
0 Fa0/0 23.23.23.2
303 203 10:2:1.1.1.1/32 0 Fa0/0 23.23.23.2
304 Untagged 7.7.7.7/32 0 Fa0/1 34.34.34.4
305 Untagged 6.6.6.6/32 0 Fa0/1 34.34.34.4
306 Untagged 5.5.5.5/32 0 Fa0/1 34.34.34.4
對於6.6.6.6的路由是Untag的!這個不應該,沒有從R4收到標籤!!
爲什麼呢?
R4#show ip route bgp
5.0.0.0/32 is subnetted, 1 subnets
B 5.5.5.5 [20/0] via 45.45.45.5, 00:18:24
6.0.0.0/32 is subnetted, 1 subnets
B 6.6.6.6 [20/0] via 45.45.45.5, 00:17:53
7.0.0.0/32 is subnetted, 1 subnets
B 7.7.7.7 [20/0] via 45.45.45.5, 00:17:53
因爲R4上仍然是BGP的路由!怎麼解決?
R4(config)#router bgp 10
R4(config-router)#address-family ipv4
R4(config-router-af)#nei 45.45.45.5send-label
R5(config)#router bgp 20
R5(config-router)#address-family ipv4
R5(config-router-af)#nei 45.45.45.4 send-label
查看現象:
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
300 Pop tag 2.2.2.2/32 0 Fa0/0 23.23.23.2
301 Pop tag 4.4.4.4/32 590 Fa0/1 34.34.34.4
302 204 10:2:12.12.12.0/24 \
0 Fa0/0 23.23.23.2
303 203 10:2:1.1.1.1/32 0 Fa0/0 23.23.23.2
304 403 5.5.5.5/32 0 Fa0/1 34.34.34.4
305 408 6.6.6.6/32 0 Fa0/1 34.34.34.4
306 409 7.7.7.7/32 0 Fa0/1 34.34.34.4
R2#show ip cef vrf abc 8.8.8.8
8.8.8.8/32, version 12, epoch 0, cached adjacency 23.23.23.3
0 packets, 0 bytes
tag information set
local tag: 207
fast tag rewrite with Fa0/1, 23.23.23.3, tags imposed: {305 603}
R1#traceroute 8.8.8.8
1 12.12.12.2 116 msec 68 msec 20 msec
2 23.23.23.3 [MPLS: Labels 305/603 Exp 0] 144 msec 132 msec 144 msec
3 34.34.34.4 [MPLS: Labels 408/603 Exp 0] 184 msec 168 msec 60 msec
4 45.45.45.5 [MPLS: Labels 500/603 Exp 0] 80 msec 92 msec 108 msec
5 56.56.56.6 [MPLS: Label 603 Exp 0] 68 msec 56 msec 52 msec
6 78.78.78.7 [MPLS: Label 703 Exp 0] 152 msec 172 msec 68 msec
7 78.78.78.8 188 msec * 212 msec
頂層標籤用來到達下一跳,因爲下一跳改變2次所以底層標籤改變兩次。
現在我打開R2R4和R5R7之間的接口!宣告進IGP
R1#traceroute 8.8.8.8
1 12.12.12.2 108 msec 28 msec 32 msec
2 24.24.24.4 [MPLS: Labels 408/603 Exp 0] 176 msec 160 msec 140 msec
3 45.45.45.5 [MPLS: Labels 500/603 Exp 0] 72 msec 128 msec 164 msec
4 56.56.56.6 [MPLS: Label 603 Exp 0] 116 msec 200 msec 84 msec
5 78.78.78.7 [MPLS: Label 703 Exp 0] 124 msec 104 msec 80 msec
6 78.78.78.8 192 msec * 224 msec
明顯跳過了R3,因爲標籤的原因,到達下一跳走最優路徑。但能不能跳過R7直接從R6到R8,這樣減少了RR上的帶寬?
R6(config)#router bgp 20
R6(config-router)#add v
R6(config-router-af)#nei 3.3.3.3 next-hop-unchanged
只要在R6上對R3下一跳不變就可以了
R1#traceroute 8.8.8.8
1 12.12.12.2 36 msec 240 msec 4 msec
2 24.24.24.4 [MPLS: Labels 409/703 Exp 0] 216 msec 8 msec 160 msec
3 45.45.45.5 [MPLS: Labels 502/703 Exp 0] 108 msec 132 msec 84 msec
4 78.78.78.7 [MPLS: Label 703 Exp 0] 120 msec 76 msec 52 msec
5 78.78.78.8 152 msec * 220 msec
同理R6。
數據層面已經解決,總結一下:
1.兩個路由反射器要互通
運行IPV4的BGP,通告接口Lo 0
2.解決頂層標籤的問題
在ASBR上,把BGP路由redistribute進IGP
3.解決兩個ASBR邊界路由器的鏈路上標籤的問題
IPv4 BGP+ send-label
4.數據面路徑最優的問題
next-hop-unchanged
下面是一些優化的問題:
!把所有BGP路由重發布進IGP,這種不行!
可以採用BGP community的方式來控制路由
R2和R3宣告Lo0的時候community 234:1
R6和R7宣告Lo0的時候community 567:1
3.把所有的BGP的路由都設成標籤了,需要改進
set mpls-label
match mpls-label