Cisco提供一种方式强IGP路由优先于EBGP路由.这个概念也就是"后门链路"(backdoor link).EBGP路由可以标记为后门链路,它将设置这些路由的管理距离与BGP本地或200相同.因为这个管理距离要高于IGP,所以首选IGP路由.
 
以下是具体配置:
 
//// r1 ////
int lo0
  ip ad 1.1.1.1 255.255.255.0
 
int e1/0
  ip ad 192.1.1.1 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 a 0   //将所有接口宣告进OSPF
 
router bgp 200
  no syn  //关闭同步,同时也注定了全互连的拓扑
  neighbor 192.1.1.2 remote-as 200
  neighbor 192.1.1.2 update-source lo0  //以lo0接口IP作为更新源地址
 
 
//// r2 ////
int lo0
  ip ad 2.2.2.2 255.255.255.0
 
int e1/0
  ip ad 192.1.1.2 255.255.255.0
 
int e0/0
  ip ad 193.1.1.2 255.255.255.0
 
int e2/0
  ip ad 195.1.1.2 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 a 0  //宣告所有接口进OSPF
 
router bgp 200
  no syn
  neighbor 192.1.1.1 remote-as 200
  neighbor 192.1.1.1 update-source lo0
  neighbor 192.1.1.1 next-hop-self
  neighbor 195.1.1.5 remote-as 100
  network 192.1.1.0 mask 255.255.255.0
 
 
//// r3 ////
int lo0
  ip ad 3.3.3.3 255.255.255.0
 
int e0/0
  ip ad 193.1.1.3 255.255.255.0
 
int e1/0
  ip ad 194.1.1.3 255.255.255.0
 
int e3/0
  ip ad 196.1.1.3 255.255.255.0
 
router os 1
  netw 0.0.0.0 255.255.255.255 a 0
 
router bgp 300
  no syn
  neighbor 196.1.1.5 remote-as 100
  neighbor 194.1.1.4 remote-as 300
  neighbor 194.1.1.4 update-source lo0
  neighbor 194.1.1.4 next-hop-self
  network 194.1.1.0 mask 255.255.255.0
 
 
//// r4 ////
int lo0
  ip ad 4.4.4.4 255.255.255.0
 
int e0/0
  ip ad 194.1.1.3 255.255.255.0
router os 1
  network 0.0.0.0 255.255.255.255 a 0
 
router bgp 300
  no syn
  neighbor 194.1.1.3 remote-as 300
  neighbor 194.1.1.3 update-source lo0
  network 192.1.1.0 mask 255.255.255.0 backdoor
 
//// r5 ////
int lo0
  ip ad 5.5.5.5 255.255.255.0
int e2/0
  ip ad 195.1.1.5 255.255.255.0
int e3/0
  ip ad 196.1.1.5 255.255.255.0
router bgp 100
  no syn
  neighbor 195.1.1.2 remote-as 200
  neighbor 196.1.1.3 remote-as 300
 
验证:
//后门链路作用前
r2#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 192.1.1.0        0.0.0.0                  0         32768 i
*> 194.1.1.0        195.1.1.5                              0 100 300 i
r2#
r2#
r2#
r2#sh ip ro bgp
B    194.1.1.0/24 [20/0] via 195.1.1.5, 00:00:49
 
r3#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 192.1.1.0        196.1.1.5                              0 100 200 i
*> 194.1.1.0        0.0.0.0                  0         32768 i
r3#sh ip ro bgp
B    192.1.1.0/24 [20/0] via 196.1.1.5, 00:02:28
 
 
r3#sh ip ro             //后门链路作用前
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/21] via 193.1.1.2, 00:04:22, Ethernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 193.1.1.2, 00:04:22, Ethernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/11] via 194.1.1.4, 00:04:22, Ethernet1/0
C    196.1.1.0/24 is directly connected, Serial3/0
C    193.1.1.0/24 is directly connected, Ethernet0/0
B    192.1.1.0/24 [20/0] via 196.1.1.5, 00:00:06
O    195.1.1.0/24 [110/74] via 193.1.1.2, 00:04:22, Ethernet0/0
C    194.1.1.0/24 is directly connected, Ethernet1/0
 
 
 
//后门链路作用后
r3#sh ip ro
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/21] via 193.1.1.2, 00:06:38, Ethernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 193.1.1.2, 00:06:38, Ethernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/11] via 194.1.1.4, 00:06:38, Ethernet1/0
C    196.1.1.0/24 is directly connected, Serial3/0
C    193.1.1.0/24 is directly connected, Ethernet0/0
O    192.1.1.0/24 [110/20] via 193.1.1.2, 00:00:06, Ethernet0/0
O    195.1.1.0/24 [110/74] via 193.1.1.2, 00:06:38, Ethernet0/0
C    194.1.1.0/24 is directly connected, Ethernet1/0