« Back
in BGP 路由 思科 read.

BGP keepalive + holdtime 实验

实验拓扑:

R1-R2

实验基本配置:
R1
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface Serial1/1
 ip address 10.1.12.1 255.255.255.0
 no sh
!
router ospf 1
 router-id 1.1.1.1
network 1.1.1.1 0.0.0.0 area 0
 network 10.1.12.0 0.0.0.255 area 0
!
router bgp 1
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 neighbor 10.1.12.2 remote-as 1
 no auto-summary
!
 
R2
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface Serial1/0
 ip address 10.1.12.2 255.255.255.0
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 10.1.12.0 0.0.0.255 area 0
!
router bgp 1
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 10.1.12.1 remote-as 1
 no auto-summary
!
 
实验现象:
R1#sh ip bgp nei 10.1.12.2
BGP neighbor is 10.1.12.2,  remote AS 1, internal link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:00:32
  Last read 00:00:31, hold time is 180, keepalive interval is 60 seconds
 
R2#sh ip bgp nei 10.1.12.1
BGP neighbor is 10.1.12.1,  remote AS 1, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:00:54
  Last read 00:00:54, hold time is 180, keepalive interval is 60 seconds
 
 
通过命令 neighbor xx.xx.xx.xx timer Keepalive interval Holdtime 更改,需clear ip bgp * 邻居生效.
 
 
1.  R1 改为 20 60  R2 为默认 60 180.
R1#sh ip bgp nei 10.1.12.2
BGP neighbor is 10.1.12.2,  remote AS 1, internal link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:00:02
  Last read 00:00:02, hold time is 60, keepalive interval is 20 seconds
  Configured hold time is 60, keepalive interval is 20 seconds
 
R2#sh ip bgp nei 10.1.12.1
BGP neighbor is 10.1.12.1,  remote AS 1, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:00:25
  Last read 00:00:05, hold time is 60, keepalive interval is 20 seconds
 
R1R2建立邻居时keepalive holdtime 协商都为 20 60.
 
2R1 改为 10 60  R2为默认 60 180.
R1#sh ip bgp nei 10.1.12.2
BGP neighbor is 10.1.12.2,  remote AS 1, internal link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:00:15
  Last read 00:00:14, hold time is 60, keepalive interval is 10 seconds
  Configured hold time is 60, keepalive interval is 10 seconds
 
R2#sh ip bgp nei 10.1.12.1
BGP neighbor is 10.1.12.1,  remote AS 1, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:00:28
  Last read 00:00:07, hold time is 60, keepalive interval is 20 seconds
 
R1R2建立邻居时keepalive holdtime 协商 R1 10 60R2  20 60.
 
3\. R1 改为 20 40 ,  R2 为默认 60 180.
R1#sh ip bgp nei 10.1.12.2
BGP neighbor is 10.1.12.2,  remote AS 1, internal link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:00:04
  Last read 00:00:04, hold time is 40, keepalive interval is 13 seconds
  Configured hold time is 40, keepalive interval is 20 seconds
 
R2#sh ip bgp nei 10.1.12.1
BGP neighbor is 10.1.12.1,  remote AS 1, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:00:13
  Last read 00:00:00, hold time is 40, keepalive interval is 13 seconds
 
R1R2建立邻居时keepalive holdtime 协商都为13 40.
 
4\. R1 改为 20 40 ,  R2 改为 10 50 .
R1#sh ip bgp nei 10.1.12.2
BGP neighbor is 10.1.12.2,  remote AS 1, internal link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:00:48
  Last read 00:00:08, hold time is 40, keepalive interval is 13 seconds
  Configured hold time is 40, keepalive interval is 20 seconds
 
R2#sh ip bgp nei 10.1.12.1
BGP neighbor is 10.1.12.1,  remote AS 1, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:00:47
  Last read 00:00:06, hold time is 40, keepalive interval is 10 seconds
 
R1R2建立邻居时keepalive holdtime 协商 R1 13 40R2  10 40.
 
实验结论:
结论: 双方先协商出最小的holdtime , 然后比较各自的keepalive ,如果配置的keepalive值小于或等于 holdtime/3的值,那么最终keepalive为配置的keepalive值;如果配置的keepalive值大于 holdtime/3的值,那么最终keepaliveholdtime/3的值。
Holdtime最小一致,keepaliveholdtime/3比小,可不一致