DynagenでCCIEを目指す
20100621 BGP タイマーの調節
最終更新:
it_certification
-
view
目的
- BGPのパフォーマンスチューニングを行います。
構成
- 設定概要
- 初期設定はip addressのみです
- 構成図

- netファイル
model = 3620 [localhost] [[3620]] image = C:\Program Files\Dynamips\images\c3620-j1s3-mz.123-18.bin ram = 128 [[ROUTER R1]] f0/0 = R2 f0/0 [[ROUTER R2]] f1/0 = R3 f1/0 [[ROUTER R3]]
- 初期設定 R1
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.12.1 255.255.255.0 duplex auto speed auto ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- 初期設定 R2
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.12.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/0 ip address 192.168.23.2 255.255.255.0 duplex auto speed auto ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- 初期設定 R3
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface FastEthernet1/0 ip address 192.168.23.3 255.255.255.0 duplex auto speed auto ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
検証1 検証環境構築
- BGPの設定
BGP neighborの設定を投入します。R1, R2間はiBGP neighborとし、R2, R3間はeBGP neighborとします。
R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 remote-as 1 R1(config-router)#network 1.1.1.1 mask 255.255.255.255 R2(config)#router bgp 1 R2(config-router)#neighbor 192.168.12.1 remote-as 1 R2(config-router)#neighbor 192.168.12.1 next-hop-self R2(config-router)#neighbor 192.168.23.3 remote-as 3 R2(config-router)#network 2.2.2.2 mask 255.255.255.255 R3(config)#router bgp 3 R3(config-router)#neighbor 192.168.23.2 remote-as 1 R3(config-router)#network 3.3.3.3 mask 255.255.255.255
- BGP neighborの確認
BGP neighborが確立された事を確認します。
R2#show ip bgp summary BGP router identifier 2.2.2.2, local AS number 1 BGP table version is 4, main routing table version 4 3 network entries using 303 bytes of memory 3 path entries using 144 bytes of memory 3 BGP path attribute entries using 180 bytes of memory 1 BGP AS-PATH entries using 24 bytes of memory 0 BGP route-map cache entries using 0 bytes of memory 0 BGP filter-list cache entries using 0 bytes of memory BGP using 651 total bytes of memory BGP activity 3/0 prefixes, 3/0 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.168.12.1 4 1 6 7 4 0 0 00:02:00 1 192.168.23.3 4 3 6 7 4 0 0 00:01:01 1 R2#
検証2 timers bgpによる設定
- デフォルト設定の確認
デフォルトの状態でのBGP hello time, hold timeを確認します。iBGP neighborもeBGP neighborも同様に、helloが60秒, holdが180秒になっています。
R2#show ip bgp neighbors 192.168.12.1 BGP neighbor is 192.168.12.1, remote AS 1, internal link BGP version 4, remote router ID 1.1.1.1 BGP state = Established, up for 00:03:16 Last read 00:00:16, hold time is 180, keepalive interval is 60 seconds <- hello, holdを確認 Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received - 略 - R2#show ip bgp neighbors 192.168.23.3 BGP neighbor is 192.168.23.3, remote AS 3, external link BGP version 4, remote router ID 3.3.3.3 BGP state = Established, up for 00:02:49 Last read 00:00:49, hold time is 180, keepalive interval is 60 seconds <- hello, holdを確認 Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received
- timer bgpによる設定
timer bgpコマンドでhello, holdを調整します。しかし、このコマンドを投入しただけでは、設定が反映されない事が確認できます。
R1(config)#router bgp 1 R1(config-router)#timers bgp 45 135 R2(config)#router bgp 1 R2(config-router)#timers bgp 50 150 R2#show ip bgp neighbors 192.168.12.1 BGP neighbor is 192.168.12.1, remote AS 1, internal link BGP version 4, remote router ID 1.1.1.1 BGP state = Established, up for 00:09:15 Last read 00:00:14, hold time is 180, keepalive interval is 60 seconds <- 設定投入だけでは反映されません Configured hold time is 150, keepalive interval is 50 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received
- neighborの再確立
R1, R2間のneihgborを再確立させます。neighbor確立時にhello, holdの値がネゴシエーションされ、hello, holdの値が反映されます。なお、hello, holdがneihgbor間で異なる場合は、小さい方の値が採用されます。
R1#clear ip bgp 192.168.12.2 R1# *Mar 1 00:18:38.871: %BGP-5-ADJCHANGE: neighbor 192.168.12.2 Down User reset *Mar 1 00:18:45.959: %BGP-5-ADJCHANGE: neighbor 192.168.12.2 Up R1# R1#show ip bgp neighbors 192.168.12.2 BGP neighbor is 192.168.12.2, remote AS 1, internal link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:00:27 Last read 00:00:27, hold time is 135, keepalive interval is 45 seconds <- hello, holdの値が反映された事が分かります Configured hold time is 135, keepalive interval is 45 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received
- パケットキャプチャによる確認
neighbor確立時のパケットを採取すると、確かに、hello, holdの値をネゴシエーションしている様子が読み取れます。

検証3 neighbor timersによる設定
- neighbor timersによる設定
neighbor timersコマンドを用いると、neihgbor毎にhello, holdを設定する事ができます。なお、この設定は検証2のbgp timersよりも優先されます。
R2(config)#router bgp 1 R2(config-router)#neighbor 192.168.23.3 timers 30 90 R3(config)#router bgp 3 R3(config-router)#neighbor 192.168.23.2 timers 40 120 R2#clear ip bgp 192.168.23.3 R2# *Mar 1 00:23:41.039: %BGP-5-ADJCHANGE: neighbor 192.168.23.3 Down User reset *Mar 1 00:23:57.731: %BGP-5-ADJCHANGE: neighbor 192.168.23.3 Up R2# R2#show ip bgp neighbors 192.168.23.3 BGP neighbor is 192.168.23.3, remote AS 3, external link BGP version 4, remote router ID 3.3.3.3 BGP state = Established, up for 00:00:06 Last read 00:00:06, hold time is 90, keepalive interval is 30 seconds Configured hold time is 90, keepalive interval is 30 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received
検証4 最小送信間隔の確認
- デフォルト設定の確認
BGPでは、フラッピングの影響を緩和するために、最小送信間隔を定義しています。最小送信間隔はshow ip bgp neighborコマンドで確認可能であり、デフォルト設定の場合のiBGPは5秒、eBGPは30秒になっています。具体的には、iBGP neighborでは、BGP updateを送信した後は、少なくても5秒間はBGP updateを送信しなくなるという意味です。
R2#show ip bgp neighbors 192.168.12.1 BGP neighbor is 192.168.12.1, remote AS 1, internal link BGP version 4, remote router ID 192.168.12.1 BGP state = Established, up for 00:07:41 Last read 00:00:16, hold time is 135, keepalive interval is 45 seconds Configured hold time is 150, keepalive interval is 50 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received Message statistics: InQ depth is 0 OutQ depth is 0 Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 2 3 Keepalives: 13 13 Route Refresh: 0 0 Total: 16 17 Default minimum time between advertisement runs is 5 seconds <- 最小送信間隔は5秒 For address family: IPv4 Unicast BGP table version 6, neighbor version 6 Index 1, Offset 0, Mask 0x2 R2# R2# R2#show ip bgp neighbors 192.168.23.3 BGP neighbor is 192.168.23.3, remote AS 3, external link BGP version 4, remote router ID 3.3.3.3 BGP state = Established, up for 00:07:34 Last read 00:00:04, hold time is 90, keepalive interval is 30 seconds <- 最小送信間隔は30秒 Configured hold time is 90, keepalive interval is 30 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received Message statistics: InQ depth is 0 OutQ depth is 0 Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 4 1 Keepalives: 18 18 Route Refresh: 0 0 Total: 23 20 Default minimum time between advertisement runs is 30 seconds For address family: IPv4 Unicast BGP table version 6, neighbor version 6 Index 2, Offset 0, Mask 0x4 R2#
- デバッグの有効化
R1, R2でdebug ip bgp updatesを有効にします。
R1#debug ip bgp updates BGP updates debugging is on R1# R2#debug ip bgp updates BGP updates debugging is on R2#
- BGP updatesの確認
R1 Lo0で素早くshut, no shutコマンドを投入します。すると、1.1.1.1への経路がなくなった旨のupdateは00:11:15に送信されているのに対し、1.1.1.1への経路が復活した旨のupdateは5秒後の00:11:20に送信されています。
R1(config)#interface Loopback 0 R1(config-if)#shutdown R1(config-if)#no shut R1(config-if)# *Mar 1 00:11:15.455: BGP(0): route 1.1.1.1/32 down *Mar 1 00:11:15.455: BGP(0): no valid path for 1.1.1.1/32 *Mar 1 00:11:15.459: BGP(0): nettable_walker 1.1.1.1/32 no best path *Mar 1 00:11:15.463: BGP(0): 192.168.12.2 computing updates, afi 0, neighbor version 8, table version 9, starting at 0.0.0.0 *Mar 1 00:11:15.463: BGP(0): 192.168.12.2 send unreachable 1.1.1.1/32 *Mar 1 00:11:15.467: BGP(0): 192.168.12.2 send UPDATE 1.1.1.1/32 -- unreachable *Mar 1 00:11:15.467: BGP(0): 192.168.12.2 1 updates enqueued (average=28, maximum=28) *Mar 1 00:11:15.471: BGP(0): 192.168.12.2 update run completed, afi 0, ran for 8ms, neighbor version 8, start version 9, throttled to 9 *Mar 1 00:11:16.331: BGP(0): route 1.1.1.1/32 up *Mar 1 00:11:16.335: BGP(0): nettable_walker 1.1.1.1/32 route sourced locally *Mar 1 00:11:20.775: BGP(0): 192.168.12.2 computing updates, afi 0, neighbor version 9, table version 10, starting at 0.0.0.0 *Mar 1 00:11:20.779: BGP(0): 192.168.12.2 send UPDATE (format) 1.1.1.1/32, next 192.168.12.1, metric 0, path *Mar 1 00:11:20.783: BGP(0): 192.168.12.2 1 updates enqueued (average=56, maximum=56) *Mar 1 00:11:20.783: BGP(0): 192.168.12.2 update run completed, afi 0, ran for 8ms, neighbor version 9, start version 10, throttled to 10 R1(config-if)#
また、R2のデバッグメッセージを確認すると、最小送信間隔が30秒である事が読み取れます。1.1.1.1への経路がなくなった旨のupdateは00:03:45に送信されているのに対し、1.1.1.1への経路が復活した旨のupdateは30秒後の00:04:15に送信されています。
R2# *Mar 1 00:03:45.855: BGP(0): 192.168.12.1 rcv UPDATE about 1.1.1.1/32 -- withdrawn *Mar 1 00:03:45.859: BGP(0): no valid path for 1.1.1.1/32 *Mar 1 00:03:45.863: BGP(0): nettable_walker 1.1.1.1/32 no best path *Mar 1 00:03:45.863: BGP(0): 192.168.12.1 computing updates, afi 0, neighbor version 4, table version 5, starting at 0.0.0.0 *Mar 1 00:03:45.867: BGP(0): 192.168.12.1 update run completed, afi 0, ran for 0ms, neighbor version 4, start version 5, throttled to 5 *Mar 1 00:03:45.971: BGP(0): 192.168.23.3 computing updates, afi 0, neighbor version 4, table version 5, starting at 0.0.0.0 *Mar 1 00:03:45.975: BGP(0): 192.168.23.3 send unreachable 1.1.1.1/32 *Mar 1 00:03:45.975: BGP(0): 192.168.23.3 send UPDATE 1.1.1.1/32 -- unreachable *Mar 1 00:03:45.975: BGP(0): 192.168.23.3 1 updates enqueued (average=28, maximum=28) *Mar 1 00:03:45.979: BGP(0): 192.168.23.3 update run completed, afi 0, ran for 8ms, neighbor version 4, start version 5, throttled to 5 *Mar 1 00:03:54.955: BGP(0): 192.168.12.1 rcvd UPDATE w/ attr: nexthop 192.168.12.1, origin i, localpref 100, metric 0 *Mar 1 00:03:54.959: BGP(0): 192.168.12.1 rcvd 1.1.1.1/32 *Mar 1 00:03:54.959: BGP(0): Revise route installing 1 of 1 route for 1.1.1.1/32 -> 192.168.12.1 to main IP table *Mar 1 00:03:55.063: BGP(0): 192.168.12.1 computing updates, afi 0, neighbor version 5, table version 6, starting at 0.0.0.0 *Mar 1 00:03:55.067: BGP(0): 192.168.12.1 update run completed, afi 0, ran for 4ms, neighbor version 5, start version 6, throttled to 6 *Mar 1 00:04:15.115: BGP(0): 192.168.23.3 computing updates, afi 0, neighbor version 5, table version 6, starting at 0.0.0.0 *Mar 1 00:04:15.119: BGP(0): 192.168.23.3 send UPDATE (format) 1.1.1.1/32, next 192.168.23.2, metric 0, path *Mar 1 00:04:15.123: BGP(0): 192.168.23.3 1 updates enqueued (average=46, maximum=46) *Mar 1 00:04:15.123: BGP(0): 192.168.23.3 update run completed, afi 0, ran for 8ms, neighbor version 5, start version 6, throttled to 6 R2#
検証5 最小送信間隔の設定
- デバッグの有効化
検証4に引き続き、R1, R2でのdebug ip bgp updatesは有効なままにしておきます。
R1#debug ip bgp updates BGP updates debugging is on R1# R2#debug ip bgp updates BGP updates debugging is on R2#
- 最小送信間隔の設定
neihgbor advertisement-intervalコマンドを用いて、最小送信間隔を設定します。
R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 advertisement-interval 15 R1(config-router)#^Z R1# *Mar 1 00:05:07.027: %SYS-5-CONFIG_I: Configured from console by console R1# R1# R1#show ip bgp neighbors 192.168.12.2 BGP neighbor is 192.168.12.2, remote AS 1, internal link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:00:20 Last read 00:00:20, hold time is 135, keepalive interval is 45 seconds Configured hold time is 135, keepalive interval is 45 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received Message statistics: InQ depth is 0 OutQ depth is 0 Sent Rcvd Opens: 2 2 Notifications: 0 0 Updates: 2 4 Keepalives: 13 13 Route Refresh: 0 0 Total: 17 19 Default minimum time between advertisement runs is 5 seconds <- デフォルトの最小送信間隔 For address family: IPv4 Unicast BGP table version 8, neighbor version 8 Index 1, Offset 0, Mask 0x2 Sent Rcvd Prefix activity: ---- ---- Prefixes Current: 1 2 (Consumes 96 bytes) Prefixes Total: 1 2 Implicit Withdraw: 0 0 Explicit Withdraw: 0 0 Used as bestpath: n/a 2 Used as multipath: n/a 0 Outbound Inbound Local Policy Denied Prefixes: -------- ------- Bestpath from this peer: 2 n/a Total: 2 0 Number of NLRIs in the update sent: max 1, min 0 Minimum time between advertisement runs is 15 seconds <- 現在設定されている最小送信間隔 R2(config)#router bgp 1 R2(config-router)#neighbor 192.168.23.3 advertisement-interval 40 R2(config-router)#^Z R2# *Mar 1 00:05:12.747: %SYS-5-CONFIG_I: Configured from console by console R2# R2# R2#show ip bgp neighbors 192.168.23.3 BGP neighbor is 192.168.23.3, remote AS 3, external link BGP version 4, remote router ID 3.3.3.3 BGP state = Established, up for 00:07:28 Last read 00:00:27, hold time is 90, keepalive interval is 30 seconds Configured hold time is 90, keepalive interval is 30 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received Message statistics: InQ depth is 0 OutQ depth is 0 Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 4 1 Keepalives: 17 17 Route Refresh: 0 0 Total: 22 19 Default minimum time between advertisement runs is 30 seconds <- デフォルトの最小送信間隔 For address family: IPv4 Unicast BGP table version 6, neighbor version 6 Index 2, Offset 0, Mask 0x4 Sent Rcvd Prefix activity: ---- ---- Prefixes Current: 2 1 (Consumes 48 bytes) Prefixes Total: 3 1 Implicit Withdraw: 0 0 Explicit Withdraw: 1 0 Used as bestpath: n/a 1 Used as multipath: n/a 0 Outbound Inbound Local Policy Denied Prefixes: -------- ------- Bestpath from this peer: 1 n/a Total: 1 0 Number of NLRIs in the update sent: max 1, min 0 Minimum time between advertisement runs is 40 seconds <- 現在設定されている最小送信間隔
- BGP updatesの確認
R1 Lo0で素早くshut, no shutコマンドを投入します。検証4の時に比べて、最小送信間隔が長くなっている事が分かります。
R1(config)#interface Loopback 0 R1(config-if)#shutdown R1(config-if)#no shutdown R1(config-if)# R1(config-if)# *Mar 1 00:12:30.011: BGP(0): route 1.1.1.1/32 down *Mar 1 00:12:30.011: BGP(0): no valid path for 1.1.1.1/32 *Mar 1 00:12:30.015: BGP(0): nettable_walker 1.1.1.1/32 no best path *Mar 1 00:12:30.019: BGP(0): 192.168.12.2 computing updates, afi 0, neighbor version 8, table version 9, starting at 0.0.0.0 *Mar 1 00:12:30.019: BGP(0): 192.168.12.2 send unreachable 1.1.1.1/32 *Mar 1 00:12:30.023: BGP(0): 192.168.12.2 send UPDATE 1.1.1.1/32 -- unreachable *Mar 1 00:12:30.023: BGP(0): 192.168.12.2 1 updates enqueued (average=28, maximum=28) *Mar 1 00:12:30.027: BGP(0): 192.168.12.2 update run completed, afi 0, ran for 8ms, neighbor version 8, start version 9, throttled to 9 *Mar 1 00:12:30.231: BGP(0): route 1.1.1.1/32 up *Mar 1 00:12:30.235: BGP(0): nettable_walker 1.1.1.1/32 route sourced locally *Mar 1 00:12:42.611: BGP(0): 192.168.12.2 computing updates, afi 0, neighbor version 9, table version 10, starting at 0.0.0.0 *Mar 1 00:12:42.615: BGP(0): 192.168.12.2 send UPDATE (format) 1.1.1.1/32, next 192.168.12.1, metric 0, path *Mar 1 00:12:42.619: BGP(0): 192.168.12.2 1 updates enqueued (average=56, maximum=56) *Mar 1 00:12:42.619: BGP(0): 192.168.12.2 update run completed, afi 0, ran for 8ms, neighbor version 9, start version 10, throttled to 10 *Mar 1 00:13:00.507: BGP(0): route 1.1.1.1/32 up R1(config-if)# R2# *Mar 1 00:12:13.563: BGP(0): 192.168.12.1 rcv UPDATE about 1.1.1.1/32 -- withdrawn *Mar 1 00:12:13.563: BGP(0): no valid path for 1.1.1.1/32 *Mar 1 00:12:13.567: BGP(0): nettable_walker 1.1.1.1/32 no best path *Mar 1 00:12:13.571: BGP(0): 192.168.12.1 computing updates, afi 0, neighbor version 6, table version 7, starting at 0.0.0.0 *Mar 1 00:12:13.575: BGP(0): 192.168.12.1 update run completed, afi 0, ran for 4ms, neighbor version 6, start version 7, throttled to 7 *Mar 1 00:12:13.575: BGP(0): 192.168.23.3 computing updates, afi 0, neighbor version 6, table version 7, starting at 0.0.0.0 *Mar 1 00:12:13.579: BGP(0): 192.168.23.3 send unreachable 1.1.1.1/32 *Mar 1 00:12:13.583: BGP(0): 192.168.23.3 send UPDATE 1.1.1.1/32 -- unreachable *Mar 1 00:12:13.583: BGP(0): 192.168.23.3 1 updates enqueued (average=28, maximum=28) *Mar 1 00:12:13.583: BGP(0): 192.168.23.3 update run completed, afi 0, ran for 4ms, neighbor version 6, start version 7, throttled to 7 *Mar 1 00:12:26.035: BGP(0): 192.168.12.1 rcvd UPDATE w/ attr: nexthop 192.168.12.1, origin i, localpref 100, metric 0 *Mar 1 00:12:26.035: BGP(0): 192.168.12.1 rcvd 1.1.1.1/32 *Mar 1 00:12:26.039: BGP(0): Revise route installing 1 of 1 route for 1.1.1.1/32 -> 192.168.12.1 to main IP table *Mar 1 00:12:26.143: BGP(0): 192.168.12.1 computing updates, afi 0, neighbor version 7, table version 8, starting at 0.0.0.0 *Mar 1 00:12:26.147: BGP(0): 192.168.12.1 update run completed, afi 0, ran for 4ms, neighbor version 7, start version 8, throttled to 8 *Mar 1 00:12:49.247: BGP(0): 192.168.23.3 computing updates, afi 0, neighbor version 7, table version 8, starting at 0.0.0.0 *Mar 1 00:12:49.251: BGP(0): 192.168.23.3 send UPDATE (format) 1.1.1.1/32, next 192.168.23.2, metric 0, path *Mar 1 00:12:49.255: BGP(0): 192.168.23.3 1 updates enqueued (average=46, maximum=46) *Mar 1 00:12:49.255: BGP(0): 192.168.23.3 update run completed, afi 0, ran for 8ms, neighbor version 7, start version 8, throttled to 8 R2#
検証6 bgp fast-external-fallover
- デバッグの有効化
R3でdebug ip bgp eventsを有効にします。
R3#debug ip bgp events BGP events debugging is on R3#
- デフォルトの挙動確認
bgp fast-external-fallover機能を使用すると、eBGP neighborで使用しているI/Fがダウンした場合、すぐにneighborも切断します。
まずは、fast-external-falloverが機能していないデフォルトの挙動を確認します。R3 f1/0をshutdownすると、00:33:08にshutdown したにも関わらず、NOTIFICATIONが送信されたのは00:34:20になっています。NOTIFICATIONが送信されるまでに1分以上もかかっています。
まずは、fast-external-falloverが機能していないデフォルトの挙動を確認します。R3 f1/0をshutdownすると、00:33:08にshutdown したにも関わらず、NOTIFICATIONが送信されたのは00:34:20になっています。NOTIFICATIONが送信されるまでに1分以上もかかっています。
R3(config)#interface FastEthernet 1/0 R3(config-if)#shutdown R3(config-if)# *Mar 1 00:33:08.199: %LINK-5-CHANGED: Interface FastEthernet1/0, changed state to administratively down *Mar 1 00:33:09.199: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to down *Mar 1 00:33:16.055: BGP: Import timer expired. Walking from 1 to 1 *Mar 1 00:33:31.055: BGP: Import timer expired. Walking from 1 to 1 *Mar 1 00:33:46.055: BGP: Import timer expired. Walking from 1 to 1 *Mar 1 00:34:01.055: BGP: Performing BGP general scanning *Mar 1 00:34:01.055: BGP(0): scanning IPv4 Unicast routing tables *Mar 1 00:34:01.071: BGP(IPv4 Unicast): Performing BGP Nexthop scanning for general scan *Mar 1 00:34:01.071: BGP(0): Future scanner version: 35, current scanner version: 34 *Mar 1 00:34:01.071: BGP(1): scanning IPv6 Unicast routing tables *Mar 1 00:34:01.071: BGP(IPv6 Unicast): Performing BGP Nexthop scanning for general scan *Mar 1 00:34:01.071: BGP(1): Future scanner version: 35, current scanner version: 34 *Mar 1 00:34:01.071: BGP(2): scanning VPNv4 Unicast routing tables *Mar 1 00:34:01.071: BGP(VPNv4 Unicast): Performing BGP Nexthop scanning for general scan *Mar 1 00:34:01.071: BGP(2): Future scanner version: 35, current scanner version: 34 *Mar 1 00:34:01.071: BGP(3): scanning IPv4 Multicast routing tables *Mar 1 00:34:01.087: BGP(IPv4 Multicast): Performing BGP Nexthop scanning for general scan *Mar 1 00:34:01.087: BGP(3): Future scanner version: 35, current scanner version: 34 *Mar 1 00:34:16.087: BGP: Import timer expired. Walking from 1 to 1 *Mar 1 00:34:20.411: BGP: 192.168.23.2 reset due to BGP Notification sent *Mar 1 00:34:20.411: %BGP-5-ADJCHANGE: neighbor 192.168.23.2 Down BGP Notification sent <- BGP neighbor切断 *Mar 1 00:34:20.415: %BGP-3-NOTIFICATION: sent to neighbor 192.168.23.2 4/0 (hold time expired) 0 bytes <- NOTIFICATIONメッセージでneighbor断を伝えています R3(config-if)#no shutdown
- bgp fast-external-falloverの設定
bgp fast-external-falloverを設定します。R3 f1/0をshutdownすると、すぐにneighborも切断されている事が分かります。
R3(config)#router bgp 3 R3(config-router)#bgp fast-external-fallover R3(config-router)#exit R3(config)# R3(config)# R3(config)#interface FastEthernet 1/0 R3(config-if)#shutdown R3(config-if)# *Mar 1 00:32:12.519: BGP: service reset requests *Mar 1 00:32:12.519: BGP: service reset requests *Mar 1 00:32:12.519: BGP: service reset requests *Mar 1 00:32:12.523: BGP: service reset requests *Mar 1 00:32:12.523: BGP: 192.168.23.2 reset due to Interface flap *Mar 1 00:32:12.523: %BGP-5-ADJCHANGE: neighbor 192.168.23.2 Down Interface flap <- BGP neighbor切断 *Mar 1 00:32:14.503: %LINK-5-CHANGED: Interface FastEthernet1/0, changed state to administratively down *Mar 1 00:32:15.503: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to down *Mar 1 00:32:15.991: BGP: Import timer expired. Walking from 1 to 1 R3(config-if)#no shutdown
検証7 bgp dampening
- ネットワークのエミュレート
R3に172.16.0.0/24のネットワークが接続されているかのような設定を投入します。
R3(config)#interface Loopback 0 R3(config-if)#ip address 172.16.0.3 255.255.255.0 secondary R3(config-if)#exit R3(config)# R3(config)# R3(config)#router bgp 3 R3(config-router)#network 172.16.0.0 mask 255.255.255.0
- bgp dampeningの設定
bgp dampeningとは、フラッピングの影響を緩和するための機能です。フラップした経路に対し、penalty値を定義します。penaltyはフラップを繰り返す程大きくなり、時間の経過とともに減少します。penalty値が一定を超えた経路を敢えて使用しなくする事で、不ラッピングの影響を緩和します。
bgp dampeningの設定は以下の通りです。なお、dampeningで使用するパラメタの説明は省略します。
bgp dampeningの設定は以下の通りです。なお、dampeningで使用するパラメタの説明は省略します。
R2(config)#router bgp 1 R2(config-router)#bgp dampening 5 600 1500 20
- history
以下の要領で、R3 Lo0をフラッピングさせます。
R3(config)#interface Loopback 0 R3(config-if)#shutdown R3(config-if)#no shutdown
R2のBGPテーブルを確認すると、一部の経路がh(history)として表示されています。これはフラッピングが起きた事を表しています。
R2#show ip bgp BGP table version is 25, local router ID is 2.2.2.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i1.1.1.1/32 192.168.12.1 0 100 0 i *> 2.2.2.2/32 0.0.0.0 0 32768 i h 3.3.3.3/32 192.168.23.3 0 0 3 i <- フラッピングした経路 h 172.16.0.0/24 192.168.23.3 0 0 3 i <- フラッピングした経路 R2# R2# R2#show ip bgp 3.3.3.3 BGP routing table entry for 3.3.3.3/32, version 19 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Not advertised to any peer 3 192.168.23.3 from 192.168.23.3 (3.3.3.3) Origin IGP, metric 0, localpref 100, valid, external, best Dampinfo: penalty 890, flapped 1 times in 00:00:57 <- penalty値が確認できます。 R2#
- damped
さらにフラッピングを繰り返すと、d(damped)と表示され、他のpeerに経路を伝えなくなります
R2#show ip bgp BGP table version is 29, local router ID is 2.2.2.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i1.1.1.1/32 192.168.12.1 0 100 0 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *d 3.3.3.3/32 192.168.23.3 0 0 3 i *d 172.16.0.0/24 192.168.23.3 0 0 3 i R2# R2# R2#show ip bgp 3.3.3.3 BGP routing table entry for 3.3.3.3/32, version 28 Paths: (1 available, no best path) Flag: 0x820 Not advertised to any peer 3, (suppressed due to dampening) 192.168.23.3 from 192.168.23.3 (3.3.3.3) Origin IGP, metric 0, localpref 100, valid, external Dampinfo: penalty 2078, flapped 2 times in 00:07:35, reuse in 00:09:00 <- penalty値が確認できます R2#
検証8 経路毎のdampening定義
- bgp dampeningの設定
以下のようにroute-mapを用いて経路毎にdampingを定義する事もできます。
R2(config)#ip prefix-list LIST_DAM seq 10 permit 172.16.0.0/24 R2(config)# R2(config)# R2(config)#route-map MAP_DAM permit 10 R2(config-route-map)#match ip address prefix-list LIST_DAM R2(config-route-map)#set dampening 5 600 1500 20 R2(config-route-map)#exit R2(config)# R2(config)# R2(config)#router bgp 1 R2(config-router)#no bgp dampening R2(config-router)#bgp dampening route-map MAP_DAM
- dampingの確認
以下の要領で、R3 Lo0を数回フラッピングさせます。
R3(config)#interface Loopback 0 R3(config-if)#shutdown R3(config-if)#no shutdown
R2のBGPテーブルを見ると、172.16.0.0/24のみdampingの対象となっている事が分かります。
R2#show ip bgp BGP table version is 12, local router ID is 2.2.2.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i1.1.1.1/32 192.168.12.1 0 100 0 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *> 3.3.3.3/32 192.168.23.3 0 0 3 i *d 172.16.0.0/24 192.168.23.3 0 0 3 i R2# R2# R2#show ip bgp 3.3.3.3 BGP routing table entry for 3.3.3.3/32, version 12 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to non peer-group peers: 192.168.12.1 3 192.168.23.3 from 192.168.23.3 (3.3.3.3) Origin IGP, metric 0, localpref 100, valid, external, best R2# R2# R2#show ip bgp 172.16.0.0 BGP routing table entry for 172.16.0.0/24, version 11 Paths: (1 available, no best path) Not advertised to any peer 3, (suppressed due to dampening) 192.168.23.3 from 192.168.23.3 (3.3.3.3) Origin IGP, metric 0, localpref 100, valid, external Dampinfo: penalty 1605, flapped 2 times in 00:02:14, reuse in 00:07:00 R2#