MPLS 專網中的疑難故障排查(一)

課題內容:網絡

因爲eBGP接口掩碼配置錯誤,致使的路由拒絕接收ide

知識點:BGP第三方下一跳、BGP路由更新oop


根據現有網絡技術學習及參考材料,BGP對等體之間創建對等關係,傳遞路由更新,並未有檢查對等體掩碼的行爲。學習

本文將結合實際案例爲你們分享一個MPLS專網中因爲一個子網掩碼配置錯誤致使的eBGP對等體拒絕接收路由更新的場景。優化


網絡拓撲:ui

image

藉着研究課題,複習一下MPLS 專網的基本部署練習;spa


部署 VRF:  R一、R四、R5作相同配置debug

R1(config)#ip vrf CTO
R1(config-vrf)#rd 1:1       
R1(config-vrf)#route-target 6:63d


配置基本的IP地址code

配置省略,這裏僅僅展現 vrf接口的配置;

R1(config-if)#ip vrf forwarding CTO
R1(config-if)#ip address 10.1.1.13 255.255.255.252
R1(config-if)#no shutdown


R4(config)#interface e0/0
R4(config-if)#ip vrf forwarding CTO
R4(config-if)#ip address 10.1.1.17 255.255.255.0    //你們注意,這裏我故意把掩碼配置錯誤了 //
R4(config-if)#no shutdown


R5(config)#interface e0/0
R5(config-if)#ip vrf forwarding CTO
R5(config-if)#ip address 10.1.1.21 255.255.255.252
R5(config-if)#no shutdown

//切記,必定不要忘記檢查和驗證配置哦 //

基礎的 ping 命令和 牛逼的 show ip interface brief 是行之有效的方法,固然,PE設備上的ping vrf CTO X.X.X.X 仍是要注意的呢;


配置 MPLS Core 的IGP,配置省略

驗證必不可少

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.255.5        0   FULL/  -        00:00:31    10.1.1.9        Ethernet0/3
10.1.255.4        0   FULL/  -        00:00:31    10.1.1.5        Ethernet0/2
10.1.255.1        0   FULL/  -        00:00:30    10.1.1.1        Ethernet0/0


R3#show ip route ospf | begin Gateway
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks
O        10.1.255.1/32 [110/11] via 10.1.1.1, 00:01:03, Ethernet0/0
O        10.1.255.4/32 [110/11] via 10.1.1.5, 00:00:53, Ethernet0/2
O        10.1.255.5/32 [110/11] via 10.1.1.9, 00:00:42, Ethernet0/3


配置AS 65078的 iBGP

固然,僅僅爲了實驗,咱們這裏R7和R8就採用直鏈接口作BGP對等體配置;

R7#show run | s r b
router bgp 65078
  network 10.7.1.0 mask 255.255.255.0
  neighbor 10.1.1.26 remote-as 65078
  neighbor 10.1.1.26 next-hop-self


R8#show run | s router bgp
router bgp 65078
  network 10.8.1.0 mask 255.255.255.0
  neighbor 10.1.1.25 remote-as 65078
  neighbor 10.1.1.25 next-hop-self


驗證:

R7#show ip bgp       
BGP table version is 3, local router ID is 10.7.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
               x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
  *>  10.7.1.0/24      0.0.0.0                  0         32768 i
  *>i 10.8.1.0/24      10.1.1.26                0    100      0 i


R8#show ip bgp
BGP table version is 3, local router ID is 10.8.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
               x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
  *>i 10.7.1.0/24      10.1.1.25                0    100      0 i
  *>  10.8.1.0/24      0.0.0.0                  0         32768 i


繼續部署MPLS Core,完成內部BGP配置

R3#show run | s r b
router bgp 65001
  bgp log-neighbor-changes
  bgp listen range 10.1.255.0/24 peer-group iBGP
  no bgp default ipv4-unicast
  neighbor iBGP peer-group
  neighbor iBGP remote-as 65001
  neighbor iBGP update-source Loopback0
  !
  address-family ipv4
  exit-address-family
  !
  address-family ***v4
   neighbor iBGP activate
   neighbor iBGP send-community extended
   neighbor iBGP route-reflector-client
  exit-address-family


R一、R四、R5
router bgp 65001
  bgp log-neighbor-changes
  no bgp default ipv4-unicast
  neighbor 10.1.255.3 remote-as 65001
  neighbor 10.1.255.3 update-source Loopback0
  !
  address-family ipv4
  exit-address-family
  !
  address-family ***v4
   neighbor 10.1.255.3 activate
   neighbor 10.1.255.3 send-community extended
  exit-address-family


驗證

R3#show bgp ***v4 unicast all summary
BGP router identifier 10.1.255.3, local AS number 65001
BGP table version is 1, main routing table version 1

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
*10.1.255.1     4        65001       5       5        1    0    0 00:01:19        0
*10.1.255.4     4        65001       2       2        1    0    0 00:00:31        0
*10.1.255.5     4        65001       2       2        1    0    0 00:00:28        0
* Dynamically created based on a listen range command
Dynamically created neighbors: 3, Subnet ranges: 1

BGP peergroup iBGP listen range group members:
   10.1.255.0/24

Total dynamically created neighbors: 3/(100 max), Subnet ranges: 1


配置MPLS標籤協議: LDP

R3(config)#interface range e0/0,e0/2-3
R3(config-if-range)#mpls ip


R1(config)#interface e0/0
R1(config-if)#mpls ip


R4(config)#interface e0/2
R4(config-if)#mpls ip


R5(config)#interface e0/3
R5(config-if)#mpls ip


觀察LDP鄰居創建狀況:

R3#
*Sep  6 08:47:50.047: %LDP-5-NBRCHG: LDP Neighbor 10.1.255.1:0 (1) is UP
R3#
*Sep  6 08:48:21.644: %LDP-5-NBRCHG: LDP Neighbor 10.1.255.4:0 (2) is UP
R3#
*Sep  6 08:48:39.094: %LDP-5-NBRCHG: LDP Neighbor 10.1.255.5:0 (3) is UP


配置 PE – CE 之間的eBGP

R6(config)#router bgp 65006
R6(config-router)#network 10.6.1.0 mask 255.255.255.0
R6(config-router)#neighbor 10.1.1.13 remote-as 65001


R7(config)#router bgp 65078
R7(config-router)#neighbor 10.1.1.17 remote-as 65001


R8(config)#router bgp 65078
R8(config-router)#neighbor 10.1.1.21 remote-as 65001


R1(config)#router bgp 65001
R1(config-router)#address-family ipv4 vrf CTO
R1(config-router-af)#neighbor 10.1.1.14 remote-as 65006

R1(config-router-af)#
*Sep  6 08:54:22.981: %BGP-5-ADJCHANGE: neighbor 10.1.1.14 *** vrf CTO Up   //R1和R6對等體創建成功 //


R4(config)#router bgp 65001
R4(config-router)#address-family ipv4 vrf CTO
R4(config-router-af)#neighbor 10.1.1.18 remote-as 65078
R4(config-router-af)#
*Sep  6 08:55:31.655: %BGP-5-ADJCHANGE: neighbor 10.1.1.18 *** vrf CTO Up   //R4和R7對等體創建成功 //


R5(config)#router bgp 65001
R5(config-router)#address-family ipv4 vrf CTO
R5(config-router-af)#neighbor 10.1.1.22 remote-as 65078
R5(config-router-af)#
*Sep  6 08:56:40.336: %BGP-5-ADJCHANGE: neighbor 10.1.1.22 *** vrf CTO Up  //R5和R8對等體創建成功 //


至此,一個基本的MPLS專網部署完畢。


如今進行驗證:

R6#show ip route bgp | begin Gateway
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
B        10.7.1.0/24 [20/0] via 10.1.1.13, 00:02:54
B        10.8.1.0/24 [20/0] via 10.1.1.13, 00:02:54


R8#show ip route bgp | begin Gateway
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.6.1.0/24 [20/0] via 10.1.1.21, 00:03:54
B        10.7.1.0/24 [200/0] via 10.1.1.25, 00:22:09


R7#show ip route bgp | begin Gateway
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.6.1.0/24 [200/0] via 10.1.1.26, 00:04:26
B        10.8.1.0/24 [200/0] via 10.1.1.26, 00:22:53

// R7上關於65006的路由的下一跳去往了 R8,而不是去往 R4,顯然這是出了問題的 //


R7#show ip bgp                     
BGP table version is 4, local router ID is 10.7.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
               x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
  *>i 10.6.1.0/24      10.1.1.26                0    100      0 65001 65006 i
  *>  10.7.1.0/24      0.0.0.0                  0         32768 i
  *>i 10.8.1.0/24      10.1.1.26                0    100      0 i

// R7並無從 R4 學習到任何路由哦 //


R4#show bgp ***v4 unicast vrf CTO neighbors 10.1.1.18 advertised-routes
BGP table version is 5, local router ID is 10.1.255.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
               x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 1:1 (default for vrf CTO)
  *>i 10.6.1.0/24      10.1.255.1               0    100      0 65006 i

Total number of prefixes 1

// R4向R7通告了 10.6.1.0/24的 BGP前綴,看起來問題出在R7上的樣子呢(事實證實個人想法是錯誤的) //


然而事實上咱們並無在R7上部署任何入站路由過濾策略

R7#show ip protocols | section bgp
Routing Protocol is "bgp 65078"
   Outgoing update filter list for all interfaces is not set
   Incoming update filter list for all interfaces is not set

   IGP synchronization is disabled
   Automatic route summarization is disabled
   Neighbor(s):
     Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
     10.1.1.17                                           
     10.1.1.26                                           
   Maximum path: 1
   Routing Information Sources:
     Gateway         Distance      Last Update
     10.1.1.26            200      00:13:58
   Distance: external 20 internal 200 local 200


通過一番思索,最終將故障判判定位在更新報文中

爲了讓你們更清晰的看到形成故障的根本緣由,我特地將報文抓取了出來;

同時在 R7 上開啓debug,觀察更新狀況:

R7#debug ip bgp updates in

R7#clear ip bgp * soft in  // 在 R7上強制 R4 發送路由更新過來 //


image

從報文中能夠清晰的看出,從R4更新給 R7的前綴中,下一跳屬性被設置爲了 10.1.1.6,而不是自身的 e0/0 接口的地址 10.1.1.17;


再來看下 R7 的debug log

image

log指出,來自 10.1.1.17(R4)的更新,下一跳屬性爲10.1.1.6,並不在本地子網中,也不在本地接口直連範圍內,並被拒絕收取;


那麼,爲何R4要作出如此荒謬的事情嘞?

這就不得不考慮咱們在最開始提到的 第三方下一跳;


R4#show ip cef vrf CTO 10.6.1.0
10.6.1.0/24
   nexthop 10.1.1.6 Ethernet0/2 label 16 21

// 經過轉發表觀察,R4去往 10.6.1.0/24的下一跳爲 10.1.1.6 ,即R3的E0/2接口;

而 R4的  e0/0 接口子網掩碼爲  24 位,根據第三方下一跳的自動優化機制,R4 認爲 10.1.1.6 和 e0/0 的接口地址 10.1.1.17在同一子網啊,所以更新出去的前綴信息上攜帶的下一跳就是 10.1.1.6 啦。


那麼,如何驗證咱們的想法到底是否正確呢?

我們在 R4 上針對 R7的 eBGP鄰居作一個下一跳自我,強制修改下一跳爲 10.1.1.17 ,並觀察現象

R4

router bgp 65001

address-family ipv4 vrf CTO

  neighbor 10.1.1.18 next-hop-self


驗證想法

R7#cle ip bgp * soft
R7#show ip bgp
BGP table version is 5, local router ID is 10.7.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
               x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
  *>  10.6.1.0/24      10.1.1.17                              0 65001 65006 i
  * i                  10.1.1.26                0    100      0 65001 65006 i
  *>  10.7.1.0/24      0.0.0.0                  0         32768 i
  *>i 10.8.1.0/24      10.1.1.26                0    100      0 i

// 吶,路由從R4學來啦 //


爲何說這種故障難以排查呢? 由於若是R4的 e0/0 接口在全局的話,接口IP地址是沒法成功配置上的,正由於在vrf中,纔會有這種狀況的發生。


固然,最正經的解決方法,仍是老老實實的把接口掩碼修改成正確的。

相關文章
相關標籤/搜索