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

Posted 韩德田Tivens

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了路由软件quagga和bird日志配置打印ospf邻居变化相关的知识,希望对你有一定的参考价值。

背景:
  网络侧反馈偶尔会出现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
  *提示:此步骤是为了查看效果,如果是线上机器,请勿执行。

日志如下:
[[email protected] ~]# 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: [email protected]
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
*提示:此步骤是为了查看效果,如果是线上机器,请勿执行。

日志如下:
[[email protected] ~]# 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邻居变化的主要内容,如果未能解决你的问题,请参考以下文章

Quagga OSPF路由器 编译安装

将你的 CentOS 变成 OSPF 路由器

Running Quagga on LXD to test OSPF (by quqi99)

Running Quagga on LXD to test OSPF (by quqi99)

Running Quagga on LXD to test OSPF (by quqi99)

Quagga的安装和使用