bird 1.3.7 setting incorrect nexthop on FreeBSD

Виталий Туровец corebug at corebug.net
Thu Aug 30 21:30:00 CEST 2012


Hello there, people!
I have a strange moment with bird's behaviour on FreeBSD 9.0-RC3
(FreeBSD 9.0-RC3 i386 GENERIC):
It establishes BGP sessions, succesfully exchanges routes and when
exporting them to kernel sets 127.0.0.1 via lo0 as next hop. An
example:

bird> show route all 192.168.2.0/24
192.168.2.0/24     unreachable [Cisco 22:11 from 172.16.0.252] *
(100/-) [AS65002i]
        Type: BGP unicast univ
        BGP.origin: IGP
        BGP.as_path: 65002
        BGP.next_hop: 172.16.0.252
        BGP.med: 0
        BGP.local_pref: 100
        BGP.community: (65001,252)

bird> show route all export kernel1 192.168.2.0/24
192.168.2.0/24     unreachable [Cisco 22:11 from 172.16.0.252] *
(100/-) [AS65002i]
        Type: BGP unicast univ
        BGP.origin: IGP
        BGP.as_path: 65002
        BGP.next_hop: 172.16.0.252
        BGP.med: 0
        BGP.local_pref: 100
        BGP.community: (65001,252)

[22:11][border][~] # netstat -rn -f inet  | grep 192.168.2.0
192.168.2.0/24     127.0.0.1          UR1         0        8    lo0
[22:15][border][~] # route get 192.168.2.1
   route to: 192.168.2.1
destination: 192.168.2.0
       mask: 255.255.255.0
  interface: lo0
      flags: <UP,REJECT,DONE,PROTO1>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0     16384         1         0


And from the other side there's Cisco's router (the problem also
persists on BGP between bird and quagga):

OfficeCisco#show ip bgp neighbors 172.16.0.253 advertised-routes  | in 192.168.2
*> 192.168.2.0      172.16.0.38              0             0 65002 i

OfficeCisco#show ip route 192.168.2.0 255.255.255.0
Routing entry for 192.168.2.0/24
  Known via "bgp 65001", distance 20, metric 0
  Tag 65002, type external
  Last update from 172.16.0.38 3d02h ago
  Routing Descriptor Blocks:
  * 172.16.0.38, from 172.16.0.38, 3d02h ago
      Route metric is 0, traffic share count is 1
      AS Hops 1

This same route with exactly same settings is also advertised to
another FreeBSD box running quagga and the route is correctly handled
and installed with correct nexthop:

[22:21][db][~] $ netstat -rn -f inet | grep 192.168.2.0
192.168.2.0/24     172.16.0.252       UG1         0  1475392    LAN

[22:21][db][~] $ s vtysh -c 'sh ip bgp 192.168.2.0/24'
BGP routing table entry for 192.168.2.0/24
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  65002
    172.16.0.252 (metric 1) from 172.16.0.252 (192.168.0.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Last update: Thu Aug 30 10:56:20 2012

My BGP neighbors and kernel configuration here:

protocol kernel {
        learn;
        persist;
        scan time 10;
        import all;
        export where source = RTS_BGP;

}

protocol static AS65001 {
        description "Nets that we export";
        route 192.168.0.0/24 reject;
        route 192.168.1.0/24 reject;
        route 172.16.0.248/29 reject;
        route 95.158.3.122/32 reject;
        route 0.0.0.0/0 reject;
}

filter bgp_from_db{
    if  net = 0.0.0.0/0 then {
        reject;
    }else{
        bgp_community=add(bgp_community,(65001,253));
        accept;
    }
}

filter bgp_from_cisco{
    if  net = 0.0.0.0/0 then {
        reject;
    }else{
        bgp_community=add(bgp_community,(65001,252));
        accept;
    }
}
filter bgp_to_db {
    if proto="AS65001" then {
        bgp_community=add(bgp_community,(65001,254));
        accept;
    }    else reject;
}

filter bgp_to_cisco {
    if net ~ 192.168.1.0/24 then reject;
    if proto="AS65001" then {
        bgp_community=add(bgp_community,(65001,254));
        accept;
    } else reject;
}

protocol bgp DB {
        description "DB Server";
        local as 65001;
        neighbor 172.16.0.253 as 65001;
        import filter bgp_from_db;
        export filter bgp_to_db;
}

protocol bgp Cisco {
        description "Office<->Service 2620";
        local as 65001;
        neighbor 172.16.0.252 as 65001;
        import filter bgp_from_cisco;
        export filter bgp_to_cisco;
}


And this is what bird shows in log:
30-08-2012 22:25:35 <TRACE> kernel1: 192.168.2.0/24: seen
30-08-2012 22:25:35 <TRACE> kernel1: Pruning table master
30-08-2012 22:25:35 <TRACE> kernel1: Pruning inherited routes
30-08-2012 22:25:45 <TRACE> device1: Scanning interfaces
30-08-2012 22:25:45 <TRACE> kernel1: Scanning routing table
30-08-2012 22:25:45 <TRACE> Setting fib to 0 for route dump
30-08-2012 22:25:45 <TRACE> kernel1: 0.0.0.0/0: [alien] seen
30-08-2012 22:25:45 <TRACE> kernel1: 95.158.3.120/29: ignored
30-08-2012 22:25:45 <TRACE> kernel1: 95.158.3.122/32: [alien] seen
30-08-2012 22:25:45 <TRACE> kernel1: 95.158.3.123/32: seen
30-08-2012 22:25:45 <TRACE> kernel1: 172.16.0.0/27: seen
30-08-2012 22:25:45 <TRACE> kernel1: 172.16.0.36/30: seen
30-08-2012 22:25:45 <TRACE> kernel1: 172.16.0.248/29: ignored
30-08-2012 22:25:45 <TRACE> kernel1: 172.16.0.254/32: [alien] seen
30-08-2012 22:25:45 <TRACE> kernel1: 192.168.0.0/24: ignored
30-08-2012 22:25:45 <TRACE> kernel1: 192.168.0.1/32: [alien] seen
30-08-2012 22:25:45 <TRACE> kernel1: 192.168.0.4/32: seen
30-08-2012 22:25:45 <TRACE> kernel1: 192.168.1.0/24: ignored
30-08-2012 22:25:45 <TRACE> kernel1: 192.168.1.1/32: [alien] seen
30-08-2012 22:25:45 <TRACE> ...
30-08-2012 22:25:45 <TRACE> kernel1: 192.168.2.0/24: seen
30-08-2012 22:25:45 <TRACE> kernel1: Pruning table master
30-08-2012 22:25:45 <TRACE> kernel1: Pruning inherited routes

Thank you guys for help!

-- 




~~~
WBR,
Vitaliy Turovets
Systems Administrator
Corebug.Net
+38(093)265-70-55
VITU-RIPE



More information about the Bird-users mailing list