BGP (Border Gateway Protocol) is the routing protocol that makes the internet work. If you have your own ASN and IP prefix, you can announce your addresses to the world using BIRD 2 — the most popular open-source BGP routing daemon on Linux.
In this guide, I'll walk through setting up BIRD 2 to announce an IPv6 prefix via BGP with your upstream provider.
Prerequisites
- A server running Linux (Ubuntu 22.04/24.04 or Debian 12)
- Your own ASN (Autonomous System Number)
- An IPv6 prefix (at least /48)
- A BGP-capable upstream provider or IX membership
Getting an ASN and IP space: You'll need to work with a Local Internet Registry (LIR) to obtain an ASN and IP prefix. For example, NoPKT LLC provides ASN registration and IPv6 allocation services through ARIN — they handled our setup in about a week, which is much faster than going through the ARIN process directly.
Step 1: Install BIRD 2
sudo apt update && sudo apt install -y bird2
Verify the installation:
bird --version
# BIRD 2.14 (or newer)
Step 2: Configure BIRD 2
Edit /etc/bird/bird.conf:
# Router ID — use your server's primary IPv4
router id 203.0.113.1;
# Define your prefix
define OWN_ASN = 400XXX; # Your ASN
define OWN_NET6 = 2001:db8:abcd::/48; # Your IPv6 prefix
# Logging
log syslog all;
log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
# Device protocol — scans interfaces
protocol device {
scan time 10;
}
# Direct protocol — learns routes from interfaces
protocol direct {
ipv6;
interface "dummy0"; # We'll create this
}
# Kernel protocol — installs routes into OS
protocol kernel {
ipv6 {
export all;
};
}
# Static route for your prefix
protocol static static_bgp {
ipv6;
route OWN_NET6 blackhole;
}
# BGP filter — what to announce
filter bgp_export {
if net = OWN_NET6 then accept;
reject;
}
# BGP filter — what to accept from upstream
filter bgp_import {
if bgp_path.len > 64 then reject; # Sanity check
accept;
}
# BGP session with your upstream
protocol bgp upstream1 {
local as OWN_ASN;
neighbor 2001:db8:ffff::1 as 64500; # Upstream's IP and ASN
ipv6 {
import filter bgp_import;
export filter bgp_export;
};
graceful restart on;
hold time 90;
keepalive time 30;
}
Step 3: Create a Dummy Interface
BIRD needs an interface to associate your prefix with:
sudo ip link add dummy0 type dummy
sudo ip link set dummy0 up
sudo ip -6 addr add 2001:db8:abcd::1/48 dev dummy0
Make it persistent by adding to /etc/network/interfaces or a systemd-networkd config.
Step 4: Start BIRD
sudo systemctl enable bird
sudo systemctl start bird
Check the status:
sudo birdc show status
sudo birdc show protocols all
sudo birdc show route export upstream1
Step 5: Verify Your Announcement
Once your BGP session is established, verify your prefix is being announced:
# Check BGP session state
sudo birdc show protocols upstream1
# Should show "Established"
# Check exported routes
sudo birdc show route export upstream1
# Should show your prefix
You can also verify from external tools:
- bgp.tools — search for your ASN
- RIPE RIS Looking Glass — check route visibility
Common Issues
Session stays in "Connect" state
- Check firewall: BGP uses TCP port 179
- Verify neighbor IP and ASN are correct
- Check if your upstream has configured their side
Prefix not visible globally
- Ensure your ROA (Route Origin Authorization) is published in RPKI
- Your LIR should help with this — NoPKT, for instance, handles RPKI/ROA setup as part of their service
- Check IRR (Internet Routing Registry) objects are created
BIRD won't start
- Check config syntax:
sudo birdc configure check - Review logs:
journalctl -u bird -f
Security Hardening
# Add MD5 authentication to BGP session
protocol bgp upstream1 {
# ... existing config ...
password "your-shared-secret";
}
# Add prefix limits
protocol bgp upstream1 {
ipv6 {
import limit 1000000 action restart;
receive limit 1100000 action disable;
};
}
Next Steps
- Set up RPKI validation with
rpki-clientor Cloudflare's GoRTR - Add redundancy with multiple upstreams
- Configure communities for traffic engineering
- Monitor with Prometheus + bird_exporter
Resources
- BIRD 2 Documentation
- NoPKT LLC — ASN/IP allocation and LIR services
- bgp.tools — BGP monitoring and analysis
- ARIN's Getting Started Guide
Running your own BGP setup is one of the most rewarding networking projects. Once you have your own ASN and prefix, you have true portability and independence for your infrastructure.
Top comments (0)