码迷,mamicode.com
首页 > 其他好文 > 详细

路由软件quagga和bird日志配置打印ospf邻居变化

时间:2017-12-17 01:01:30      阅读:578      评论:0      收藏:0      [点我收藏+]

标签:trace   机器   1.3   received   生效   参考   级别   http   sed   

背景:
  网络侧反馈偶尔会出现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 <TRACE> C3_CNC: Changing state of iface veth1.306 from down to ptp
2017-12-12 19:03:03 <TRACE> C3_CTC: Changing state of iface veth1.305 from down to ptp
2017-12-12 19:03:03 <TRACE> C3_BGP: Changing state of iface veth1.308 from down to ptp
2017-12-12 19:03:04 <TRACE> C3_CMN: Changing state of iface veth1.307 from down to ptp
2017-12-12 19:03:06 <TRACE> C3_CTC: Changing state of iface lo from down to ptp
2017-12-12 19:03:15 <TRACE> C3_CTC: Changing state of iface lo from ptp to down
2017-12-12 19:03:15 <TRACE> C3_CTC: Changing state of iface lo from down to ptp
2017-12-12 19:03:15 <TRACE> C3_CTC: Changing state of iface lo from down to ptp
2017-12-12 19:03:35 <TRACE> C3_CMN: Neighbor 10.115.254.49 changes state from " down" to " init".
2017-12-12 19:03:35 <TRACE> C3_CMN: Neighbor 10.115.254.49 changes state from " init" to " 2way".
2017-12-12 19:03:35 <TRACE> C3_CMN: Neighbor 10.115.254.49 changes state from " 2way" to " exstart".
2017-12-12 19:03:35 <TRACE> C3_CNC: Neighbor 10.115.254.45 changes state from " down" to " init".
2017-12-12 19:03:35 <TRACE> C3_CNC: Neighbor 10.115.254.45 changes state from " init" to " 2way".
2017-12-12 19:03:35 <TRACE> C3_CNC: Neighbor 10.115.254.45 changes state from " 2way" to " exstart".
2017-12-12 19:03:35 <TRACE> C3_CTC: Neighbor 10.115.254.41 changes state from " down" to " init".
2017-12-12 19:03:35 <TRACE> C3_CTC: Neighbor 10.115.254.41 changes state from " init" to " 2way".
2017-12-12 19:03:35 <TRACE> C3_CTC: Neighbor 10.115.254.41 changes state from " 2way" to " exstart".
2017-12-12 19:03:35 <TRACE> C3_BGP: Neighbor 10.115.254.53 changes state from " down" to " init".
2017-12-12 19:03:35 <TRACE> C3_BGP: Neighbor 10.115.254.53 changes state from " init" to " 2way".
2017-12-12 19:03:35 <TRACE> C3_BGP: Neighbor 10.115.254.53 changes state from " 2way" to " exstart".
2017-12-12 19:03:36 <TRACE> C3_CMN: Neighbor 10.115.254.49 changes state from " exstart" to "exchange".
2017-12-12 19:03:36 <TRACE> C3_CNC: Neighbor 10.115.254.45 changes state from " exstart" to "exchange".
2017-12-12 19:03:36 <TRACE> C3_CTC: Neighbor 10.115.254.41 changes state from " exstart" to "exchange".
2017-12-12 19:03:36 <TRACE> C3_BGP: Neighbor 10.115.254.53 changes state from " exstart" to "exchange".
2017-12-12 19:03:36 <TRACE> C3_CNC: Neighbor 10.115.254.45 changes state from "exchange" to " loading".
2017-12-12 19:03:36 <TRACE> C3_CMN: Neighbor 10.115.254.49 changes state from "exchange" to " loading".
2017-12-12 19:03:36 <TRACE> C3_CTC: Neighbor 10.115.254.41 changes state from "exchange" to " loading".
2017-12-12 19:03:36 <TRACE> C3_BGP: Neighbor 10.115.254.53 changes state from "exchange" to " loading".
2017-12-12 19:03:37 <TRACE> C3_CTC: Neighbor 10.115.254.41 changes state from " loading" to " full".
2017-12-12 19:03:37 <TRACE> C3_CNC: Neighbor 10.115.254.45 changes state from " loading" to " full".
2017-12-12 19:03:37 <TRACE> C3_CMN: Neighbor 10.115.254.49 changes state from " loading" to " full".
2017-12-12 19:03:37 <TRACE> C3_BGP: Neighbor 10.115.254.53 changes state from " loading" to " full".


参考文档:

quagga官方文档:http://www.nongnu.org/quagga/
bird官方文档:http://bird.network.cz/

路由软件quagga和bird日志配置打印ospf邻居变化

标签:trace   机器   1.3   received   生效   参考   级别   http   sed   

原文地址:http://www.cnblogs.com/xkops/p/8048144.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!