背景:
网络侧反馈偶尔会出现 ospf 邻居状态变化:full-> other status -> full. 历史原因,线上运行的路由软件有 quagga 和 bird 两种。两种路由软件的日志级别配置,打印 ospf 邻居状态变化的过程。
quagga:
配置选项:
日志文件记录配置
log file /home/work/quagga/logs/ospfd.log
日志打印邻居关系状态变化过程
debug ospf nsm status
配置操作:
mkdir /home/work/quagga/logs -pv
chown -R quagga.quagga /home/work/quagga/
vtysh
conf t
log file /home/work/quagga/logs/ospfd.log
debug ospf nsm status
end
w
exit
* 提示:Linux 命令行下复制粘贴上述命令即可,热加载生效,无需重启服务。
重启 ospfd 服务:
service ospfd restart
* 提示:此步骤是为了查看效果,如果是线上机器,请勿执行。
日志如下:
[root@localhost ~]# cat /home/work/quagga/logs/ospfd.log
2017/12/15 13:42:11 OSPF: Terminating on signal
2017/12/15 13:42:11 OSPF: NSM[eth1:10.105.251.26:10.105.252.174]: State change Full -> Deleted (KillNbr)
2017/12/15 13:42:11 OSPF: AdjChg: Nbr 10.105.252.174 on eth1:10.105.251.26: Full -> Deleted (KillNbr)
2017/12/15 13:42:11 OSPF: nsm_change_state(10.105.252.174, Full -> Deleted): scheduling new router-LSA origination
2017/12/15 13:42:11 OSPF: ospfTrapIfStateChange trap sent: 10.105.251.26 now Down
2017/12/15 13:42:11 OSPF: interface 10.105.251.26 [5] leave AllSPFRouters Multicast group.
2017/12/15 13:42:11 OSPF: OSPFd 0.99.15 starting: vty@2604
2017/12/15 13:42:11 OSPF: ospfTrapIfStateChange trap sent: 10.105.251.26 now Point-To-Point
2017/12/15 13:42:11 OSPF: interface 10.105.251.26 [5] join AllSPFRouters Multicast group.
2017/12/15 13:42:11 OSPF: NSM[eth1:10.105.251.26:10.105.252.174]: State change Down -> Init (HelloReceived)
2017/12/15 13:42:11 OSPF: NSM[eth1:10.105.251.26:10.105.252.174]: State change Init -> ExStart (2-WayReceived)
2017/12/15 13:42:11 OSPF: Packet[DD]: Neighbor 10.105.252.174 Negotiation done (Slave).
2017/12/15 13:42:11 OSPF: NSM[eth1:10.105.251.26:10.105.252.174]: State change ExStart -> Exchange (NegotiationDone)
2017/12/15 13:42:11 OSPF: NSM[eth1:10.105.251.26:10.105.252.174]: State change Exchange -> Loading (ExchangeDone)
2017/12/15 13:42:11 OSPF: NSM[eth1:10.105.251.26:10.105.252.174]: State change Loading -> Full (LoadingDone)
2017/12/15 13:42:11 OSPF: AdjChg: Nbr 10.105.252.174 on eth1:10.105.251.26: Loading -> Full (LoadingDone)
2017/12/15 13:42:11 OSPF: nsm_change_state(10.105.252.174, Loading -> Full): scheduling new router-LSA origination
bird:
配置选项:
日志文件记录配置
log "/home/work/logs/bird.log" all;
日志打印邻居关系状态变化过程
1. debug protocols {events}; #全局配置
2. debug {events}; #局部配置,在每个 protocol 中配置
* 提示:在 1 和 2 中选择其中一个,请注意配置位置,建议采用全局配置。
配置操作:
sed -i '3idebug protocols {events};' /etc/bird.conf #bird 配置文件
热加载生效,无需重启服务。
birdcl config
重启 bird 服务:
kill -9 `ps -ef |grep bir[d]|awk '{print $2}'`
/usr/local/bird/sbin/bird -c /usr/local/bird/etc/bird.conf
* 提示:此步骤是为了查看效果,如果是线上机器,请勿执行。
日志如下:
[root@localhost ~]# grep state /home/work/logs/bird.log
2017-12-12 19:03:03
2017-12-12 19:03:03
2017-12-12 19:03:03
2017-12-12 19:03:04
2017-12-12 19:03:06
2017-12-12 19:03:15
2017-12-12 19:03:15
2017-12-12 19:03:15
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:35
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:36
2017-12-12 19:03:37
2017-12-12 19:03:37
2017-12-12 19:03:37
2017-12-12 19:03:37
参考文档:
quagga 官方文档:http://www.nongnu.org/quagga/
bird 官方文档:http://bird.network.cz/
来源: http://www.bubuko.com/infodetail-2431349.html