Ramblings of an aging IT geek
← Ramblings of an aging IT geek
networking

bgp in the homelab, because why not

Running BGP between a router and a couple of hosts at home so that service IPs follow the machine that actually owns them.

A bundle of network cables

There is a special kind of person who runs BGP at home, and I have apparently become one of them. The honest reason is that I was tired of static routes and floating IPs that needed a script to move when a host rebooted. The better reason is that I wanted my service addresses to advertise themselves, so the network learns where a thing lives rather than me telling it.

The setup is small. My router runs FRR, and two Linux hosts also run FRR, peering with the router over a private ASN. Each host advertises a /32 for the services it currently owns. If a host goes away, the route withdraws, and traffic stops being sent into a black hole. That is the whole trick. No keepalived, no gratuitous ARP, no cron job nudging things back into place.

A rack of networking equipment in a small datacentre

A minimal FRR config on a host looks like this:

router bgp 65001
 neighbor 10.0.0.1 remote-as 65000
 address-family ipv4 unicast
  network 10.0.1.10/32
  redistribute kernel
 exit-address-family

The router side peers back with remote-as 65001 and accepts the /32s. I keep prefix lists tight so a misconfigured host can't advertise the whole internet at me, which is exactly the sort of thing I would do at 11pm.

What surprised me was how calm it all is once it's up. vtysh -c 'show ip bgp summary' tells me who's peered and how many prefixes they're sending, and that single view replaced about three half-remembered mental models of where my services were. Failover is genuinely a few seconds, the time it takes the route to withdraw and reconverge.

Is it overkill for a house? Of course it is. But it's the good kind of overkill, the sort that makes the thing simpler to reason about rather than more fragile. I've removed more lines of brittle glue than I added in config, and the network now tells me the truth about itself. For a homelab, that's a fair trade.