本文共 24127 字,大约阅读时间需要 80 分钟。
1、实验环境
以华为模拟器eNSP为实验环境,结合wireshark抓包进行BGP/MPLS ××× OptionA 控制层面、数据层面以及日常排错三个方面进行研究;如下图所示:Public routing table : OSPF
Destinations : 3 Routes : 3OSPF routing table status : <Active>
Destinations : 3 Routes : 3Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 2 D 23.23.23.2 GigabitEthernet
0/0/1
2.2.2.2/32 OSPF 10 1 D 23.23.23.2 GigabitEthernet0/0/112.12.12.0/24 OSPF 10 2 D 23.23.23.2 GigabitEthernet0/0/1OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0查看MPLS LDP session:<ASBR1>dis mpls ldp sessionLSP Information: LDP LSP
Public routing table : OSPF
Destinations : 3 Routes : 3OSPF routing table status : <Active>
Destinations : 3 Routes : 3Destination/Mask Proto Pre Cost Flags NextHop Interface
5.5.5.5/32 OSPF 10 1 D 45.45.45.5 GigabitEthernet
0/0/1
6.6.6.6/32 OSPF 10 2 D 45.45.45.5 GigabitEthernet0/0/156.56.56.0/24 OSPF 10 2 D 45.45.45.5 GigabitEthernet0/0/1OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0查看MPLS LDP session:<ASBR2>dis mpls ldp sessionLSP Information: LDP LSP
FEC In/Out Label In/Out IF Vrf Name
4.4.4.4/32 3/NULL -/- 5.5.5.5/32 NULL/3 -/GE0/0/1 5.5.5.5/32 1024/3 -/GE0/0/1 6.6.6.6/32 NULL/1025 -/GE0/0/1 6.6.6.6/32 1025/1025 -/GE0/0/1 2)配置各个站点CE与PE的×××实例:①ISP1:PE1:ip ***-instance spiipv4-familyroute-distinguisher 100:1***-target 100:1 export-extcommunity***-target 100:1 import-extcommunityinterface GigabitEthernet0/0/1ip binding ***-instance spiip address 192.168.1.254 255.255.255.0ip ***-instance spdipv4-familyroute-distinguisher 200:1***-target 200:1 export-extcommunity***-target 200:1 import-extcommunityinterface GigabitEthernet0/0/2ip binding ***-instance spdip address 10.10.1.254 255.255.255.0ping测试站点到网关②ISP2PE2:ip ***-instance spiipv4-familyroute-distinguisher 100:1***-target 100:1 export-extcommunity***-target 100:1 import-extcommunityinterface GigabitEthernet0/0/1ip binding ***-instance spiip address 192.168.2.254 255.255.255.0ip ***-instance spdipv4-familyroute-distinguisher 200:1***-target 200:1 export-extcommunity***-target 200:1 import-extcommunityinterface GigabitEthernet0/0/2ip binding ***-instance spdip address 10.10.2.254 255.255.255.0ping测试站点到网关3)配置MP-BGP在PE与ASBR之间传递×××V4站点×××私网路由:①ISP1建立MP-BGP连接:PE1:bgp 100undo default ipv4-unicastpeer 3.3.3.3 as-number 100 peer 3.3.3.3 connect-interface LoopBack0ipv4-family unicastundo synchronizationpeer 3.3.3.3 enableipv4-family ***v4policy ***-targetpeer 3.3.3.3 enable ASBR1:bgp 100undo default ipv4-unicastpeer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0ipv4-family unicastundo synchronizationpeer 1.1.1.1 enableipv4-family ***v4policy ***-targetpeer 1.1.1.1 enable查看MP-BGP建立连接情况:[ASBR1]dis bgp ***v4 all peerBGP local router ID : 3.3.3.3Local AS number : 100Total number of peers : 1 Peers in established state : 1Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv1.1.1.1 4 100 9 9 0 00:07:51 Established 0
宣告×××路有到MP-BGP:PE1:ipv4-family ***-instance spd network 10.10.1.0 255.255.255.0 ipv4-family ***-instance spi network 192.168.1.0查看***v4私网路由路有从PE1传递到ASBR1情况:<ASBR1>dis bgp ***v4 all routing-table BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 2Route Distinguisher: 100:1Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.1.0 1.1.1.1 0 100 0 i
Route Distinguisher: 200:1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 10.10.1.0/24 1.1.1.1 0 100 0 i
×××-Instance spd, Router ID 3.3.3.3:
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.1.0/24 1.1.1.1 0 100 0 i
×××-Instance spi, Router ID 3.3.3.3:
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 192.168.1.0 1.1.1.1 0 100 0 i
①ISP2
建立MP-BGP连接:PE2:bgp 200undo default ipv4-unicastpeer 4.4.4.4 as-number 200 peer 4.4.4.4 connect-interface LoopBack0ipv4-family unicastundo synchronizationpeer 4.4.4.4 enableipv4-family ***v4policy ***-targetpeer 4.4.4.4 enableASBR2:bgp 200undo default ipv4-unicastpeer 6.6.6.6 as-number 200 peer 6.6.6.6 connect-interface LoopBack0ipv4-family unicastundo synchronizationpeer 6.6.6.6 enableipv4-family ***v4policy ***-targetpeer 6.6.6.6 enable<ASBR2>dis bgp ***v4 all peerBGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 1 Peers in established state : 1Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv6.6.6.6 4 200 3 3 0 00:01:55 Established 0
宣告×××路有到MP-BGP:PE2ipv4-family ***-instance spd network 10.10.2.0 255.255.255.0 ipv4-family ***-instance spi network 192.168.2.0查看***v4私网路由路有从PE2传递到ASBR2情况:<ASBR2>dis bgp ***v4 all routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 2
Route Distinguisher: 100:1Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.2.0 6.6.6.6 0 100 0 i
Route Distinguisher: 200:1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 10.10.2.0/24 6.6.6.6 0 100 0 i
×××-Instance spd, Router ID 4.4.4.4:
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.2.0/24 6.6.6.6 0 100 0 i
×××-Instance spi, Router ID 4.4.4.4:
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 192.168.2.0 6.6.6.6 0 100 0 i
4)进行ASBR1与ASBR2 的OPTION A跨域配置:①ISP1ASBR1:interface GigabitEthernet0/0/0interface GigabitEthernet0/0/0.10dot1q termination vid 10ip binding ***-instance spiip address 34.34.34.3 255.255.255.0 arp broadcast enableinterface GigabitEthernet0/0/0.20dot1q termination vid 20ip binding ***-instance spdip address 34.34.34.33 255.255.255.0 arp broadcast enablePing 测对端接口地址:<ASBR1>ping -***-instance spi -a 34.34.34.3 34.34.34.4PING 34.34.34.4: 56 data bytes, press CTRL_C to breakReply from 34.34.34.4: bytes=56 Sequence=1 ttl=255 time=130 msReply from 34.34.34.4: bytes=56 Sequence=2 ttl=255 time=20 msReply from 34.34.34.4: bytes=56 Sequence=3 ttl=255 time=30 msReply from 34.34.34.4: bytes=56 Sequence=4 ttl=255 time=20 msReply from 34.34.34.4: bytes=56 Sequence=5 ttl=255 time=30 ms--- 34.34.34.4 ping statistics ---
5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 20/46/130 ms<ASBR1>ping -***-instance spd -a 34.34.34.33 34.34.34.44
PING 34.34.34.44: 56 data bytes, press CTRL_C to breakReply from 34.34.34.44: bytes=56 Sequence=1 ttl=255 time=140 msReply from 34.34.34.44: bytes=56 Sequence=2 ttl=255 time=20 msReply from 34.34.34.44: bytes=56 Sequence=3 ttl=255 time=30 msReply from 34.34.34.44: bytes=56 Sequence=4 ttl=255 time=30 msReply from 34.34.34.44: bytes=56 Sequence=5 ttl=255 time=20 ms路由互相导入与路由策略:
[ASBR1] ospf 11 ***-instance spiimport-route bgp[ASBR2] ospf 11 ***-instance spidn-bit-check disable ase(否则不加入ASBR2的××× spi路由表)[ASBR1]ospf 11 ***-instance spi[ASBR1-ospf-11]dn-bit-check disable ase[ASBR1]bgp 100[ASBR1-bgp]ipv4-family ***-instance spi[ASBR1-bgp-spi]import-route ospf 11ASBR1与ASBR2的××× spd 通过BGP路由交互:Bgp100ipv4-family ***-instance spd peer 34.34.34.44 as-number 200<ASBR1>dis bgp ***v4 all peer
BGP local router ID : 3.3.3.3
Local AS number : 100Total number of peers : 2 Peers in established state : 2Peer of IPv4-family for *** instance :
Routing Tables: spd
Destinations : 6 Routes : 6Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.1.0/24 IBGP 255 0 RD 1.1.1.1 GigabitEthernet
Routing Tables: spd
Destinations : 6 Routes : 6Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.1.0/24 EBGP 255 0 D 34.34.34.33 GigabitEthernet
spi routing table : Direct
Destinations : 4 Routes : 4Direct routing table status : <Active>
Destinations : 4 Routes : 4Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.2.0/24 Direct 0 0 D 192.168.2.254 GigabitEthernet
0/0/1
192.168.2.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0Direct routing table status : <Inactive>
Destinations : 0 Routes : 0<PE2>dis ip routing-table ***-instance spi verboseDestination: 192.168.2.0/24Protocol: Direct Process ID: 0Preference: 0 Cost: 0NextHop: 192.168.2.254 Neighbour: 0.0.0.0State: Active Adv Age: 03h29m00sTag: 0 Priority: highLabel: NULL QoSInfo: 0x0IndirectID: 0x0 RelayNextHop: 0.0.0.0 Interface: GigabitEthernet0/0/1TunnelID: 0x0 Flags: D②把*** spi中192.168.2.0直连路由导入MP-BGP中:
<PE2>dis current-configuration configuration bgp[V200R003C00]bgp 200undo default ipv4-unicastpeer 4.4.4.4 as-number 200 peer 4.4.4.4 connect-interface LoopBack0ipv4-family unicastundo synchronizationpeer 4.4.4.4 enableipv4-family ***v4policy ***-targetpeer 4.4.4.4 enableipv4-family ***-instance spi network 192.168.2.0③PE2 在MP-BGP中192.168.2.0/24路由情况:<PE2>dis bgp ***v4 ***-instance spi routing-table labelBGP Local router ID is 6.6.6.6
Status codes: - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 5Route Distinguisher: 100:1 Network NextHop In/Out Label> 192.168.2.0 192.168.2.254 1026/NULL<PE2>dis bgp ***v4 ***-instance spi routing-table 192.168.2.0BGP local router ID : 6.6.6.6
Local AS number : 200×××-Instance spi, Router ID 6.6.6.6:
Paths: 1 available, 1 best, 1 selectBGP routing table entry information of 192.168.2.0/24:Network route. From: 0.0.0.0 (0.0.0.0)Route Duration: 02h05m43s Direct Out-interface: GigabitEthernet0/0/1Original nexthop: 192.168.2.254Qos information : 0x0AS-path Nil, origin igp, MED 0, pref-val 0, valid, local, best, select, pre 0Not advertised to any peer yet④ASBR2 在MP-BGP中收到192.168.2.0/24路由情况:
<ASBR2>dis bgp ***v4 ***-instance spi routing-table labelBGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 5
Route Distinguisher: 100:1
Network NextHop In/Out Label
Routing Tables: spi
Destinations : 6 Routes : 6Destination/Mask Proto Pre Cost Flags NextHop Interface
34.34.34.0/24 Direct 0 0 D 34.34.34.4 GigabitEthernet
Routing Tables: spi
Destinations : 6 Routes : 6Destination/Mask Proto Pre Cost Flags NextHop Interface
34.34.34.0/24 Direct 0 0 D 34.34.34.3 GigabitEthernet
0/0/0.10
34.34.34.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0.1034.34.34.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0.10192.168.1.0/24 IBGP 255 0 RD 1.1.1.1 GigabitEthernet0/0/1192.168.2.0/24 O_ASE 150 1 D 34.34.34.4 GigabitEthernet0/0/0.10255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0⑧ 在ASBR1把192.168.2.0/24路由导入MP-BGP中:<ASBR1>dis current-configuration configuration bgp[V200R003C00]bgp 100undo default ipv4-unicastpeer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0ipv4-family unicastundo synchronizationpeer 1.1.1.1 enableipv4-family ***v4policy ***-targetpeer 1.1.1.1 enableipv4-family ***-instance spi import-route ospf 11<ASBR1>dis bgp ***v4 ***-instance spi routing-table label BGP Local router ID is 3.3.3.3 Status codes: - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 5Route Distinguisher: 100:1 Network NextHop In/Out Label> 192.168.2.0 34.34.34.4 1028/NULL⑨ 在PE1上收到192.168.2.0/24路由情况:<PE1>dis bgp ***v4 ***-instance spi routing-table labelBGP Local router ID is 1.1.1.1
Status codes: - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 5Route Distinguisher: 100:1 Network NextHop In/Out Label>i 192.168.2.0 3.3.3.3 NULL/1028<PE1>dis ip routing-table ***-instance spi verboseDestination: 192.168.2.0/24Protocol: IBGP Process ID: 0Preference: 255 Cost: 2NextHop: 3.3.3.3 Neighbour: 3.3.3.3State: Active Adv Relied Age: 01h24m15sTag: 0 Priority: lowLabel: 1028 QoSInfo: 0x0IndirectID: 0x4 RelayNextHop: 12.12.12.2 Interface: GigabitEthernet0/0/0TunnelID: 0x3 Flags: RD、
LSP Information: BGP LSP
LSP Information: LDP LSP
LSP Information: LDP LSP
FEC In/Out Label In/Out IF Vrf Name
2.2.2.2/32 3/NULL -/- 1.1.1.1/32 NULL/3 -/GE0/0/0 1.1.1.1/32 1024/3 -/GE0/0/0 3.3.3.3/32 NULL/3 -/GE0/0/1 3.3.3.3/32 1025/3 -/GE0/0/1 把公网标签1025换为3发现一个3这个特殊标签,在离开P1时发生第二跳标签弹出,把3的标签也弹出;在P1离开接口G0/0/1上抓包发现只留私网标签1028:⑥ 在ASBR1上BGP路由中发现标签为:
<ASBR1>dis bgp ***v4 ***-instance spi routing-table labelLSP Information: BGP LSP
LSP Information: LDP LSP
LSP Information: LDP LSP
FEC In/Out Label In/Out IF Vrf Name
4.4.4.4/32 NULL/3 -/GE0/0/1 4.4.4.4/32 1024/3 -/GE0/0/1 5.5.5.5/32 3/NULL -/- 6.6.6.6/32 NULL/3 -/GE0/0/0 6.6.6.6/32 1025/3 -/GE0/0/0 把公网标签1025换为3发现一个3这个特殊标签,在离开P2时发生第二跳标签弹出,把3的标签也弹出;在P2离开接口G0/0/1上抓包发现只留私网标签1026:BGP Local router ID is 6.6.6.6
Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal number of routes from all PE: 5
Route Distinguisher: 100:1
Network NextHop In/Out Label
>i 34.34.34.0 4.4.4.4 NULL/1027>i 192.168.1.0 4.4.4.4 NULL/1028
*> 192.168.2.0 192.168.2.254 1026/NULL通过1026的标签发现哪个×××实例(MP-BGP分发的是私网标签,用于在PE上指导私网数据从BGP ×××V4的标签表剥离标签后转移至对应的vrf);12、去往192.168.2.1报文进入spi VRF路由表:<PE2>dis ip routing-table ***-instance spi verboseDestination: 192.168.2.0/24
Protocol: Direct Process ID: 0Preference: 0 Cost: 0NextHop: 192.168.2.254 Neighbour: 0.0.0.0State: Active Adv Age: 05h28m11sTag: 0 Priority: highLabel: NULL QoSInfo: 0x0IndirectID: 0x0 RelayNextHop: 0.0.0.0 Interface: GigabitEthernet0/0/1TunnelID: 0x0 Flags: D13、通过路由表到PC3主机:Ping的截图:转载于:https://blog.51cto.com/baoer0717/2088581