迈普路由器配置BGP与BFD联动

1 网络需求

2 网络拓扑 
3 配置步骤

  1 网络需求

l  R1分别与R1、R1建立EBGP邻居,R1与R1建立IBGP邻居。

l  R1同时从R1和R1学习到EBGP路由3.0.0.0/24,R1优先选择通过R1转发数据至3.0.0.0/24网段。

l  在R1与R1上配置EBGP关联BFD,当R1与R1间的线路发生故障后BFD能迅速检测并通知BGP,此时R1选择通过R1转发数据至3.0.0.0/24网段。

2 网络拓扑:

配置BGP与BFD联动组网图

 

3 配置步骤

步骤1:
 配置各接口的IP地址。(略)
 
步骤2:
 配置OSPF,使设备间Loopback路由互相可达。
 

#配置R2。

R2#configure terminal 

R2(config)#router ospf 100

R2(config-ospf)#network 3.0.0.0 0.0.0.255 area 0

R2(config-ospf)#network 20.0.0.1 0.0.0.0 area 0

R2(config-ospf)#exit

#配置R3。

R3#configure terminal 

R3(config)#router ospf 100

R3(config-ospf)#network 3.0.0.0 0.0.0.255 area 0

R3(config-ospf)#network 30.0.0.1 0.0.0.0 area 0

R3(config-ospf)#exit

#查看R2的路由表。

R2#show ip route

Codes: C - Connected, L - Local, S - static, R - RIP,  B - BGP, i-ISIS

       U - Per-user Static route

       O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external 

O   30.0.0.1/32 [110/2] via 3.0.0.2, 00:02:26, G2/1

#查看R3的路由表。

R3#show ip route

Codes: C - Connected, L - Local, S - static, R - RIP,  B - BGP, i-ISIS

       U - Per-user Static route

       O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external 

O   20.0.0.1/32 [110/2] via 3.0.0.1, 00:03:38, G2/1

可以看出R2、R3互相学习到对方环回口的路由。

步骤3:
 配置访问控制列表和路由策略,设置路由metric。
 

#配置R1。

R1#configure terminal

R1(config)#ip access-list standard 1

R1(config-std-nacl)#permit 3.0.0.0 0.0.0.255

R1(config-std-nacl)#exit

R1(config)#route-map SetMetric

R1(config-route-map)#match ip address 1

R1(config-route-map)#set metric 50

R1(config-route-map)#exit

在R1上配置路由策略将路由3.0.0.0/24的metric设置为50。

步骤4:
 配置BGP,同时在R1关联路由策略。
 

#配置R1。

R1(config)#router bgp 100

R1(config-bgp)#neighbor 1.0.0.2 remote-as 200

R1(config-bgp)#neighbor 2.0.0.2 remote-as 200

R1(config-bgp)#neighbor 2.0.0.2 route-map SetMetric in 

R1(config-bgp)#exit

#配置R2。

R2(config)#router bgp 200

R2(config-bgp)#neighbor 1.0.0.1 remote-as 100

R2(config-bgp)#neighbor 30.0.0.1 remote-as 200

R2(config-bgp)#neighbor 30.0.0.1 update-source loopback0  

R2(config-bgp)#network 3.0.0.0 255.255.255.0

R2(config-bgp)#exit 

#配置R3。

R3(config)#router bgp 200

R3(config-bgp)#neighbor 2.0.0.1 remote-as 100

R3(config-bgp)#neighbor 20.0.0.1 remote-as 200

R3(config-bgp)#neighbor 20.0.0.1 update-source loopback0

R3(config-bgp)#network 3.0.0.0 255.255.255.0

R3(config-bgp)#exit 

在对等体上配置了路由策略后需要重置BGP进程才能生效。

#查看R1上BGP邻居状态。

R1#show ip bgp summary 

BGP router identifier 2.0.0.1, local AS number 100

BGP table version is 2

2 BGP AS-PATH entries

0 BGP community entries

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

1.0.0.2         4   200       2       2        2    0    0 00:01:32        1

2.0.0.2         4   200       2       2        2    0    0 00:01:43        1 

#查看R2上BGP邻居状态。

R2#show ip bgp summary 

BGP router identifier 20.0.0.1, local AS number 200

BGP table version is 2

1 BGP AS-PATH entries

0 BGP community entries

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

1.0.0.1         4   100       2       2        2    0    0 00:02:52        0

30.0.0.1        4   200       3       3        2    0    0 00:02:45        1 

可以看到R1、R2、R3间BGP邻居均成功建立。

#查看R1的路由表。

R1#show ip bgp 

BGP table version is 3, local router ID is 1.0.0.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

      Network             Next Hop            Metric LocPrf Weight Path

[B]*  3.0.0.0/24          2.0.0.2                 50             0 200 i

[B]*>                     1.0.0.2                  0             0 200 i

R1#show ip route 

Codes: C - Connected, L - Local, S - static, R - RIP,  B - BGP, i-ISIS

       U - Per-user Static route

       O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external 

B   3.0.0.0/24 [20/0] via 1.0.0.2, 00:07:19, G2/0

可以看到R1上路由3.0.0.0/24选择了R2为最优下一跳设备。

步骤5:
 配置BGP与BFD联动。
 

#配置R1。

R1(config)#router bgp 100

R1(config-bgp)#neighbor 1.0.0.2 fall-over bfd 

R1(config-bgp)#exit

R1(config)#interface G2/0

R1(config-if-G2/0)#bfd min-receive-interval 500

R1(config-if-G2/0)#bfd min-transmit-interval 500

R1(config-if-G2/0)#bfd multiplier 4

R1(config-if-G2/0)#exit

#配置R2。

R2(config)#router bgp 200

R2(config-bgp)#neighbor 1.0.0.1 fall-over bfd 

R2(config-bgp)#exit

R2(config)#interface G2/0

R2(config-if-G2/0)#bfd min-receive-interval 500

R2(config-if-G2/00)#bfd min-transmit-interval 500

R2(config-if-G2/0)#bfd multiplier 4

R2(config-if-G2/0)#exit

在EBGP邻居R1与R2间启用BFD,并修改BFD控制报文的最小发送时间间隔和最小接收时间间隔及检测超时倍数。

步骤6:
 检验结果。
 

#在R1上查看BFD会话状态。

R1#show bfd session 

OurAddr                  NeighAddr                LD/RD               State          Holddown       interface      

1.0.0.1                  1.0.0.2                   2/2                UP             2000           G2/0

可以看到R1上的BFD状态正确up,holddown时间协商为2000ms。

#当R1与R2间线路发生故障时,路由能够迅速切换至备份线路。

#查看R1的路由表。

R1#show ip bgp 

BGP table version is 6, local router ID is 1.0.0.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

      Network             Next Hop            Metric LocPrf Weight Path

[B]*> 3.0.0.0/24          2.0.0.2                 50             0 200 i

R1#show ip route

Codes: C - Connected, L - Local, S - static, R - RIP,  B - BGP, i-ISIS

       U - Per-user Static route

       O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external 

B   3.0.0.0/24 [20/50] via 2.0.0.2, 00:00:05, G2/1

可以看出路由3.0.0.0/24的下一跳切换至R3。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值