Setting the source IP for routes injected by bird
Good evening, I have seen that the static protocol has the attribute "krt_prefsrc" which seems to fit the source IP as seen by the kernel: [18:44] server120.place15:~# ip route get 2001:4860:4860::8888 2001:4860:4860::8888 from :: via 2001:7f8:24::4a dev eth7 proto bird src 2001:7f8:24::ae metric 32 pref medium On this particular machine bird (?) selected 2001:7f8:24::ae as the source address, which makes sense as it is the only IP address on the interface. However that address is a peering IP address and traffic to it is not forwarded outside of the peering. Now I can easily add another ip address on the interface that is within a prefix that I control, but how do I ensure that the route is changed with another source ip address? I think what I am looking for is something on the line of -------------------------------------------------------------------------------- protocol kernel kernel_v6 { ipv6 { export all; prefsrc ... ; }; } -------------------------------------------------------------------------------- Above obviously has a problem, as the preferred address is different, depending on which device the route is applied to...but as far as I can see bird adds the route, so bird probably also need to set the preferred source? Or is it something better solved in the kernel somehow? Cheers, Nico -- Sustainable and modern Infrastructures by ungleich.ch
I use this with 1.6.x: ==== define MY_LOOPBACK = 2001:db8::1; protocol kernel { debug { states, interfaces }; persist; # Tell BIRD to leave all its routes in the routing tables when it exits (instead of cleaning them up). scan time 10; # Scan kernel routing table every 10 seconds learn; # Learn alien routes from the kernel graceful restart off; # Default is to import all, but be explicit here: import all; # For BGP, set krt_realm based on ASN. # Default is to export none, so be explicit here: export filter { if source = RTS_INHERIT then accept; if source = RTS_BGP then { krt_realm = bgp_path.first; krt_prefsrc = MY_LOOPBACK; accept; } reject; }; } ==== Perhaps adjust for 2.x if that looks good. Chris
Salut Chris, Chris Caputo <ccaputo@alt.net> writes:
define MY_LOOPBACK = 2001:db8::1;
protocol kernel { [...] krt_prefsrc = MY_LOOPBACK; [...] }
this was exactly what I was looking for! I wasn't aware that I can just set krt_prefsrc, that is so nice! Many thanks and greetings from Niederurnen, Nico -- Sustainable and modern Infrastructures by ungleich.ch
participants (2)
-
Chris Caputo -
Nico Schottelius