cisco有ip sla,huawei/h3c 有nqa,juniper有rpm
以下为juniper rpm实践,快点清理bgp邻居
左边left路由器ibgp配置:
set routing-options router-id 10.5.245.41
set routing-options autonomous-system 65001
set protocols bgp group ibgp type internal
set protocols bgp group ibgp local-address 1.1.1.1
set protocols bgp group ibgp neighbor 3.3.3.3
右边right路由器ibgp配置:
set routing-options router-id 10.5.245.43
set routing-options autonomous-system 65001
set protocols bgp group ibgp type internal
set protocols bgp group ibgp local-address 3.3.3.3
set protocols bgp group ibgp neighbor 1.1.1.1
左边left路由器rpm配置:
services rpm probe bgp-mon test icmp-test probe-type icmp-ping
set services rpm probe bgp-mon test icmp-test target address 3.3.3.3
set services rpm probe bgp-mon test icmp-test probe-count 5
set services rpm probe bgp-mon test icmp-test probe-interval 3
set services rpm probe bgp-mon test icmp-test test-interval 5
set services rpm probe bgp-mon test icmp-test source-address 1.1.1.1
set services rpm probe bgp-mon test icmp-test thresholds total-loss 5
左边left路由器event-options policy配置:
set event-options policy clear-bgp-neighbor-ping-failure events ping_test_failed
set event-options policy clear-bgp-neighbor-ping-failure events ping_probe_failed
set event-options policy clear-bgp-neighbor-ping-failure attributes-match ping_test_failed.test-owner matches bgp-mon
set event-options policy clear-bgp-neighbor-ping-failure attributes-match ping_test_failed.test-name matches icmp-test
set event-options policy clear-bgp-neighbor-ping-failure then execute-commands commands "clear bgp neighbor 3.3.3.3"
左边left路由器设置日志以便观察:
set system syslog file interactive-commands interactive-commands any
set system syslog file daemon-info.log daemon info
验证:
right路由器上deactivate接口,模拟断线情况:
root@right# deactivate interfaces ge-0/0/1
root@right# commit
在左侧left路由器上观察bgp状态:
root@left# run show bgp neighbor | match State
Type: Internal State: Active Flags: <>
Last State: Idle Last Event: Start
在左侧left路由器上观察日志:
root@left> show log interactive-commands | last 20
May 27 10:02:19 left mgd[35913]: UI_AUTH_EVENT: Authenticated user 'root' at permission level 'super-user'
May 27 10:02:19 left mgd[35913]: UI_LOGIN_EVENT: User 'root' login, class 'super-user' [35913], ssh-connection '', client-mode 'cli'
May 27 10:02:19 left mgd[35913]: UI_CMDLINE_READ_LINE: User 'root', command 'xml-mode '
May 27 10:02:19 left mgd[35913]: UI_LOGOUT_EVENT: User 'root' logout
May 27 10:02:19 left file[35912]: UI_AUTH_EVENT: Authenticated user 'root' at permission level 'super-user'
May 27 10:02:19 left file[35912]: UI_LOGIN_EVENT: User 'root' login, class 'super-user' [35912], ssh-connection '', client-mode 'junoscript'
May 27 10:02:19 left file[35912]: UI_CMDLINE_READ_LINE: User 'root', command 'rpc command clear bgp neighbor 3.3.3.3 '
May 27 10:02:19 left file[35912]: UI_JUNOSCRIPT_CMD: User 'root' used JUNOScript client to run command 'clear-bgp-neighbor neighbor=3.3.3.3'
May 27 10:02:19 left file[35912]: UI_LOGOUT_EVENT: User 'root' logout
出现clear-bgp-neighbor neighbor=3.3.3.3字眼,表示能快速清除bgp邻居会话,不会等待bgp hold time 90秒的超时
在左侧left路由器上观察日志:
root@left# run show log daemon-info.log | last 20
May 27 10:15:33 left rmopd[2311]: PING_PROBE_FAILED: pingCtlOwnerIndex = bgp-mon, pingCtlTestName = icmp-test
May 27 10:15:33 left rpd[2305]: noblock_funopen: task MGMT.local socket 59 bgp_peer_mgmt_clear:6997: NOTIFICATION sent to 3.3.3.3 (Internal AS 65001): code 6 (Cease) subcode 4 (Administratively Reset), Reason: Management session cleared BGP neighbor