If your quagga bgpd daemon is up and running (check out our article for Minimal quagga bgpd configuration to run and remote configure it) and you wonder how to check if everything is OK and the bgp session is established, here is a quick command line tip what you can do:
STEP 1) Check if your bgp daemon is connected to a remote bgp server (neighbor)
root@srv ~ # vtysh -c "show bgp neighbors"
BGP neighbor is 10.10.10.10, remote AS 16238, local AS 52218, external link
BGP version 4, remote router ID 10.10.10.131
BGP state = Established, up for 2d23h57m
Last read 00:00:03, hold time is 9, keepalive interval is 3 seconds
Neighbor capabilities:
4 Byte AS: advertised
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Graceful Restart Capabilty: advertised
Message statistics:
Inq depth is 0
Outq depth is 0
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 1 2
Keepalives: 86323 86049
Route Refresh: 0 0
Capability: 0 0
Total: 86325 86052
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
Community attribute sent to this neighbor(both)
Outbound path policy configured
Outgoing update prefix filter list is *anydns-pfx
12 accepted prefixes
Connections established 1; dropped 0
Last reset never
Local host: 10.10.10.5, Local port: 40172
Foreign host: 10.10.10.10, Foreign port: 179
Nexthop: 10.10.10.5
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
Read thread: on Write thread: off
STEP 2) Check the IP routes
root@srv ~ # vtysh -c "show ip bgp"
BGP table version is 0, local router ID is 10.10.10.5
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 10.10.10.10 0 30627 i
*> 10.10.11.240/28
10.10.10.10 0 0 30627 ?
*> 10.10.11.234/31
10.10.10.10 0 0 30627 ?
*> 10.10.12.236/31
10.10.10.10 0 0 30627 ?
*> 10.10.13.242/32
10.10.10.10 0 0 30627 ?
*> 10.10.14.0/24 10.10.10.10 0 0 30627 ?
*> 10.10.15.0/24 10.10.10.10 0 0 30627 ?
*> 10.10.16.0/24 10.10.10.10 0 0 30627 ?
*> 11.11.11.0/24 0.0.0.0 0 29873 i
*> 10.10.17.64/26 10.10.10.10 0 0 30627 ?
*> 10.10.18.240/29
10.10.10.10 0 0 30627 ?
*> 10.10.10.192/26
10.10.10.10 0 0 30627 ?
*> 10.10.10.192/26
10.10.10.10 0 0 30627 ?
Total number of prefixes 13
vtysh
vtysh – is the command line tool to manage Quagga BGP daemon locally.
Bonus Configuration
Here is our basic configuration in “/etc/quagga/bgpd.conf ”
hostname ns5.anycast.local1 password pppppppppp log file /var/log/quagga/bgpd.log router bgp 52218 bgp router-id 10.10.10.5 network 11.11.11.0/24 neighbor 10.10.10.10 remote-as 16238 neighbor 10.10.10.10 prefix-list anydns-pfx out ! ip prefix-list anydns-pfx seq 5 permit 11.11.11.0/24 ! line vty
* All IPs are changed.