<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bgp on Backend Engineering Strategy Tools</title><link>https://backend-engineering-strategy-tools.github.io/site/tags/bgp/</link><description>Recent content in Bgp 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/bgp/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><item><title>VyOS</title><link>https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/vyos/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/vyos/</guid><description>&lt;p&gt;VyOS is an open-source network operating system built on Debian Linux. It runs on bare metal or as a VM, and is configured via a CLI with a commit/rollback model similar to Juniper JunOS. Configuration changes are staged and only take effect when you explicitly &lt;code&gt;commit&lt;/code&gt; — there is no live-editing a running config and hoping nothing breaks.&lt;/p&gt;
&lt;p&gt;It ships FRRouting (FRR) as the routing engine, giving it native support for BGP, OSPF, IS-IS, and other protocols. This is its main distinction from &lt;a class="link" href="https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/opnsense/" &gt;OPNsense&lt;/a&gt; for homelab use: OPNsense is a firewall appliance that can do some routing; VyOS is a routing OS that can also do firewall.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="configuration-model"&gt;Configuration model
&lt;/h2&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;vyos@router# set interfaces ethernet eth0 address &amp;#39;192.168.1.254/24&amp;#39;
vyos@router# set protocols bgp system-as &amp;#39;65001&amp;#39;
vyos@router# commit
vyos@router# save
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;configure&lt;/code&gt; enters configuration mode. &lt;code&gt;set&lt;/code&gt; stages a change. &lt;code&gt;commit&lt;/code&gt; applies it. &lt;code&gt;save&lt;/code&gt; persists it to disk. &lt;code&gt;rollback&lt;/code&gt; reverts to the last committed state if something goes wrong. The separation between staging and applying is genuinely useful when changing routing configuration remotely.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="key-features"&gt;Key features
&lt;/h2&gt;&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Feature&lt;/th&gt;
 &lt;th&gt;Notes&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;BGP&lt;/td&gt;
 &lt;td&gt;Via FRRouting; full eBGP/iBGP support&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;OSPF / IS-IS&lt;/td&gt;
 &lt;td&gt;Also via FRR&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Static routing&lt;/td&gt;
 &lt;td&gt;Standard&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;VLAN&lt;/td&gt;
 &lt;td&gt;802.1Q trunking&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;NAT&lt;/td&gt;
 &lt;td&gt;Source and destination NAT&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Firewall&lt;/td&gt;
 &lt;td&gt;Zone-based, stateful&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;WireGuard&lt;/td&gt;
 &lt;td&gt;Built-in&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;OpenVPN&lt;/td&gt;
 &lt;td&gt;Built-in&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;DHCP server&lt;/td&gt;
 &lt;td&gt;Built-in&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;VXLAN&lt;/td&gt;
 &lt;td&gt;Supported&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2 id="vyos-vs-opnsense"&gt;VyOS vs OPNsense
&lt;/h2&gt;&lt;p&gt;VyOS is the right choice when you want a dedicated BGP peer or a router VM with a clean CLI config model. OPNsense is the right choice when you want a full gateway appliance with a web UI.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="automation"&gt;Automation
&lt;/h2&gt;&lt;p&gt;VyOS is designed to be automated — the commit/rollback model maps cleanly onto infrastructure-as-code workflows.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;REST API&lt;/strong&gt; — built-in HTTP API for retrieving and applying configuration programmatically. Useful for scripting config changes without SSH.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ansible&lt;/strong&gt; — official &lt;code&gt;vyos.vyos&lt;/code&gt; collection on Ansible Galaxy. Modules for interfaces, BGP, firewall rules, and more. Changes go through the normal commit/rollback cycle.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Terraform&lt;/strong&gt; — community provider available. Less mature than the Ansible collection but usable for provisioning router config alongside other infrastructure.&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://docs.vyos.io/" target="_blank" rel="noopener"
 &gt;VyOS documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://docs.vyos.io/en/latest/automation/vyos-api.html" target="_blank" rel="noopener"
 &gt;VyOS REST API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://docs.ansible.com/ansible/latest/collections/vyos/vyos/index.html" target="_blank" rel="noopener"
 &gt;VyOS Ansible collection&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://vyos.net/get/" target="_blank" rel="noopener"
 &gt;VyOS rolling release downloads&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/bgp/" &gt;BGP&lt;/a&gt; — protocol background&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://backend-engineering-strategy-tools.github.io/site/public-notes/networking/opnsense/" &gt;OPNsense&lt;/a&gt; — the complementary edge gateway&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 in the homelab&lt;/a&gt; — the actual setup&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>