拓扑:
AS2基于172.16.0.0/16划分
AR1:
#
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 15.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
interface LoopBack1
ip address 11.1.1.1 255.255.255.0
#
bgp 1
peer 2.2.2.2 as-number 2
peer 2.2.2.2 ebgp-max-hop 2
peer 2.2.2.2 connect-interface LoopBack0
peer 5.5.5.5 as-number 2
peer 5.5.5.5 ebgp-max-hop 2
peer 5.5.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 11.1.1.0 255.255.255.0
peer 2.2.2.2 enable
peer 5.5.5.5 enable
#
route-policy huawei permit node 10
if-match ip-prefix 567
#
ip ip-prefix 567 index 10 permit 172.16.4.0 24
ip ip-prefix 567 index 20 permit 172.16.5.0 24
ip ip-prefix 567 index 30 permit 172.16.6.0 24
#
ip route-static 2.2.2.0 255.255.255.0 12.1.1.2
ip route-static 5.5.5.0 255.255.255.0 15.1.1.5
#
AR1上查看BGP路由:
Total Number of Routes: 7
Network NextHop MED LocPrf PrefVal Path/Ogn*> 11.1.1.0/24 0.0.0.0 0 0 i
*> 172.16.1.0/24 2.2.2.2 0 0 2i
* 5.5.5.5 0 2i
*> 172.16.4.0/24 2.2.2.2 0 2i
* 5.5.5.5 0 0 2i
*> 172.16.6.0/24 2.2.2.2 0 2i
* 5.5.5.5 0 2i
AR1邻居关系
TCPCB Tid/Soid Local Add:port Foreign Add:port VPNID State
b4cb1b28 6 /1 0.0.0.0:23 0.0.0.0:0 23553 Listening
b4cb22c0 164/1 0.0.0.0:179 2.2.2.2:0 0 Listening
b4cb2548 164/5 0.0.0.0:179 5.5.5.5:0 0 Listening
b4cb268c 164/11 1.1.1.1:179 2.2.2.2:50440 0 Established
b4cb27d0 164/13 1.1.1.1:179 5.5.5.5:51118 0 Established
此处访问567的路由都基于AR2
AR7
Total Number of Routes: 5
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 11.1.1.0/24 5.5.5.5 0 100 0 1i
* i 2.2.2.2 0 100 0 1i
*>i 172.16.1.0/24 2.2.2.2 0 100 0 i
*>i 172.16.4.0/24 5.5.5.5 0 100 0 i
*> 172.16.6.0/24 0.0.0.0 0 0 i
AR2配置:
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 172.16.7.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 172.16.9.2 255.255.255.0
mpls
mpls ldp
#
interface NULL0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
#
interface LoopBack1
ip address 172.16.1.1 255.255.255.0
ospf network-type broadcast
#
bgp 2
peer 1.1.1.1 as-number 1
peer 1.1.1.1 ebgp-max-hop 2
peer 1.1.1.1 connect-interface LoopBack0
peer 5.5.5.5 as-number 2
peer 5.5.5.5 connect-interface LoopBack0
peer 7.7.7.7 as-number 2
peer 7.7.7.7 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 172.16.1.0 255.255.255.0
peer 1.1.1.1 enable
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local
peer 7.7.7.7 enable
peer 7.7.7.7 next-hop-local
#
ospf 1
area 0.0.0.0
network 2.2.2.0 0.0.0.255
network 172.16.1.0 0.0.0.255
network 172.16.7.0 0.0.0.255
network 172.16.9.0 0.0.0.255
#
ip route-static 1.1.1.0 255.255.255.0 12.1.1.1
#
route recursive-lookup tunnel
AR2邻居关系
TCPCB Tid/Soid Local Add:port Foreign Add:port VPNID State
b4c9e250 6 /1 0.0.0.0:23 0.0.0.0:0 23553 Listening
b583bba4 164/12 0.0.0.0:179 1.1.1.1:0 0 Listening
b583b550 164/2 0.0.0.0:179 5.5.5.5:0 0 Listening
b583b7d8 164/7 0.0.0.0:179 7.7.7.7:0 0 Listening
b583b694 164/6 2.2.2.2:179 5.5.5.5:49628 0 Established
b583b91c 164/11 2.2.2.2:179 7.7.7.7:49371 0 Established
b4c9f180 167/4 2.2.2.2:646 3.3.3.3:49916 0 Established
b583adb8 167/7 2.2.2.2:646 5.5.5.5:50824 0 Established
b583bce8 164/15 2.2.2.2:50440 1.1.1.1:179 0 Established
测试: