<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Routing on Backend Engineering Strategy Tools</title><link>https://backend-engineering-strategy-tools.github.io/site/tags/routing/</link><description>Recent content in Routing on Backend Engineering Strategy Tools</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Thu, 14 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://backend-engineering-strategy-tools.github.io/site/tags/routing/index.xml" rel="self" type="application/rss+xml"/><item><title>BGP</title><link>https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/bgp/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/bgp/</guid><description>&lt;p&gt;BGP (Border Gateway Protocol) is the routing protocol that holds the internet together. Every major network operator uses it to advertise which IP prefixes they own and to exchange that information with peers. In a homelab context the scale is different but the mechanics are the same.&lt;/p&gt;
&lt;p&gt;BGP is a path-vector protocol: each router advertises routes along with the path (sequence of ASNs) taken to reach them. Routers choose the best path based on a set of attributes and policy rules, then advertise that path to their peers.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="ebgp-vs-ibgp"&gt;eBGP vs iBGP
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;eBGP&lt;/strong&gt; (external BGP) — sessions between routers in &lt;em&gt;different&lt;/em&gt; autonomous systems. Each party has a different ASN. This is what you configure between VyOS and OPNsense, and between VyOS and MetalLB.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iBGP&lt;/strong&gt; (internal BGP) — sessions between routers in the &lt;em&gt;same&lt;/em&gt; autonomous system. Used inside large networks to distribute external routes internally. Not relevant for a basic homelab setup.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="asns-for-private-use"&gt;ASNs for private use
&lt;/h2&gt;&lt;p&gt;Autonomous System Numbers in the range &lt;strong&gt;64512–65534&lt;/strong&gt; are reserved for private use (&lt;a class="link" href="https://www.rfc-editor.org/rfc/rfc6996" target="_blank" rel="noopener"
 &gt;RFC 6996&lt;/a&gt;) — the same concept as RFC 1918 private IP addresses. Assign one to each participant in your BGP topology:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Participant&lt;/th&gt;
 &lt;th&gt;Example ASN&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;OPNsense&lt;/td&gt;
 &lt;td&gt;64512&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;VyOS&lt;/td&gt;
 &lt;td&gt;64513&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;MetalLB (Talos cluster)&lt;/td&gt;
 &lt;td&gt;64514&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2 id="why-bgp-for-kubernetes-loadbalancer-ips"&gt;Why BGP for Kubernetes LoadBalancer IPs
&lt;/h2&gt;&lt;p&gt;Kubernetes &lt;code&gt;LoadBalancer&lt;/code&gt; services need something external to the cluster to route traffic to them. In a cloud environment the cloud provider handles this automatically. On bare metal you need to do it yourself.&lt;/p&gt;
&lt;p&gt;Two common approaches with &lt;a class="link" href="https://metallb.universe.tf" target="_blank" rel="noopener"
 &gt;MetalLB&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;L2 mode&lt;/strong&gt; — MetalLB uses ARP (IPv4) or NDP (IPv6) to announce service IPs directly on the LAN. Simple to set up. Limitations: only one node handles traffic for each IP at a time (no real load balancing at the network layer), and the service IP must be in the same subnet as the nodes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a class="link" href="https://metallb.universe.tf/concepts/bgp/" target="_blank" rel="noopener"
 &gt;BGP mode&lt;/a&gt;&lt;/strong&gt; — MetalLB establishes a BGP session with an upstream router (VyOS, for example) and announces service IPs as /32 prefixes. The router learns the route and can ECMP across all nodes that are advertising it. More correct: actual load balancing, no subnet constraint, clean separation between cluster and network layer.&lt;/p&gt;
&lt;p&gt;The tradeoff is that BGP mode requires a BGP-capable router in the path, which is why VyOS exists in this topology.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="testing-with-a-real-bgp-network"&gt;Testing with a real BGP network
&lt;/h2&gt;&lt;p&gt;&lt;a class="link" href="https://dn42.eu" target="_blank" rel="noopener"
 &gt;DN42&lt;/a&gt; is a community-run experimental network that simulates the real internet using actual BGP, DNS, and whois infrastructure. Participants connect via WireGuard or other tunnels and peer with each other using real BGP sessions and real (private-range) ASNs. A good way to practice BGP outside the homelab without needing a production ASN.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="related"&gt;Related
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/vyos/" &gt;VyOS&lt;/a&gt; — the BGP peer router&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://backend-engineering-strategy-tools.github.io/site/homelab/vyos-bgp/" &gt;VyOS + BGP experiment&lt;/a&gt; — the actual setup in this homelab&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>