Route BGP with BIRD
Example Configuration
BIRD 1.x
# This is an example configuration file for BIRD Internet Routing Daemon for demonstration purposes only.
# For production use, you should write your own configuration file suitable for your network topology instead.
# Modified from: https://raw.githubusercontent.com/CZ-NIC/bird/v1.6.8/doc/bird.conf.example
# This is the unique identifier of the router,
# change it to your primary IPv4 address.
router id 192.0.2.1;
# This pseudo-protocol performs synchronization between BIRD's routing
# tables and the kernel. If your kernel supports multiple routing tables
# (as Linux 2.2.x does), you can run multiple instances of the kernel
# protocol and synchronize different kernel tables with different BIRD tables.
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 none; # Default is import all
export all; # Default is export none
}
# This pseudo-protocol watches all interface up/down events.
protocol device {
scan time 60; # Scan interfaces every 60 seconds
}
# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).
protocol static static_bgp {
route 192.0.2.0/24 reject;
}
filter misaka_bgp_out {
if proto = "static_bgp" then accept;
reject;
}
protocol bgp bgp_misaka {
# change it to your own ASN number.
local as 64555;
export filter misaka_bgp_out;
# though we provide full table, it's not really necessary to import all routes
import none;
multihop;
neighbor 100.100.0.0 as 57695;
}
BIRD 2.x
# This is an example configuration file for BIRD Internet Routing Daemon for demonstration purposes only.
# For production use, you should write your own configuration file suitable for your network topology instead.
# Modified from: https://github.com/CZ-NIC/bird/blob/v2.0.7/doc/bird.conf.example
# This is the unique identifier of the router,
# change it to your primary IPv4 address.
router id 192.0.2.1;
# The Kernel protocol is not a real routing protocol. Instead of communicating
# with other routers in the network, it performs synchronization of BIRD
# routing tables with the OS kernel. One instance per table.
protocol kernel {
ipv4 {
# import all; # Import to table, default is import all
export all; # Export to protocol. default is export none
};
# learn; # Learn alien routes from the kernel
# kernel table 10; # Kernel table to synchronize with (default: main)
}
# Another instance for IPv6, skipping default options
protocol kernel {
ipv6 { export all; };
}
# The direct protocol is not a real routing protocol. It automatically generates
# direct routes to all network interfaces. Can exist in as many instances as you
# wish if you want to populate multiple routing tables with direct routes.
protocol direct {
disabled; # Disable by default
ipv4; # Connect to default IPv4 table
ipv6; # ... and to default IPv6 table
}
# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).
protocol static static4_bgp {
ipv4; # Again, IPv4 channel with default options
route 192.0.2.0/24 reject;
}
protocol static static6_bgp {
ipv6;
route 2001:db8::/32 reject;
}
filter misaka_bgp4_out {
if proto = "static4_bgp" then accept;
reject;
}
filter misaka_bgp6_out {
if proto = "static6_bgp" then accept;
reject;
}
protocol bgp bgp4_misaka {
# change it to your own ASN number.
local as 64555;
multihop;
neighbor 100.100.0.0 as 57695;
ipv4 {
# though we provide full table, it's not really necessary to import all routes
import none;
export filter misaka_bgp4_out;
};
}
protocol bgp bgp6_misaka {
# change it to your own ASN number.
local as 64555;
multihop;
neighbor 2a0b:4342:ffff:: as 57695;
ipv6 {
# though we provide full table, it's not really necessary to import all routes
import none;
export filter misaka_bgp6_out;
};
}