案例2――关于如何防止绕行建立ebgp邻居
- 格式:doc
- 大小:113.00 KB
- 文档页数:9
关于如何防止绕行建立ebgp邻居 一、 概述................................................................................................................................... 1 (一)通常ebgp邻居建立的方式 ........................................................................................ 1 (二)ebgp-multihop为2时出现的ebgp邻居绕行问题 .................................................. 2 二、 如何避免绕行建立ebgp邻居的解决方案分析 ............................................................ 6 (一)ttl-security方案 ........................................................................................................... 6 (二)浮动静态路由方案 ....................................................................................................... 8
一、 概述 (一)通常ebgp邻居建立的方式 通常ebgp邻居建立的方式有两种,一种通过直连接口建立邻居,另一种是通过loopback接口建立邻居。 在eBGP的默认配置中由于协议报文的TTL值为1,路由器在向外转发报文时会将TTL减1,因此默认情况下必须使用互联接口来建立ebgp邻居。但在实际应用中,考虑到物理互联接口的不稳定性和不便于流量均衡,通常不使用物理接口来建立ebgp邻居。 实际应用中多采用的方式是通过loopback接口来建立ebgp邻居,该方式有如下优点: 1. 稳定性高,因为loopback接口是一个逻辑虚拟接口,因此不受物理层状态的影响,对bgp这样一个着重于稳定性的路由协议是很有好处的。 2. 有利于做流量的负载均衡。通过loopback地址建立ebgp邻居关系,当两台ebgp路由器间有多条链路互联的时候,流量可以通过互联链路IGP路由迭代,实现负载均衡。避免了bgp路由调整的复杂工作。 3. 在多链路互联的ebgp peer环境中,使用loopback接口建邻居,可以大大减少BGP通告的报文,减少CPU利用率 通过loopback接口建立ebgp邻居的配置,需要配置ebgp-multihop参数为2,即设置TTL值为2。参考配置如下。 router bgp 100 no synchronization bgp log-neighbor-changes neighbor 2.2.2.2 remote-as 200 neighbor 2.2.2.2 ebgp-multihop 2 neighbor 2.2.2.2 update-source Loopback0
(二)ebgp-multihop为2时出现的ebgp邻居绕行问题 然而ebgp-multihop的应用会在一些特殊的情况下存在问题。参考下图所示拓扑:
R2R3
R1AS100
AS100loopback0
loopback0loopback0
这是一个典型的城域网CR和骨干网路由器的ebgp连接拓扑示例。R1与R2、R3分别建立通过loopback接口建立ebgp邻居,ebgp-multihop设为2. 当R1到R2的链路中断时,R1仍可以通过R3学到R2 loopback0的ebgp路由,同样R2也可以通过R3学习到R1的loopback0的ebgp路由,也就是说R1的loopback0和R2的loopback0之间仍是路由可达的。 同时,由于设置的ebgp-multihop为2,当从R1发出的BGP报文经路径R1-R3-R2到达R2时,R2接受到的报文TTL值减为1,R2仍视该BGP报文是有效报文,因此R1与R2之间的ebgp邻居关系仍是可以建立的。 具体验证如下: R1配置: interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface FastEthernet0/0 description to R2-f0/0 ip address 10.1.1.2 255.255.255.252 shutdown duplex auto speed auto ! interface FastEthernet1/0 description to R3-f0/0 ip address 172.16.1.1 255.255.255.252 duplex auto speed auto ! ! router bgp 100 no synchronization bgp log-neighbor-changes network 1.1.1.1 mask 255.255.255.255 neighbor 2.2.2.2 remote-as 200 neighbor 2.2.2.2 ebgp-multihop 2 neighbor 2.2.2.2 update-source Loopback0 neighbor 3.3.3.3 remote-as 200 neighbor 3.3.3.3 ebgp-multihop 2 neighbor 3.3.3.3 update-source Loopback0 no auto-summary !
ip route 2.2.2.2 255.255.255.255 10.1.1.1 ip route 3.3.3.3 255.255.255.255 172.16.1.2 !
R2配置: interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface FastEthernet0/0 description to R1-f0/0 ip address 10.1.1.1 255.255.255.252 shutdown duplex auto speed auto ! interface FastEthernet1/0 description to R3-f1/0 ip address 192.168.1.1 255.255.255.252 duplex auto speed auto ! router ospf 100 log-adjacency-changes network 2.2.2.2 0.0.0.0 area 0 network 192.168.1.0 0.0.0.3 area 0 ! router bgp 200 no synchronization bgp log-neighbor-changes network 2.2.2.2 mask 255.255.255.255 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.1 ebgp-multihop 2 neighbor 1.1.1.1 update-source Loopback0 neighbor 3.3.3.3 remote-as 200 neighbor 3.3.3.3 update-source Loopback0 neighbor 3.3.3.3 next-hop-self no auto-summary ! ip route 1.1.1.1 255.255.255.255 10.1.1.2 ! R3配置: interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface FastEthernet0/0 description to R1-f1/0 ip address 172.16.1.2 255.255.255.252 duplex auto speed auto ! interface FastEthernet1/0 description to R2-f1/0 ip address 192.168.1.2 255.255.255.252 duplex auto speed auto ! router ospf 100 log-adjacency-changes network 3.3.3.3 0.0.0.0 area 0 network 192.168.1.0 0.0.0.3 area 0 ! router bgp 200 no synchronization bgp log-neighbor-changes network 3.3.3.3 mask 255.255.255.255 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.1 ebgp-multihop 2 neighbor 1.1.1.1 update-source Loopback0 neighbor 2.2.2.2 remote-as 200 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 next-hop-self no auto-summary ! ip route 1.1.1.1 255.255.255.255 172.16.1.1
当R1与R2连接的链路中断时,R1可以通过R3学习到R2 loopback接口的BGP路由,查看路由表如下: R1# sh ip route 2.2.2.2 Routing entry for 2.2.2.2/32 Known via "bgp 100", distance 20, metric 0