Bird Internet Routing Daemon Configuration and Administration

Show Commands:
bird> show symbols - list of symbols (filters, protocols, tables, etc...)
bird> show protocols [all] - list of protocols [including details]
birdc> show route for “prefix/ip” [all] - list route for given prefix/ip address [including details]
birdc> show route filter “filtr” [all] - list routes according given filter [including details]
birdc> show route where bgp_path ~ [= * 1234 * =] - list routes with given bgp path
birdc> show route where 127.0.0.5 ~ net - the same as “for prefix” (?)
birdc> show route filter { if 10.100.1.0 ~ net then accept; } - debug filter
birdc> show route where bgp_path.last = 15685 routes with origin 15685
birdc> show route tableT1 where bgp_path ~[ =* 701 *=] all count - list a number of routes that go via Verizon
birdc> show route table T1 all filter { if ( 701 ~ bgp_path ) then accept; reject } count - does the same thing as the previous command
birdc> show route table T1 where bgp_path_first = 2828 && bgp_path.len = 2 all count - list a number of routes originating in XO and have AS-PATH length 2
birdc> show route export EDGE_R1 -  equivalent of show route advertising-protocol bgp in junos. 'EDGE_R1' is a name of the bgp group in bird conf
birdc> show route table T1 primary count - show only best routes


 

Examples:

bird> show protocols all EDGE_OSPF name proto table state since info EDGE_OSPF OSPF master up 2015-12-16 Running Preference: 150 Input filter: OSPF_IN Output filter: REJECT Routes: 26 imported, 0 exported, 50 preferred Route change stats: received rejected filtered ignored accepted Import updates: 221 0 25 25 171 Import withdraws: 76 0 --- 0 101 Export updates: 167 163 4 --- 0 Export withdraws: 98 --- --- --- 0 bird>

Filters:

Only BGP routes:
filter BGP {
    if source = RTS_BGP then accept;
}

Only OSPF routes:
filter OSPF {
    if source = RTS_OSPF then accept;
}

Only default route:
filter DEFAULT{
    if net = 0.0.0.0/0 then accept;
    reject;    
}

Only default route:
filter All_ROUTES {
    if net ~ 0.0.0.0/0 then accept;
}

Reject everything:
filter REJECT_ALL {
    reject;
}

Filters and Functions can be referenced in export or import statements, for example:
export filter REJECT_FILTER;
export where REJECT_FUNCTION;

Example 1: Find out a number of routes originated in Verizon network:
Verizon ASN: 701;


There are a couple of ways to do it:

bird> show route table T1 where bgp_path.last = 701 count
2771 of 961949 routes for 571160 networks

bird> show route table T1 filter { if ( bgp_path.last = 701 ) then accept; reject; } count
2771 of 962055 routes for 571185 networks

bird> show route table T1 all filter { if ( bgp_path ~[= *701 =] ) then accept; reject; } count
2772 of 962026 routes for 571171 networks

 

Example 2: Find out a number of routes pass via Verizon network:

bird> show route table T1where 701 ~ bgp_path count
21457 of 961726 routes for 571187 networks

the preceding filter will show routes that pass through Verizon as well as routes originating in Verizon:

If we want to exclude routes originated in Verizon AS and count prefixes that are transiting through Verizon, use the following filter:

bird> show route table T1where bgp_path ~[=* 701 *=] count
21422 of 962449 routes for 571458 networks

Example 3: Find out a number of routes which are two AS-hops away:

bird> show route table T1where bgp_path.len = 2 count
156156 of 962338 routes for 571449 networks

Example 4: Find out a number of routes which are reachable via XO (as# 2828):

bird> show route table T1 where bgp_path.first = 2828 count
325298 of 962331 routes for 571451 networks


Logging & Debuggin:

Set logging of messages having the given class (either all or { error, trace } etc.) into selected destination (a file specified as a filename string, syslog with optional name argument, or the stderr output). Classes are: info, warning, error and fatal for messages about local problems, debug for debugging messages, trace when you want to know what happens in the network, remote for messages about misbehavior of remote machines, auth about authentication failures, bug for internal BIRD bugs. You may specify more than one log line to establish logging to multiple destinations. Default: log everything to the system log. (http://bird.network.cz/?get_doc&f=bird-3.html)

In the following config example we enabled logging for everything, sending it to /var/log/bird.log and enabled debug for all protocols:

Alternatively, we can comment out 'debug protocols all' statement in the config and enabled debugging for a specific protocol from birdc:

bird> debug DA_CORE_R1 all bird> debug DA_CORE_R2 all bird>

Now, lets clear BGP session between two routers and Bird server while tailing log file:

[root@bird_srv]# tail -f /var/log/bird.log 2016-02-11 14:20:54 <TRACE> DA_CORE_R2: Got KEEPALIVE 2016-02-11 14:20:55 <TRACE> DA_CORE_R1: Got KEEPALIVE 2016-02-11 14:20:58 <TRACE> DA_CORE_R2: Sending KEEPALIVE 2016-02-11 14:20:58 <TRACE> DA_CORE_R1: Sending KEEPALIVE 2016-02-11 14:21:11 <TRACE> DA_CORE_R1: Got KEEPALIVE 2016-02-11 14:21:12 <TRACE> DA_CORE_R1: Sending KEEPALIVE 2016-02-11 14:21:12 <TRACE> DA_CORE_R2: Sending KEEPALIVE 2016-02-11 14:21:13 <RMT> DA_CORE_R1: Received: Administrative reset 2016-02-11 14:21:13 <TRACE> DA_CORE_R1: BGP session closed 2016-02-11 14:21:13 <TRACE> DA_CORE_R1: State changed to stop 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 0.0.0.0/0 via 192.168.23.33 on eth5 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed 0.0.0.0/0 via 192.168.23.34 on eth5 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 192.168.23.128/26 multipath 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 192.168.26.0/24 via 192.168.23.40 on eth5 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 172.16.159.128/26 multipath 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 172.16.159.192/26 multipath 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 172.16.159.64/26 multipath 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 10.8.36.86.0/24 via 192.168.23.40 on eth5 2016-02-11 14:21:13 <TRACE> DA_CORE_R1 > removed [replaced] 172.29.205.48/28 multipath 2016-02-11 14:21:14 <TRACE> DA_CORE_R1: Down 2016-02-11 14:21:14 <TRACE> DA_CORE_R1: State changed to down 2016-02-11 14:21:14 <TRACE> DA_CORE_R1: Starting 2016-02-11 14:21:14 <TRACE> DA_CORE_R1: State changed to start 2016-02-11 14:21:14 <TRACE> DA_CORE_R1: Started 2016-02-11 14:21:14 <TRACE> DA_CORE_R1: Connect delayed by 5 seconds 2016-02-11 14:21:14 <TRACE> DA_CORE_R2: Got KEEPALIVE 2016-02-11 14:21:15 <TRACE> DA_CORE_R2: Sending KEEPALIVE 2016-02-11 14:21:16 <TRACE> DA_CORE_R2: Got KEEPALIVE 2016-02-11 14:21:17 <RMT> DA_CORE_R2: Received: Administrative reset 2016-02-11 14:21:17 <TRACE> DA_CORE_R2: BGP session closed 2016-02-11 14:21:17 <TRACE> DA_CORE_R2: State changed to stop 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [replaced] 0.0.0.0/0 via 192.168.23.33 on eth5 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 0.0.0.0/0 via 192.168.23.34 on eth5 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 192.168.23.128/26 multipath 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 192.168.26.0/24 via 192.168.23.40 on eth5 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 172.16.159.128/26 multipath 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 172.16.159.192/26 multipath 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 172.16.159.64/26 multipath 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 10.8.36.86.0/24 via 192.168.23.40 on eth5 2016-02-11 14:21:17 <TRACE> DA_CORE_R2 > removed [sole] 172.29.205.48/28 multipath 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Connecting to 10.2.40.1 from local address 0.0.0.0 2016-02-11 14:21:18 <TRACE> DA_CORE_R2: Down 2016-02-11 14:21:18 <TRACE> DA_CORE_R2: State changed to down 2016-02-11 14:21:18 <TRACE> DA_CORE_R2: Starting 2016-02-11 14:21:18 <TRACE> DA_CORE_R2: State changed to start 2016-02-11 14:21:18 <TRACE> DA_CORE_R2: Started 2016-02-11 14:21:18 <TRACE> DA_CORE_R2: Connect delayed by 5 seconds 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Connected 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Sending OPEN(ver=4,as=53831,hold=10,id=c631173c) 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Got OPEN(as=53831,hold=10,id=0a022801) 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Sending KEEPALIVE 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Got KEEPALIVE 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: BGP session established 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: Connected to table T1 2016-02-11 14:21:18 <TRACE> DA_CORE_R1: State changed to feed

If the above log is too detailed, we can turn the global debugging off ("debug protocols off;") and enable debugging in the the BGP neighbor configuration:

Next