Hello,

Any hints will be greatly appreciated !

Cheers

Cédric Lemarchand

On 25 Feb 2017, at 18:03, Cedric Lemarchand <yipikai7@gmail.com> wrote:

Hello Ondrej,

Thanks for your precious explanations. Unfortunately I am still stuck, static routes does not apply between 2 hosts.

To solve 1) and 2), and in the way I only need to publish static routes to other BGP hosts, I changed "export all” by "export where proto = “static1” “,  but still no luck. I notice that static routes are not received any more on hosts.

Here is my understanding of “show protocol all” on host1 :

direct1  Direct   master   up     17:35:58
  Preference:     240
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         2 imported, 0 exported, 2 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              2          0          0          0          2
    Import withdraws:            0          0        ---          0          0
    Export updates:              0          0          0        ---          0
    Export withdraws:            0        ---        ---        ---          0

Bird finds 2 direct routes related to eth0 and eth1, so they are received, accepted, but not exported, which is fine.

kernel1  Kernel   master   up     17:41:12
  Preference:     10
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         1 imported, 0 exported, 1 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              1          0          0          0          1
    Import withdraws:            0          0        ---          0          0
    Export updates:              6          5          1        ---          0
    Export withdraws:            0        ---        ---        ---          0

Bird find 1 static route and try to export 6 routes but they all get rejected or filtered, which is fine too, but I dont know why “6” routes of the routing table bellow :

root@host1:~# ip r
10.10.1.0/24 dev eth0  proto kernel  scope link  src 10.10.1.1
10.10.2.0/24 via 10.10.1.254 dev eth0
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.1

device1  Device   master   up     17:41:12
  Preference:     240
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         0 imported, 0 exported, 0 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              0          0          0          0          0
    Import withdraws:            0          0        ---          0          0
    Export updates:              0          0          0        ---          0
    Export withdraws:            0        ---        ---        —          0

Nothing to say about this one, from what I have read it’s role is to feed the kernel protocol.

static1  Static   master   up     17:41:12
  Preference:     200
  Input filter:   ACCEPT
  Output filter:  ACCEPT
  Routes:         1 imported, 0 exported, 0 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              1          0          0          0          1
    Import withdraws:            0          0        ---          0          0
    Export updates:              0          0          0        ---          0
    Export withdraws:            0        ---        ---        ---          0

This one is annoying me and I think the issue is there, 1 imported but ignored, why ?

bgp1     BGP      master   up     17:41:13    Established
  Preference:     100
  Input filter:   ACCEPT
  Output filter:  (unnamed)
  Routes:         0 imported, 0 exported, 0 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              0          0          0          0          0
    Import withdraws:            0          0        ---          0          0
    Export updates:              3          0          3        ---          0
    Export withdraws:            0        ---        ---        ---          0
  BGP state:          Established
    Neighbor address: 10.10.2.1
    Neighbor AS:      3000
    Neighbor ID:      10.10.2.1
    Neighbor caps:    refresh restart-aware AS4
    Session:          internal multihop AS4
    Source address:   10.10.1.1
    Hold timer:       162/240
    Keepalive timer:  53/80

I don’t understand why 3 routes are received because protocols direct1 and kernel1 should not export anything, and only one static route should be received via BGP from host2 ! Also the ouput filter is unamed, which I thinks is not good.

Below the host1 bird.conf.

As you can see I think I misunderstand some things, and I am a bit disappointed.

Cheers


router id 10.10.1.1;
protocol direct {
        interface "*";  # Restrict network interfaces it works with
}
protocol kernel {
        learn;                  # Learn all alien routes from the kernel
        #persist;               # Don't remove routes on bird shutdown
        scan time 20;           # Scan kernel routing table every 20 seconds
        import all;             # Default is import all
        export none;            # Default is export none
}
protocol device {
        scan time 10;           # Scan interfaces every 10 seconds
}
protocol static static1 {
        route 192.168.1.0/24 via 10.10.1.1;
        export all;
}
protocol bgp {
        multihop;
        #gateway recursive;
        import all;
        export where proto = "static1";
        local as 3000;
        neighbor 10.10.2.1 as 3000;
        #next hop self;
        #rr client;
}

Cédric Lemarchand

On 23 Feb 2017, at 17:10, Ondrej Zajicek <santiago@crfreenet.org> wrote:

On Thu, Feb 23, 2017 at 04:42:50PM +0100, Cedric Lemarchand wrote:
Yes, I am not sure to understand how plays theses options (and if I need it) in the bgp protocol and it they are related to my problem :



gateway recursive : means that if host2 advertise "route 192.168.2.0/24
via 10.10.2.1;” to host1, host1 does a lookup in the kernel routing table
and set the nexthop for 192.168.2.0/24 via the same IP as for host2 ?

Mainly yes, but:

1) Not lookup in the kernel routing table, but in the BIRD table. By
default the same table as used by BGP protocol, but could be configured
to different one by 'igp table' option.

2) It is not lookup for host2, but lookup for bgp_next_hop attribute, as
specified by host2, which is usually value of 'via'.

next hop self : means that every route advertised by host2 will be routed to it self while keeping the “gateway recursive” logic ?

That means host2 always announces own IP address as bgp_next_hop instead
of one from 'via'.

The output of show route all :

There are two issues:

1) both hosts announce all routes (not only 192.168.xx but also 10.10.xx).

2) routes from kernel1 protocol has lower preference (10), so routes
from BGP are preferred and you get circular lookups for 10.0.1.1, 10.10.2.1

You could change preference of kernel protocol to say 200 and you
could filter out unwanted routes in BGP export filter.

--
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."