4/12/2018

Arista/EOS: How to trace/debug BGP Update

[2019/9/24] Besides turning on the bgp update trace, anther quick way is to use tcpdump with -vvv option. For example, 

router bgp 65000
   neighbor ebgp.v6 peer group
   neighbor ebgp.v6 remote-as 65020

   neighbor ebgp.v6 maximum-routes 12000
   vrf v3
      bgp default ipv4-unicast transport ipv6
      bgp default ipv6-unicast
      neighbor fe80::20%Et3/12/4 peer group ebgp.v6


But neighbor fe80::20%Et3/12/4 has no incoming prefixes

yo412.mlagA.13:47:59(config-router-bgp)#sh ip bgp summary vrf v3
BGP summary information for VRF v3
Router identifier 100.17.80.251, local AS number 65000
Neighbor Status Codes: m - Under maintenance
  Description              Neighbor         V  AS           MsgRcvd   MsgSent  InQ OutQ  Up/Down State   PfxRcd PfxAcc

  v3#1, v46@6L, L3/eth     fe80::20%Et3/12/4 4  65020             22        24    0    0 00:05:27 Estab   0      0

Enable the tcpdump and clear this session in anther session

yo412.mlagA.13:45:36#bash tcpdump -nvvvi et3_12_4 tcp port 179
yo412.mlagA.13:50:00#clear ip bgp fe80::20%Et3/12/4 vrf v3

Now We can see the contents of bgp update packets

13:44:32.751791 44:4c:a8:8d:10:5f > 00:1c:73:44:58:b6, ethertype IPv6 (0x86dd), length 1485: (class 0xc0, flowlabel 0x5ad94, hlim 1, next-header TCP (6) payload length: 1431) fe80::20.38957 > fe80::1.bgp: Flags [P.], seq 85:1484, ack 101, win 225, options [nop,nop,TS val 1506709860 ecr 3429570], length 1399: BGP
Update Message (2), length: 738
  Origin (1), length: 1, Flags [T]: IGP
    0x0000:  00
  AS Path (2), length: 10, Flags [T]: 65020 65000
    0x0000:  0202 0000 fdfc 0000 fde8
  Multi-Protocol Reach NLRI (14), length: 694, Flags [OE]:
    AFI: IPv6 (2), SAFI: Unicast (1)
    nexthop: fe80::20, fe80::20, nh-length: 32, no SNPA
      100:13:22::/64

How to trace/debug BGP updates
This page is to provide a detailed procedure on how to enable BGP trace in gated to debug incoming/outgoing bgp updates. 

Step 1: Find the trace facility
In the gated implementation, the bgp is included in the Ribd agent. So there is no such bgp agent, you have to search the exact trace facility under Rib. 

Arista.7050QX(config)#show trace Rib | grep -i bgp
.....
GatedBgpHelper       enabled  ............
Rib::Bgp             enabled  ............
Rib::Bgp::Keepalive  enabled  ............
Rib::Bgp::Normal     enabled  ............
Rib::Bgp::Notification enabled  ............
Rib::Bgp::Open       enabled  ............
Rib::Bgp::Policy     enabled  ............
Rib::Bgp::Route      enabled  ............
.....
Rib::Bgpwhite::Keepalive enabled  ............
Rib::Bgpwhite::Normal enabled  ............
Rib::Bgpwhite::Notification enabled  ............
Rib::Bgpwhite::Open  enabled  ............
Rib::Bgpwhite::Policy enabled  ............
Rib::Bgpwhite::Route enabled  ............
Rib::Bgpwhite::State enabled  ............
Rib::Bgpwhite::Task  enabled  ............
Rib::Bgpwhite::Timer enabled  ............
Rib::Bgpwhite::Update enabled  ............
....

From above output, there is separate bgp facilities for BGP process under different vrf. In this example, the one I am looking at is Bgp updates under vrf white. 

Step 2: Enable Trace

Arista.7050QX(config)#trace Rib enable Rib::Bgpwhite::Update all

Step 3: Locate the agent log file.  

Arista.7050QX(config)#bash ls -lt /var/log/agents/*white*
-rw-rw-rw- 1 root root 339387 Jun 21 14:15 /var/log/agents/Rib-vrf-white-4032

Step 4: Trigger bgp update and monitor updates

Tail the agent log
Arista.7050QX(config)#bash tail -f /var/log/agents/Rib-vrf-white-4032

Then trigger the bgp clear from another session or other bgp router
Arista.7050QX#clear ipv6 bgp 130:1:10::10 soft vrf white

Here is the output:
....
14:18:08.130842  VR white BGP PACKET: bgp_send_peer_reachability: bnp 130:1:10::1: send path id 4294967295 for prefix 122.130.10.0[apsend=false, entp=edab4460]
14:18:08.130894  VR white BGP PACKET: bgp_rt_send_message: 130:1:10::1, flags 0x5608880, len 108
14:18:08.130947  VR white
14:18:08.130947  VR white BGP SEND 130:1:10::10+49700 -> 130:1:10::1+179
14:18:08.130994  VR white BGP SEND message type 2 (Update) length 108
14:18:08.131190  VR white BGP SEND flags 0x40 code Origin(1): IGP
14:18:08.131231  VR white BGP SEND flags 0x40 code ASPath(2) length 12: 2222
14:18:08.131281  VR white BGP SEND  {1} (0x40 0x03 0x04 0x82)
.....

Step 5: clear the trace

Arista.7050QX(config)#no trace Rib setting

Reference

No comments:

Post a Comment