一个BGP的简单实验,AS内部用OSPF互通,然后建立IBGP邻居,两个AS相连。但是用来建立IBGP邻居关系用的环回口在BGP里面宣告之后邻居并不能学习到这条路由。
对于这个问题百度之后终于找到了问题原因以及解决方案:
各个设备的配置如下所示:
AR1:
#
sysname AR1
#
interface GigabitEthernet0/0/0
ip address 10.1.12.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
bgp 65001
router-id 1.1.1.1
group neib internal
peer neib connect-interface LoopBack0
peer 2.2.2.2 as-number 65001
peer 2.2.2.2 group neib
peer 3.3.3.3 as-number 65001
peer 3.3.3.3 group neib
#
ipv4-family unicast
undo synchronization
peer neib enable
peer 2.2.2.2 enable
peer 2.2.2.2 group neib
peer 3.3.3.3 enable
peer 3.3.3.3 group neib
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.12.1 0.0.0.0
#
return
AR2:
#
sysname AR2
#
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.23.2 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 65001
router-id 2.2.2.2
group neib internal
peer neib connect-interface LoopBack0
peer 1.1.1.1 as-number 65001
peer 1.1.1.1 group neib
peer 3.3.3.3 as-number 65001
peer 3.3.3.3 group neib
#
ipv4-family unicast
undo synchronization
peer neib enable
peer 1.1.1.1 enable
peer 1.1.1.1 group neib
peer 3.3.3.3 enable
peer 3.3.3.3 group neib
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.12.2 0.0.0.0
network 10.1.23.2 0.0.0.0
#
return
AR3:
#
sysname AR3
#
interface GigabitEthernet0/0/0
ip address 10.1.23.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.34.3 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
bgp 65001
router-id 3.3.3.3
peer 10.1.34.4 as-number 65002
group neib internal
peer neib connect-interface LoopBack0
peer 1.1.1.1 as-number 65001
peer 1.1.1.1 group neib
peer 2.2.2.2 as-number 65001
peer 2.2.2.2 group neib
#
ipv4-family unicast
undo synchronization
peer 10.1.34.4 enable
peer neib enable
peer neib next-hop-local
peer 1.1.1.1 enable
peer 1.1.1.1 group neib
peer 2.2.2.2 enable
peer 2.2.2.2 group neib
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.23.3 0.0.0.0
#
return
AR4:
#
sysname AR4
#
interface GigabitEthernet0/0/0
ip address 10.1.34.4 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
bgp 65002
router-id 4.4.4.4
peer 10.1.34.3 as-number 65001
#
ipv4-family unicast
undo synchronization
peer 10.1.34.3 enable
#
return
接下来在AR1上宣告环回口:
[AR1-bgp]net 1.1.1.1 32
[AR1-bgp]dis bgp rou
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 0 0 i
<AR2>dis bgp rou
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
i 1.1.1.1/32 1.1.1.1 0 100 0 i
这时候我们会发现在AR2上的1.1.1.1路由是无效路由,所以无法传到其他的邻居上,并且也无法加入到ip路由表中。
\color{red}{R2上查看路由1.1.1.1不是有效路由,原因是华为认为目的地址和下一跳地址相同的路由,就是非法路由,不可能优选一条非法路由为best,当然不可能将其发布给bgp邻居。}
(原因是华为实现机制与思科的实现机制不一样。)
解决方案:
方法一:在R2上把在BGP进程下把该路由重新network到bgp。
方法二:在V6R8版本中可以在BGP中配置如下命令配置超网路由,R2配置如下: supernet unicast advertise enable——向BGP对等体发布BGP超网单播路由
这两个方法中方法一实验成功了,方法二没太明白是什么意思。
[AR2-bgp]net 1.1.1.1 32
[AR2-bgp]dis bgp rou
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 1 0 i
i 1.1.1.1 0 100 0 i
<AR4>dis bgp rou
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 10.1.34.3 0 65001i
可以看到在邻居上宣告一次1.1.1.1网段之后,就能让这条无效路由的下一跳改变,从而导致这条路由变成有效路由,就可以传出去让其他邻居学习到了。
参考文献: