Setting the source IP for routes injected by bird

Chris Caputo ccaputo at alt.net
Fri Feb 2 19:31:09 CET 2024


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


More information about the Bird-users mailing list