Disclosure up front: I run IPYE, a company that leases IP space. This is a practical how-to, and IPYE comes up where it helps, with a short call to action at the end.
BIRD 2 is a common choice for announcing a prefix from a Linux server or VPS. Its configuration is compact, and its filters make it hard to leak routes by accident. This guide announces a leased IPv4 /24 from IPYE to one upstream, with filters strict enough to run in production. The examples use the documentation prefix 198.51.100.0/24, your ASN AS64500, the upstream AS64510 at 192.0.2.1, and your side of the link at 192.0.2.2.
Before you start
You should have:
- The /24 configured with your ASN as origin, so the ROA matches.
- The upstream's confirmation that the prefix has been added to your session filters.
- A BGP session password, if the upstream uses one.
The configuration
/etc/bird/bird.conf:
log syslog all;
router id 192.0.2.2;
define MY_ASN = 64500;
define MY_V4 = [ 198.51.100.0/24 ];
protocol device { }
protocol kernel kernel4 {
ipv4 { export where source = RTS_BGP; import none; };
}
protocol static originate4 {
ipv4;
route 198.51.100.0/24 blackhole;
}
filter upstream_out {
if net ~ MY_V4 && source = RTS_STATIC then accept;
reject;
}
filter upstream_in {
if net.len > 24 then reject;
if net ~ MY_V4 then reject;
accept;
}
protocol bgp upstream4 {
local 192.0.2.2 as MY_ASN;
neighbor 192.0.2.1 as 64510;
password "session-secret";
ipv4 {
import filter upstream_in;
export filter upstream_out;
import limit 1100000 action restart;
};
}
What the important parts do:
- The static blackhole route gives BIRD a route to originate. The more specific routes you add for actual servers win for forwarding, so only unused parts of the /24 hit the blackhole.
-
upstream_outexports only your /24, and only if it came from the static protocol. If someone later adds a second session, or BIRD learns routes from elsewhere, nothing else can leak to this upstream. -
upstream_inrejects prefixes longer than /24 and any route claiming to be your own space. -
import limitrestarts the session if the upstream suddenly sends far more routes than a full table, which protects the box from memory exhaustion. If you only take a default route, set the limit to a small number.
Bring it up
bird -p # parse check
birdc configure
birdc show protocols all upstream4
Look for Established, then check what's being exported:
birdc show route export upstream4
It should list exactly one route, 198.51.100.0/24.
Use addresses from the /24
Put addresses on servers behind this router, or on a loopback if this host is the server:
ip addr add 198.51.100.10/32 dev lo
Outgoing traffic needs to use the new range as its source. If the host also has a provider address, set the source on the default route:
ip route replace default via 192.0.2.1 src 198.51.100.10
Verify from outside
From another network:
ping -c3 198.51.100.10
traceroute 198.51.100.10
Look the prefix up on a public looking glass or route collector, and check the origin AS and the RPKI status. "Valid" means the ROA matches. "Invalid" almost always means the ROA names a different ASN. Fix that in the lease settings before you troubleshoot anything else.
Day-two items
- Add BFD if the upstream supports it, for faster failover.
- Monitor the session state and the export count. An alert on
show route export upstream4 countdropping to 0 catches most outages. - Keep the LOA with your router configuration in version control.
Where to get the prefix
You need a /24 with a ROA that matches your ASN and a LOA your upstream will accept. Leasing a /24 from IPYE gives you both, plus reverse DNS for the range.
Next step
Set your origin ASN on the lease in the IPYE portal, load this config, and check the export with birdc before you put servers on the range.
About IPYE
IPYE leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS, and ASN and region changes apply automatically. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. More at ipye.com. Questions: ipye@turnel.com.
Disclosure: I run IPYE
Top comments (0)