Skip to content

Instantly share code, notes, and snippets.

@aveao
Last active April 10, 2024 11:02
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save aveao/24524caebc2709dd86ba6ea14728def7 to your computer and use it in GitHub Desktop.
Save aveao/24524caebc2709dd86ba6ea14728def7 to your computer and use it in GitHub Desktop.
BIRD 1 and 2 configs for BGP stuffs (HE Tunnelbroker, Vultr etc)
router id [our IPv4];
protocol bgp vultr
{
local as [our ASN];
source address [our IPv4 from vultr];
import all;
export filter {
if net ~ [[the IPv4 block we want to announce]] then accept;
reject;
};
graceful restart on;
multihop 2;
neighbor 169.254.169.254 as 64515;
password "[BGP password given to vultr, up to 16 bytes! (send a ticket if you accidentally gave one that's too long)]";
}
protocol static
{
route [the IPv4 block we want to announce] reject;
}
protocol direct
{
interface "dummy*";
import all;
}
protocol device
{
scan time 5;
}
router id [our IPv4];
protocol bgp he
{
local as [our ASN];
source address [client IP given by HE];
import all;
export filter {
if net ~ [[the IPv6 block we want to announce]] then accept;
reject;
};
graceful restart on;
neighbor [server IP given by HE] as 6939;
}
protocol static
{
route [the IPv6 block we want to announce] reject;
}
protocol direct
{
interface "dummy*";
import all;
}
protocol device
{
scan time 5;
}
router id [our IPv4];
protocol bgp vultr
{
local as [our ASN];
source address [server's IPv6 from vultr];
import all;
export filter {
if net ~ [[the IPv6 block we want to announce]] then accept;
reject;
};
graceful restart on;
multihop 2;
neighbor 2001:19f0:ffff::1 as 64515;
password "[BGP password given to vultr, up to 16 bytes! (send a ticket if you accidentally gave one that's too long)]";
}
protocol static
{
route [the IPv6 block we want to announce] reject;
}
protocol direct
{
interface "dummy*";
import all;
}
protocol device
{
scan time 5;
}
protocol bgp [a name for us to refer to our peer]
{
local as [our ASN];
source address [our IPv6 on wireguard];
import all;
export filter {
if net ~ [[the IPv6 block we want to announce]] then accept;
reject;
};
graceful restart on;
multihop 2;
neighbor [their IPv6 on wireguard] as [their ASN];
}
# Get rid of square brackets.
define OURASN = [our ASN];
define OURIPv6 = [our IPv6];
define OURPASSWORD = "[our password]";
define OURIPv4 = [our IPv4];
log syslog all;
router id OURIPv4;
protocol device {
scan time 5;
}
protocol direct {
interface "dummy*";
ipv6;
}
protocol static {
ipv6;
route [the IPv6 block we want to announce] reject;
}
protocol bgp vultr {
description "Vultr";
local OURIPv6 as OURASN;
neighbor 2001:19f0:ffff::1 as 64515;
multihop 2;
password OURPASSWORD;
ipv6 {
import all;
export filter {
if source ~ [ RTS_DEVICE ]
then accept;
else reject;
};
};
}
#!/bin/bash
ip link add dummy1 type dummy
ip link set dummy1 up
ip -6 addr add [the IPv6 block we want to announce] dev dummy1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment