BGP routes persist in kernel

Aaron Wirtz aw at underground8.com
Fri Jan 5 13:03:15 CET 2007


I have a test setup involving 2 machines running BIRD, communicating
routes via BGP.  When trying to integrate to the Linux kernel routing
table, I am having some problems.  While BIRD is running, it adds
BGP-learned routes to the kernel route table properly (also properly
preferring the local device route 10.0.1.0/24 over the BGP-learned route
10.0.1.0/24).  But when BIRD shuts down, it removes the device route
10.0.1.0/24 from the kernel table, then installs the BGP route
10.0.1.0/24 instead, and leaves the other BGP-learned routes in the
kernel instead of cleaning them.  I have attached the configuration and
debugging output showing this problem.
Maybe there is something obvious I am overlooking?

-Aaron

Config:

router id 62.168.0.1;
protocol device {
        debug all;
        scan time 10;
}
protocol direct {
        debug all;
}
protocol kernel {
        debug all;
        persist no;
        kernel table 254;
        learn;
        scan time 10;
        import all;
        export all;
}
protocol bgp {
        debug all;
        import all;
        export all;
        local as 123;
        neighbor 10.0.1.126 as 5;
}

Log:
Lines marked "joda#" are commands I typed in the shell.
Lines marked "bird>" are commands I typed to birdc.
Lines marked "bird:" are debug output from bird.
All other lines are the immediate output of a command I typed.

joda# cat /proc/version
Linux version 2.6.15-27-amd64-generic (buildd at king) (gcc version 4.0.3
(Ubuntu 4.0.3-1ubuntu5)) #1 SMP PREEMPT Fri Dec 8 17:50:54 UTC 2006
joda# route -n
Kernel IP routing table
Destination Gateway  Genmask       Flags Metric Ref Use Iface
10.0.1.0    0.0.0.0  255.255.255.0 U     0      0     0 eth0
0.0.0.0     10.0.1.1 0.0.0.0       UG    0      0     0 eth0
joda# bird -d
bird: device1: Initializing
bird: direct1: Initializing
bird: kernel1: Initializing
bird: bgp1: Initializing
bird: device1: Starting
bird: device1: Scanning interfaces
bird: device1: State changed to feed
bird: direct1: Starting
bird: direct1: State changed to feed
bird: kernel1: Starting
bird: kernel1: State changed to feed
bird: bgp1: Starting
bird: bgp1: State changed to start
bird: device1: State changed to up
bird: direct1 < primary address 127.0.0.0/8 on interface lo added
bird: direct1 > added [best] 127.0.0.0/8 dev lo
bird: direct1 < primary address 10.0.1.0/24 on interface eth0 added
bird: direct1 > added [best] 10.0.1.0/24 dev eth0
bird: direct1: State changed to up
bird: kernel1: Connected to table master
bird: kernel1 < added 10.0.1.0/24 dev eth0
bird: kernel1 < added 127.0.0.0/8 dev lo
bird: kernel1: State changed to up
bird: bgp1: Connect delayed by 5 seconds
bird: kernel1: Scanning routing table
bird: kernel1: 0.0.0.0/0: [alien] created
bird: kernel1: Pruning table master
bird: kernel1: Pruning inherited routes
bird: kernel1 > added [best] 0.0.0.0/0 via 10.0.1.1 on eth0
bird: kernel1 < added 0.0.0.0/0 via 10.0.1.1 on eth0
joda# route -n
Kernel IP routing table
Destination Gateway  Genmask       Flags Metric Ref Use Iface
10.0.1.0    0.0.0.0  255.255.255.0 U     0      0     0 eth0
0.0.0.0     10.0.1.1 0.0.0.0       UG    0      0     0 eth0
joda# birdc
BIRD 1.0.11 ready.
bird> show route
0.0.0.0/0          via 10.0.1.1 on eth0 [kernel1 12:34] (10)
10.0.1.0/24        dev eth0 [direct1 12:34] (240)
127.0.0.0/8        dev lo [direct1 12:34] (240)
bird: bgp1: Connecting to 10.0.1.126 from local address 10.0.1.10
bird: device1: Scanning interfaces
bird: kernel1: Scanning routing table
bird: kernel1: 0.0.0.0/0: [alien] seen
bird: kernel1: Pruning table master
bird: kernel1: Pruning inherited routes
bird: bgp1: Incoming connection from 10.0.1.126 port 33378
bird: bgp1: Sending OPEN(ver=4,as=123,hold=240,id=3ea80001)
bird: bgp1: Got OPEN(as=5,hold=240,id=3ea80002)
bird: bgp1: Connection collision, giving up the other connection
bird: bgp1: Sending KEEPALIVE
bird: bgp1: Got KEEPALIVE
bird: bgp1: State changed to feed
bird: bgp1: Connected to table master
bird: bgp1 < added 0.0.0.0/0 via 10.0.1.1 on eth0
bird: bgp1: Sending UPDATE
bird: bgp1 < added 10.0.1.0/24 dev eth0
bird: bgp1: Sending UPDATE
bird: bgp1 < out of scope 127.0.0.0/8 dev lo
bird: bgp1: State changed to up
bird: bgp1: Got UPDATE
bird: bgp1 > added 10.0.1.0/24 via 10.0.1.126 on eth0
bird: bgp1: Got UPDATE
bird: bgp1 > added [best] 10.1.2.0/24 via 10.0.1.126 on eth0
bird: kernel1 < added 10.1.2.0/24 via 10.0.1.126 on eth0
bird: bgp1 < rejected by protocol 10.1.2.0/24 via 10.0.1.126 on eth0
bird: bgp1: Got UPDATE
bird: bgp1 > added [best] 10.0.7.0/24 via 10.0.1.126 on eth0
bird: kernel1 < added 10.0.7.0/24 via 10.0.1.126 on eth0
bird: bgp1 < rejected by protocol 10.0.7.0/24 via 10.0.1.126 on eth0
bird: bgp1: Got UPDATE
bird: bgp1 > added [best] 10.9.8.0/24 via 10.0.1.126 on eth0
bird: kernel1 < added 10.9.8.0/24 via 10.0.1.126 on eth0
bird: bgp1 < rejected by protocol 10.9.8.0/24 via 10.0.1.126 on eth0
joda# route -n
Kernel IP routing table
Destination Gateway    Genmask       Flags Metric Ref Use Iface
10.0.7.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
10.0.1.0    0.0.0.0    255.255.255.0 U     0      0     0 eth0
10.9.8.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
10.1.2.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
0.0.0.0     10.0.1.1   0.0.0.0       UG    0      0     0 eth0
bird> show route
0.0.0.0/0          via 10.0.1.1 on eth0 [kernel1 12:34] (10)
10.0.1.0/24        dev eth0 [direct1 12:34] (240)
                   via 10.0.1.126 on eth0 [bgp1 12:34] (100) [AS5i]
10.1.2.0/24        via 10.0.1.126 on eth0 [bgp1 12:34] (100) [AS5i]
10.0.7.0/24        via 10.0.1.126 on eth0 [bgp1 12:34] (100) [AS5i]
10.9.8.0/24        via 10.0.1.126 on eth0 [bgp1 12:34] (100) [AS5i]
127.0.0.0/8        dev lo [direct1 12:34] (240)
bird: device1: Scanning interfaces
bird: kernel1: Scanning routing table
bird: kernel1: 10.0.7.0/24: seen
bird: kernel1: 10.9.8.0/24: seen
bird: kernel1: 10.1.2.0/24: seen
bird: kernel1: 0.0.0.0/0: [alien] seen
bird: kernel1: Pruning table master
bird: kernel1: Pruning inherited routes
joda# killall bird
bird: Shutting down
bird: device1: Unconfigured
bird: device1: Shutting down
bird: direct1 < primary address 127.0.0.0/8 on interface lo removed
bird: kernel1 < removed 127.0.0.0/8 dev lo
bird: bgp1 < removed 127.0.0.0/8 dev lo
bird: bgp1: Sending UPDATE
bird: direct1 > removed [sole] 127.0.0.0/8 dev lo
bird: direct1 < primary address 10.0.1.0/24 on interface eth0 removed
bird: kernel1 < replaced 10.0.1.0/24 via 10.0.1.126 on eth0
bird: bgp1 < rejected by protocol 10.0.1.0/24 via 10.0.1.126 on eth0
bird: bgp1 < removed 10.0.1.0/24 dev eth0
bird: bgp1: Sending UPDATE
bird: direct1 > removed [replaced] 10.0.1.0/24 dev eth0
bird: bgp1: Neighbor lost
bird: bgp1: State changed to flush
bird: bgp1: Sending NOTIFICATION(code=6.0)
bird: device1: State changed to flush
bird: direct1: Unconfigured
bird: direct1: Shutting down
bird: direct1: State changed to flush
bird: kernel1: Unconfigured
bird: kernel1: Shutting down
bird: kernel1: Flushing kernel routes
bird: kernel1: State changed to flush
bird: bgp1: Unconfigured
bird: kernel1 > removed [sole] 0.0.0.0/0 via 10.0.1.1 on eth0
bird: bgp1 > removed [sole] 10.0.1.0/24 via 10.0.1.126 on eth0
bird: bgp1 > removed [sole] 10.1.2.0/24 via 10.0.1.126 on eth0
bird: bgp1 > removed [sole] 10.0.7.0/24 via 10.0.1.126 on eth0
bird: bgp1 > removed [sole] 10.9.8.0/24 via 10.0.1.126 on eth0
bird: bgp1: State changed to down
bird: device1: State changed to down
bird: direct1: State changed to down
bird: kernel1: State changed to down
bird: System shutdown completed
joda# route -n
Kernel IP routing table
Destination Gateway    Genmask       Flags Metric Ref Use Iface
10.0.7.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
10.0.1.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
10.9.8.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
10.1.2.0    10.0.1.126 255.255.255.0 UG    0      0     0 eth0
0.0.0.0     10.0.1.1   0.0.0.0       UG    0      0     0 eth0


P.S.
Also, BIRD did not seem to use the proper kernel routing table by
default.  I had to manually specify "kernel table 254" in the config.




More information about the Bird-users mailing list