<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Armel de Marsac on Medium]]></title>
        <description><![CDATA[Stories by Armel de Marsac on Medium]]></description>
        <link>https://medium.com/@armeldemarsac?source=rss-fb8fcc98e7dd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gUIkj5dt8CXE6z2wvXBhtA.png</url>
            <title>Stories by Armel de Marsac on Medium</title>
            <link>https://medium.com/@armeldemarsac?source=rss-fb8fcc98e7dd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:35:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@armeldemarsac/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building my own private cloud #3 - One public IP, multiple tenants]]></title>
            <link>https://medium.com/@armeldemarsac/building-my-own-private-cloud-3-one-public-ip-multiple-tenants-7b2b2362af32?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b2b2362af32</guid>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[ecmp]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 14:25:33 GMT</pubDate>
            <atom:updated>2026-06-02T14:25:33.621Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building my own private cloud #3: One public IP, multiple tenants</h3><h3>The public IP constraint</h3><p>At this point, internal tenant networking is mostly solved.</p><p>Alice can create a private network. Bob can create another one. Both can use overlapping private ranges, and OpenStack can keep those networks separated.</p><p>The problem starts when someone wants to expose a service to the internet.</p><p>A private network is useful for applications, databases, backend services, monitoring agents, and everything that should not be reachable by random people on the internet. But eventually, someone wants to expose something: a website, an API, an SSH endpoint, or a side project that started as “just a quick test” and now somehow needs TLS.</p><p>This is where the old IPv4 problem comes back.</p><p>IPv4 addresses are 32 bits long, which gives a bit more than four billion possible addresses. That was not enough for a world full of computers, phones, servers, cameras, TVs, routers, light bulbs, toothbrushes, and other devices that apparently all need network access.</p><p>The workaround most people use every day is NAT.</p><p>At home, my laptop, phone, and suspicious connected toothbrush usually have private IP addresses, often in a range like:</p><pre>192.168.1.0/24</pre><p>When one of them opens a connection to the internet, my router replaces the private source address with its own public IPv4 address. It also keeps track of the connection, so when the reply comes back, it knows which internal device should receive it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*IeMvKvV1XQEkOyMP.jpg" /><figcaption>Natting illustrated.</figcaption></figure><p>For outgoing traffic, this works well. Many devices can share one public IPv4 address because the router knows which device started each connection.</p><p><strong>Ingress is more annoying.</strong></p><p>If someone from the internet starts a new connection toward my public IP, the router has to decide where to send it. With one service, this is easy enough:</p><pre>443 -&gt; my web server<br>22  -&gt; my SSH box</pre><p>With multiple tenants, it gets messy.</p><p>Alice wants SSH to her VM. Bob wants SSH to his VM. Alice wants to expose a website. Bob wants to expose one too. Another tenant wants a raw TCP service because apparently HTTP was too convenient.</p><p>In a normal public cloud, the provider can hand out real public floating IPs. In my homelab, OpenStack can create floating IP objects, but it cannot invent public IPv4 addresses.</p><p>So the question becomes:</p><p>How do I expose several tenant services through one public IPv4 address?</p><h3>First option: Cloudflare Tunnel</h3><p>The easiest answer is to avoid exposing my edge directly.</p><p>With Cloudflare Tunnel, a tunnel is established from inside my infrastructure to Cloudflare. Public traffic reaches Cloudflare first, then Cloudflare forwards it through the tunnel to my services.</p><p>This is convenient. I do not need to expose my home connection in the same way, and Cloudflare already knows how to handle hostnames, TLS, and HTTP routing.</p><p>The tradeoff is that Cloudflare becomes part of the critical path. If their service is down, if pricing changes, if I hit limits, or if I simply do not want tenant traffic to depend on a third party, the design becomes less attractive.</p><p>Cloudflare Tunnel is good.</p><p>It is just not the core design I want for this project.</p><h3>Second option: IPv6</h3><p>IPv6 is the cleaner answer from a networking point of view.</p><p>With enough globally routable IPv6 addresses, each VM could have its own public address. No need to make many services share one IPv4 address. No awkward port-sharing tricks. Each service can have its own address, and firewall rules decide what is reachable.</p><p>That is the model I would prefer.</p><p>The problem is adoption.</p><p>IPv6 support is much better than it used to be, but the internet is still not fully IPv6-only. Some clients, networks, providers, and corporate environments still have partial or missing IPv6 connectivity.</p><p>If I rely only on IPv6, some users will not be able to reach the services.</p><p>So IPv6 is probably part of the long-term answer, but I still need a good IPv4 ingress story.</p><h3>Third option: a VPS edge</h3><p>The third option is to use a small VPS as the public edge.</p><p>The VPS has the real public IPv4 address. Public traffic reaches it first. My OpenStack cluster stays private behind it, reachable through WireGuard tunnels.</p><p>The rough shape is:</p><pre>internet<br>  -&gt; VPS edge with public IPv4<br>  -&gt; WireGuard tunnels<br>  -&gt; OpenStack provider network<br>  -&gt; tenant floating IP<br>  -&gt; tenant VM</pre><p>The VPS becomes the public door. The OpenStack cluster remains private.</p><p>This gives each layer a clear role:</p><pre>VPS edge      -&gt; public ingress<br>WireGuard     -&gt; private transport<br>BGP / ECMP    -&gt; reachability and path selection<br>OpenStack     -&gt; tenant networking and floating IP NAT<br>Reverse proxy -&gt; hostname-based routing for web services</pre><p>For web traffic, this works especially well because requests usually carry something useful: a hostname.</p><h3>Web traffic gives us hostnames</h3><p>When a browser connects to a website, it is not only trying to reach an IP address. It is trying to reach a hostname.</p><p>With plain HTTP, the requested domain appears in the Host header.</p><p>With HTTPS, the HTTP request is encrypted once TLS is established, so the proxy cannot read the Host header unless it terminates TLS. But the hostname is usually visible earlier in the TLS handshake through SNI.</p><p>That means an edge proxy can listen on ports 80 and 443, look at the requested hostname, and decide which backend should receive the connection.</p><p>For example:</p><pre>alice.apps.mycloud.net -&gt; Alice&#39;s service<br>bob.apps.mycloud.net   -&gt; Bob&#39;s service</pre><p>Both names can point to the same public IPv4 address, while the reverse proxy sends them to different internal services.</p><p>That is the useful trick:</p><pre>one public IP outside<br>many hostnames outside<br>many private floating IPs inside</pre><p>This is also where DNS becomes important.</p><p>And where letting tenants freely manage records starts to look like a future support problem.</p><h3>Why I do not let tenants manage DNS records directly</h3><p>At first, OpenStack Designate looks like the obvious answer.</p><p>Designate is OpenStack’s DNS service. It lets users create DNS zones and records through the OpenStack API instead of asking an administrator to create them by hand.</p><p>That sounds perfect:</p><pre>Alice creates a DNS record<br>Bob creates a DNS record<br>the edge resolves those records<br>traffic reaches the right floating IP</pre><p>Except DNS is a shared namespace.</p><p>If Alice creates:</p><pre>api.apps.mycloud.net</pre><p>and Bob also wants:</p><pre>api.apps.mycloud.net</pre><p>someone has to win.</p><p>Even if Designate prevents exact duplicates, I still need rules. Who can create which name? Are some names reserved? What happens when a project is renamed? What if someone creates a confusing name, forgets to delete a record, or uses something that looks too much like a platform endpoint?</p><p>I do not want tenants to think about that.</p><p>In this design, tenants should manipulate cloud objects. They should allocate a floating IP, attach it to a VM, and expose a service. They should not have to manage backend DNS records in a shared internal namespace.</p><p>The platform should generate those records.</p><p>That is why I created <a href="https://github.com/armeldemarsac92/openstack-fip-dns-reconciler">a small reconciler</a>.</p><h3>Floating IPs as the source of truth</h3><p>The design decision is simple:</p><pre>Neutron floating IPs are the source of truth.<br>Designate records are generated state.</pre><p>A tenant allocates a floating IP in OpenStack. The reconciler observes the Neutron floating IP inventory and creates the DNS record the edge needs.</p><p>The tenant does not choose the backend DNS name. The platform generates it.</p><p>The flow becomes:</p><pre>Neutron floating IPs<br>  -&gt; openstack-fip-dns-reconciler<br>  -&gt; Designate recordsets<br>  -&gt; edge resolver / HAProxy / SSH gateway</pre><p>The object the tenant understands is still the floating IP. DNS is just the platform’s way of making that floating IP discoverable by the edge.</p><p>In other words:</p><pre>tenant action:<br>  allocate floating IP<br><br>platform reaction:<br>  generate safe DNS name<br>  create or update Designate record<br>  expose that name to the edge</pre><p>That is not fancy automation for the sake of it. It removes an entire class of naming and cleanup problems.</p><h3>Generated names instead of tenant-chosen names</h3><p>The reconciler generates DNS names using a controlled format.</p><p>A typical internal record can look like this:</p><pre>&lt;random-label&gt;.&lt;dns-safe-project-id&gt;.fip.internal.mycloud.net. A &lt;floating-ip-address&gt;</pre><p>For example:</p><pre>x7k9m2q4pa.8ab1c22f.fip.internal.mycloud.net. A 10.50.0.42</pre><p>The random label avoids collisions between floating IPs. The project label keeps the name tied to a tenant context. The floating IP address is the internal OpenStack provider-network address.</p><p>The tenant does not need to pick any of this.</p><p>For a purely internal resolver, this nested name is fine. For public HTTP hostnames, I may use a slightly different template:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net</pre><p>The reason is practical: wildcard TLS certificates are usually easier with one label under the wildcard zone.</p><p>A certificate for:</p><pre>*.apps.mycloud.net</pre><p>matches:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net</pre><p>It does not generally match:</p><pre>x7k9m2q4pa.8ab1c22f.apps.mycloud.net</pre><p>because that has an extra label.</p><p>So the exact template can change depending on whether the generated name is internal-only or also meant to be used publicly. The policy stays the same: the platform generates the backend name, and tenants do not claim arbitrary names in the shared zone.</p><p>If a tenant wants a nicer name later, they can point their own domain to the generated name with a CNAME, or I can build a controlled alias system. But the backend mapping remains platform-managed.</p><h3>Public DNS outside, generated DNS inside</h3><p>Now we can put the DNS pieces together.</p><p>The public DNS view stays simple:</p><pre>*.apps.mycloud.net -&gt; edge public IPv4</pre><p>So when a user opens:</p><pre>https://x7k9m2q4pa-8ab1c22f.apps.mycloud.net</pre><p>their browser resolves the name publicly and gets the VPS address.</p><p>The browser connects to the edge. The reverse proxy receives the request and sees the requested hostname. Now the edge needs to know where that hostname lives internally.</p><p>On the edge, I can run a local resolver such as Unbound. For the tenant application zone, Unbound does not ask the public internet. It forwards the query to the OpenStack DNS stack where the reconciler generated the records.</p><p>So the same name can have two different answers depending on who asks.</p><p>From the public internet:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net -&gt; edge public IPv4</pre><p>From the edge:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net -&gt; 10.50.0.42</pre><p>The public answer gets users to the edge. The private answer gets the edge to the tenant floating IP.</p><p>The edge is not trusting tenant-written DNS state. It is consuming platform-generated DNS state.</p><p>That is a much cleaner boundary.</p><h3>Linking the edge to the cluster</h3><p>DNS can now tell the edge which floating IP to use, but the edge still needs a route to reach it.</p><p>In my setup, floating IPs live in an OpenStack provider network:</p><pre>10.50.0.0/24</pre><p>These are not public IPv4 addresses. Only my infrastructure can route to them.</p><p>The simplest version would be one WireGuard tunnel between the VPS edge and one OpenStack node. That would work, but it would also make that node the only entry point into the cluster. If the node or tunnel goes down, ingress breaks.</p><p>So instead, I created one WireGuard tunnel per OpenStack node:</p><pre>edge VPS -&gt; node 1<br>edge VPS -&gt; node 2<br>edge VPS -&gt; node 3</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqFO-5cSMQoL84Q57NtmTg.png" /><figcaption>A simplified view of the wireguard setup.</figcaption></figure><p>Once the tunnels exist, the edge needs to know how to reach the OpenStack provider network. This is where FRR and BGP come in.</p><p>The edge VPS runs FRR. Each OpenStack node also runs FRR with BGP enabled. The nodes establish BGP sessions with the edge and advertise that the provider network is reachable through their WireGuard tunnel.</p><p>For example:</p><pre>10.50.0.0/24 is reachable through node 1<br>10.50.0.0/24 is reachable through node 2<br>10.50.0.0/24 is reachable through node 3</pre><p>From the edge’s point of view, the same destination is reachable through several next hops.</p><p>If those routes have the same cost, Linux can install them as equal-cost routes and use ECMP to spread flows across the tunnels.</p><p>ECMP is not application-level load balancing. It does not know about tenants, hostnames, HTTP requests, or OpenStack projects. It usually hashes flows, so one TCP connection stays on one path, while many connections tend to spread across the available tunnels.</p><p>If one node or tunnel goes down, its BGP route disappears and traffic uses the remaining paths.</p><p>BGP route propagation happens continuously in the background. It is not tied to each HTTP request.</p><h3>The request flow</h3><p>With all the pieces in place, the full request flow looks like this.</p><p>Alice allocates a floating IP in OpenStack:</p><pre>10.50.0.42</pre><p>The reconciler sees that floating IP in Neutron and generates a DNS record:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net -&gt; 10.50.0.42</pre><p>Public DNS has a wildcard record:</p><pre>*.apps.mycloud.net -&gt; edge public IPv4</pre><p>A user opens:</p><pre>https://x7k9m2q4pa-8ab1c22f.apps.mycloud.net</pre><p>Their browser resolves the name publicly and connects to the edge on port 443.</p><p>The reverse proxy terminates TLS, reads the requested hostname, and asks the local resolver where that hostname should go internally. The local resolver forwards the query to the internal DNS stack managed by Designate.</p><p>Designate has the record generated by the reconciler:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net -&gt; 10.50.0.42</pre><p>The reverse proxy opens a backend connection to:</p><pre>10.50.0.42</pre><p>The edge already has BGP-learned routes to:</p><pre>10.50.0.0/24</pre><p>Linux selects one of the available WireGuard tunnels through ECMP. The packet crosses the tunnel, reaches one OpenStack node, and is forwarded toward the provider network.</p><p>In my setup, the selected node can SNAT the connection to its own provider-network address before sending it to the floating IP. This keeps the return path simple, because the reply naturally goes back through the node that handled the ingress path.</p><p>OpenStack networking then applies the floating IP NAT and delivers the request to the tenant VM.</p><p>From the user’s point of view, they reached a normal HTTPS URL. From Alice’s point of view, her VM received traffic through its OpenStack floating IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lt0DO8PWaJz3ibWhvt7C9w.png" /><figcaption>BPG route propagation happens continuously in the background and is not tied to the requests flow. It’s shown here to illustrate the source of the routing informations.</figcaption></figure><h3>This mostly solves HTTP and HTTPS</h3><p>There is one important limitation: hostname routing works well for HTTP and HTTPS, but it is not a universal solution for every TCP service.</p><p>If Alice wants SSH to her VM and Bob also wants SSH to his VM, they cannot both own:</p><pre>edge-public-ip:22</pre><p>A raw SSH connection does not start with an HTTP Host header. It also does not use TLS SNI by default.</p><p>So for SSH and other raw TCP services, I need a different model:</p><pre>SSH gateway / bastion<br>per-tenant or per-VM assigned ports<br>VPN access<br>ProxyJump<br>protocol-specific routing</pre><p>The generated DNS records are still useful. An SSH gateway, monitoring system, HAProxy map, or script can use them to find tenant floating IPs internally.</p><p>But the public exposure model is protocol-dependent.</p><p>For web traffic, hostnames give me a clean routing key. For raw TCP, I need ports, a gateway, a VPN, SNI-capable protocols, or another access pattern.</p><p>So this design does not solve all ingress forever. It solves the most common case: exposing many HTTP and HTTPS tenant services through one public IPv4 address.</p><h3>The SNAT tradeoff</h3><p>There is another practical detail in the request flow: SNAT.</p><p>SNAT makes the return path easier. If the selected OpenStack node sends traffic to the floating IP using its own provider-network address as the source, the reply naturally comes back to that node.</p><p>That avoids asymmetric routing surprises.</p><p>The tradeoff is that the tenant VM may not see the real client IP at the TCP layer. It may see the edge, the proxy, or the ingress node address instead.</p><p>For HTTP and HTTPS, this is usually manageable because the reverse proxy can pass the original client IP using headers like:</p><pre>X-Forwarded-For<br>X-Real-IP<br>Forwarded</pre><p>The backend must only trust those headers from the proxy. If random clients can send their own X-Forwarded-For and the application believes them, congratulations, you have built a small lie acceptance machine.</p><p>For raw TCP, preserving client identity is more protocol-specific. Some services support the PROXY protocol. Some do not.</p><p>Again, the design is cleanest for web traffic.</p><h3>Conclusion</h3><p>The IPv4 constraint does not disappear. I still have one public address, but I can use it as an entry point instead of trying to give one address to every tenant service.</p><p>Public DNS sends traffic to the edge:</p><pre>*.apps.mycloud.net -&gt; edge public IPv4</pre><p>Behind the edge, tenants allocate OpenStack floating IPs, and the platform generates DNS names for them:</p><pre>x7k9m2q4pa-8ab1c22f.apps.mycloud.net -&gt; 10.50.0.42</pre><p>The edge resolves those names internally, reaches the provider network through WireGuard, uses BGP-learned routes to select an available path, and lets OpenStack deliver the traffic to the right tenant VM.</p><p>The key part is that DNS is no longer something tenants edit by hand. Floating IPs remain the source of truth, and DNS becomes generated state. That avoids naming collisions, stale records, and the usual “who owns this name?” problems that come with a shared DNS namespace.</p><p>I built the reconciliation step as a small project here: <a href="https://github.com/armeldemarsac92/openstack-fip-dns-reconciler">openstack-fip-dns-reconciler</a> and the edge setup as an ansible playbook here: <a href="https://github.com/armeldemarsac92/edge_ingress">edge-vps-playbook</a>.</p><p>It watches Neutron floating IPs and maintains the corresponding Designate records automatically, so the edge always has a predictable DNS view to consume.</p><p>The final model is simple enough to reason about: tenants allocate floating IPs, the platform generates DNS, and the edge routes traffic using that generated state.</p><p>One public IP, private floating IPs behind it, and fewer DNS problems to debug later.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b2b2362af32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building my own private cloud #2 — From three servers to an OpenStack cluster]]></title>
            <link>https://medium.com/@armeldemarsac/building-my-own-private-cloud-2-from-three-servers-to-an-openstack-cluster-1dc386cfbdea?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dc386cfbdea</guid>
            <category><![CDATA[openstack]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[private-cloud]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 14:23:35 GMT</pubDate>
            <atom:updated>2026-06-02T15:37:07.832Z</atom:updated>
            <content:encoded><![CDATA[<p>If you followed the first part, you know I managed to get my three-node cluster running. At this point I had three machines, 96 CPU cores, 384 GB of RAM, a shared watercooling loop, and enough cables to make the setup look slightly more serious than it probably is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*y_MLvyOt6eje3HhB" /><figcaption>That is nice, but a few machines do not make a cloud.</figcaption></figure><p>If I only wanted to host my own services, I could keep things fairly simple: install Linux, run a few containers or VMs, put a reverse proxy in front, expose a few ports, and slowly accept that reading logs is now part of my personality.</p><p>The reason I wanted to go further is that I did not want this infrastructure to be only for me. I wanted to share some of that compute with friends. Maybe someone wants to host a small website, run an API, test an application, or deploy some weird open-source project. Maybe even you, dear reader, assuming your project is cool and does not secretly mine Monero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*MFr7PXFWlAq5IblV" /><figcaption>Not me casually checking my tenants CPU usage curve</figcaption></figure><p>At first, this sounds like a simple hosting problem. I have servers, other people need servers, so why not give them some space?</p><p>But the moment other people start using the same machines, the question changes. I do not only need to run workloads. I need to let people use my servers without giving them control over my servers.</p><h3>Why the hell use OpenStack?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*g5-or3Ve_mvcZR56.jpg" /></figure><p>I know, using OpenStack in a homelab sounds ridiculous. To be honest it kinda is.</p><p>OpenStack is a set of services used to build cloud platforms. It can manage virtual machines, networks, storage, images, users, permissions, and a lot of other things you would usually expect to find in a datacenter rather than in a small rack sitting in someone’s room.</p><p>OVH uses OpenStack. Telecom companies use OpenStack. It was built for environments much larger than my three little nodes, so the obvious question is why I would bother with it here.</p><p><strong>The answer is that running a virtual machine is not the difficult part.</strong></p><p>We have had hypervisors for a long time. I could install KVM, libvirt, Proxmox, or something simpler and get a VM running without bringing a full cloud platform into the story.</p><p><strong>The difficult part is sharing the platform properly.</strong></p><p>If a friend runs something on my machines, I do not want their project to be able to interfere with mine. If someone exposes an admin panel by mistake, installs a compromised dependency, or gets hit by a remote code execution vulnerability, I do not want every other hosted project to become collateral damage.</p><p>And if someone needs storage, networking, firewall rules, or public access, I do not want to manually configure everything for them every time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Q0Pzbx-JXeAqUQCH" /><figcaption>Bad tenant separation pictured.</figcaption></figure><p>The most important line is root access.</p><p>A lot of useful infrastructure operations eventually require privileges on Linux. Creating bridges, changing firewall rules, attaching storage, configuring routes or exposing services are not things you normally let an unprivileged user do directly on a host.</p><p>But if I give people sudo access on the physical nodes, the isolation model is basically gone.</p><p>It is not that I do not trust my friends. It is that trust is not a very good security boundary. A shared platform needs actual separation. Each user should have their own space, and mistakes inside one project should not automatically become everybody else’s problem.</p><p><strong>This is where OpenStack starts to make sense.</strong></p><p>It gives users a way to manage infrastructure resources without touching the physical machines directly. Instead of giving Alice SSH access to a node, I can give her access to an OpenStack project. To her it will feel just like any cloud provider’s console with IAM, networks, compute, container management, etc.</p><p>Inside that project, she can create VMs, attach storage, create private networks, and define security rules. She does not need to know which physical node runs the VM or which Linux bridge is involved.</p><p>I keep control of the machines, while she gets enough autonomy to run her project.</p><h3>A quick tour of OpenStack</h3><p>OpenStack is not one big program. It is a collection of services that work together.</p><p>Nova manages compute, so it is the part involved when you create a virtual machine. Keystone manages identity, users, projects, roles and tokens. Glance manages images, such as the Ubuntu or Debian image used to boot a VM. Cinder manages block storage. Neutron manages networking.</p><p>There are more services, but those are enough to understand the basic idea.</p><p>A user asks OpenStack for a resource through an API, a CLI, or a dashboard. OpenStack checks whether the user is allowed to do it, then asks the right service to make it happen.</p><p>For example, I can create a project for Alice and another one for Bob. Alice can create her own instances, volumes and networks inside her project. Bob can do the same inside his.</p><p>Their VMs may physically run on the same nodes, but OpenStack keeps the resources logically separated.</p><p>For compute, the idea is easy to picture. A VM gives each user something that behaves like their own machine. For storage, the idea is also fairly straightforward: a volume belongs to a project and can be attached to an instance.</p><p>Networking is where things become more subtle, because a useful VM almost always needs to talk to something else.</p><p>I wrote <a href="https://medium.com/@armeldemarsac/a-network-inside-the-network-virtual-networking-explained-e1cefcb9b862">a separate piece</a> about virtual networking, overlays, Geneve, OVN and Open vSwitch, because that subject quickly becomes its own rabbit hole. For this build log, the important part is simpler: OpenStack needs a physical network layout that can support the different kinds of traffic a cloud platform creates.</p><p>And that is where my original “just plug the machines together” plan started to look a bit optimistic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M0RDVmhC6GvZmryO" /><figcaption>Me realizing I still had to buy multiple switches and networking cards to get Openstack running.</figcaption></figure><h3>Deploying it with Kolla-Ansible</h3><p>Choosing OpenStack is one thing. Installing it by hand is another.</p><p>OpenStack is not a single daemon you install, enable, and forget. It is a collection of services, databases, message queues, APIs, agents and configuration files that all need to agree with each other. Doing that manually is possible, in the same way that assembling furniture without looking at the manual is possible. Sometimes it works. Sometimes you end up staring at a remaining screw and wondering which part of reality it was supposed to hold together.</p><p>For this reason, I decided to deploy OpenStack with <a href="https://docs.openstack.org/kolla-ansible/latest/">Kolla-Ansible</a>.</p><p>Kolla-Ansible takes the OpenStack services and deploys them as containers, using Ansible to generate the configuration and place everything where it needs to be. That does not make OpenStack simple, but it makes it much more manageable. Instead of treating every service as a handcrafted snowflake, the deployment becomes something described in inventories, configuration files and playbooks.</p><p>That mattered a lot for this project. I did not want a one-off install that only worked because I had spent three nights manually editing files until the errors stopped moving. I wanted something I could understand, repeat, break, fix, and eventually document.</p><p>The other important decision was to replicate the control plane across the three nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*6o_as5pw86ClsDOS.jpg" /><figcaption>Very elegant until the control plane dies.</figcaption></figure><p>In a small homelab, the tempting option would be to make one node the controller and let the others run workloads. That is simpler to picture, but it also creates an obvious weak point. If the controller node goes down, the platform may keep some existing workloads alive, but the cloud itself becomes much less usable. APIs, scheduling, identity, networking control and other management services all depend on the control plane being available.</p><p>So instead of having one special machine acting as the brain of the cluster, I wanted the three nodes to participate in the control plane.</p><p>That does not mean failures become irrelevant. This is still a homelab, not a hyperscaler availability zone with people in matching polo shirts guarding redundant power feeds. But it does mean the platform is not designed around a single obvious point of failure from the start.</p><p>The control services can be spread across the nodes, the API layer can be made redundant, and the cluster starts to look more like a small cloud platform rather than one pet server surrounded by two assistants.</p><p><strong>This choice also made the network layout more important.</strong></p><p>If the control plane is replicated, the nodes need to talk to each other reliably. Databases, message queues, APIs, agents, networking services and storage traffic all start crossing the cluster. At that point, “they are all plugged into the same switch” is not a very satisfying network design.</p><p>This is where the hardware and the software choices started to meet. OpenStack could give me the cloud model I wanted, and Kolla-Ansible could make the deployment manageable. But the physical network still had to give all those services clean paths to communicate.</p><h3>Giving OpenStack what it needs</h3><p>I’ll admit it: when building the server, networking initially felt like an afterthought.</p><p>The first article was mostly about the machines themselves: the nodes, the rack, the custom loop, the cables, the cooling, and the general feeling of having built something that should probably not live in a normal room.</p><p>But when I started planning the OpenStack deployment, I realized the network could not stay vague.</p><p>OpenStack is not just a VM launcher. It has APIs, databases, message queues, storage traffic, overlay traffic, external networks, tenant networks and administrative access. Some of that traffic is boring but critical. Some of it is bandwidth-heavy. Some of it should be kept away from the rest for security or reliability reasons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*VUtEnFrZOyWOqXgB.jpg" /><figcaption>Openstack documentation goin’ through the three PHDs needed to spin a single VM.</figcaption></figure><p>If the hardware is the body of the cloud, the network is the nervous system. Which is annoying, because nervous systems are famously less fun to debug than watercooling tubes.</p><p>Each of my nodes had one PCIe x16 slot free. I could have kept that slot for a GPU, but GPU prices are ridiculous, and for the kind of AI inference experiments I care about, Apple Mac minis are frankly much more tempting from a performance-per-watt perspective so I decided to use that PCIe slot for networking instead.</p><p><strong>A dedicated SFP card made sense for a few reasons.</strong></p><p>First, virtual networking can benefit from better network hardware and offload features. Second, the embedded RJ45 port on the motherboard was not the kind of interface I wanted to rely on for all the heavy internal traffic. Especially given the fact it’s from Realtek, a brand known for a lot things but not reliability at scale. Third, SFP modules are generally much cooler than RJ45 at similar speeds, and my rack is dense enough that I cannot casually add another heat source to every node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/0*t6CaCRfhO_e_jVFi.jpg" /></figure><p>Also, using several physical interfaces gives me more room to separate traffic properly. Everything can still be logically segmented with VLANs, but it is nice not to push every single kind of traffic through the same small pipe.</p><p><strong>Finding the right cards was its own small quest.</strong></p><p>At first, I looked at Intel X520 and X710 cards. They were well-known options, but the prices were not exactly comforting. I found dual-port X710 cards for more than 200 euros from sellers I did not really know, which is not the kind of shopping experience that fills me with confidence.</p><p><strong>Then someone suggested I look at Mellanox.</strong></p><p>Mellanox is a networking company now owned by Nvidia, and their cards are very common in datacenter and homelab circles. After some searching, I found three refurbished Mellanox ConnectX-4 LX cards for about 160 euros total. Each card came with two 25 Gb/s SFP ports, which gives me room to upgrade the backbone later if I want to.</p><p>The only issue was that is a server card. Made for server airflow. That led me down another rabbit hole: designing a custom shroud to handle the card’s cooling. It worked so well the card doesn’t go above 50 degrees celsius, a victory considering how warm these can get. You can find the free 3D files <a href="https://www.printables.com/model/1715543-mellanox-connectx-4-lx-shroud">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8bL-CKtbIGpBJRc2owwew.png" /><figcaption>The custom shroud, printed in clear PETG. Pretty happy with the result.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GgBZ3ak6SjwgcmAwEx2rmg.png" /><figcaption>Once in the node’s chassis.</figcaption></figure><p>For now, I kept things more reasonable and used a 4-port MikroTik SFP+ switch for the SFP side of the setup.</p><p>The idea was simple: the SFP fabric would carry the heavier cloud traffic, while the embedded RJ45 interfaces would keep a separate path for management and some internal traffic.</p><p>For management and SSH access, I used the 2.5 GbE interface embedded in the boards. Those ports connect to my backbone switch, a small 10-inch MikroTik switch with sixteen 1 GbE ports and two SFP+ uplinks. The SFP+ switch connects back into that backbone, and the backbone links upstream toward the rest of my network using the spare SFP+ port.</p><p>This gives me a layout that is still small enough for a homelab, but not completely flat. OpenStack gets multiple lanes instead of one big undefined LAN where every packet goes to meet every other packet and politely ask what it is doing here.</p><h3>Splitting the cloud into VLANs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*gEdqDUywppVlw9DN" /><figcaption>Me discovering that not every packet has to live in the same sad flat LAN.</figcaption></figure><p>Once the cards and switches were in place, I still had to decide what would actually run on that network.</p><p>OpenStack does not only need “network access”. It needs several kinds of traffic to coexist without all landing in the same place. There is management traffic, internal control traffic, storage traffic, migration or replication traffic, and the provider network used by Neutron to expose floating IPs.</p><p>I did not want everything mixed on the same flat network. That would probably work for a quick test, but the goal was not just to boot a VM once and call it a private cloud. I wanted a setup that made sense structurally.</p><p>So I split the network into six VLANs.</p><pre>VLAN 10  → management / SSH / administration<br>VLAN 20  → OpenStack internal traffic<br>VLAN 30  → storage traffic<br>VLAN 40  → Neutron internal / tenant overlay traffic<br>VLAN 50  → Neutron provider / external network / floating IPs<br>VLAN 60  → upstream LAN / outside access</pre><p>The first two VLANs live on the RJ45 interface.</p><p>VLAN 10 is the management network. This is the boring but extremely important one: SSH access, administration, and the path I want to keep working even when I inevitably break something more interesting. When experimenting with OpenStack networking, having a separate way back into the hosts is not luxury. It is self-preservation.</p><p>VLAN 20 is used for OpenStack internal traffic. This is where the platform can have a separate internal network for services that should not be confused with tenant-facing traffic or external access. OpenStack has enough moving parts that keeping the internal side explicit makes the setup easier to reason about.</p><p>The SFP side carries the traffic that benefits more from bandwidth and separation.</p><p>VLAN 30 is for storage traffic. Images, volumes and VM disks can generate a lot of traffic, especially once instances start moving real data around. Even in a small cluster, storage is one of those areas where “it works on one network” can turn into “why is everything slow?” surprisingly fast.</p><p>VLAN 40 is for Neutron’s internal networking traffic. This is the network used by the cloud networking layer to carry tenant traffic between nodes. When two VMs belong to the same private tenant network but run on different physical machines, the virtual networking layer still needs a real path between those machines. In my setup, this is the kind of traffic VLAN 40 is meant to carry.</p><p>VLAN 50 is the provider network for Neutron. This one is different. It is not used to carry the private tenant overlay traffic between nodes. It is the external/provider segment that Neutron can attach to br-ex, and from which floating IPs can be allocated.</p><p>In my setup, VLAN 50 is carried on the SFP interface and attached to Open vSwitch. The host does not use the VLAN interface directly in the usual way. Instead, it is connected to the OpenStack external bridge, br-ex.</p><p>On one of the nodes, it looks roughly like this:</p><pre>sfp1.50  → OVS<br>br-ex    → 10.50.0.11/24</pre><p>This is the network Neutron can use as its external/provider network. When a tenant gets a floating IP, that address can come from this provider segment. OpenStack can then associate that floating IP with an instance through its virtual networking layer.</p><p>The important detail is that “external” here means external from the point of view of the tenant network. It does not automatically mean public on the internet.</p><p><strong>That distinction matters a lot.</strong></p><p>In a real public cloud, the provider network may contain public IPv4 addresses that are actually routable from the internet. In my homelab, VLAN 50 is a real provider network, but it is still part of my own infrastructure. OpenStack can model floating IPs on it, but it cannot magically invent a public IPv4 range for me.</p><p>Finally, VLAN 60 connects the cluster toward my upstream LAN. This is the side that reaches the rest of my home network and eventually the outside world. On my current setup, this network even receives a global IPv6 address, which is nice, but still does not solve the entire public exposure problem by itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jO64yAWukLoF54XNjDdVAg.png" /><figcaption>The vlan setup captioned.</figcaption></figure><p>So the six VLANs are not here for decoration. They give the cloud a shape.</p><p>Management stays reachable. Internal OpenStack traffic has its own place. Storage does not have to fight everything else. The provider network exists as a real segment for Neutron. And the upstream network gives the cluster a path toward the outside.</p><p>It is still a homelab, but at least the network is no longer just “whatever cable was available”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUPix9b5VOt9E_ngkXMgWA.png" /><figcaption>The two switches, with a temporary 1GB uplink while I wait for a better router</figcaption></figure><h3>The next step</h3><p>At this point, the cluster has a better foundation.</p><p>I have the machines. I have the software direction. I have the network cards. I have a physical layout that separates the main kinds of traffic. I have a provider network that Neutron can use for floating IPs.</p><p>That is progress.</p><p>But it does not solve the public ingress problem.</p><p>If Alice creates a VM and associates a floating IP from my provider network, that floating IP exists inside my infrastructure. It is useful, routable in my own environment, and visible to OpenStack. But that does not mean someone on the internet can magically reach it.</p><p>This is where the comfortable cloud abstraction meets the boring reality of IPv4.</p><p>A public cloud provider can hand tenants public floating IPs because it owns or leases public address space. My homelab does not. I have a limited edge connection, not a beautiful pool of public IPv4 addresses waiting to be assigned to tenant VMs.</p><p>The next question is how to expose several tenant services through the very limited edge of my own internet setup.</p><p>That is where the next part begins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fT_k0bsdJTXZ3WkY" /><figcaption>When I realized I built a multi tenant architecture under only one public IP.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dc386cfbdea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A network inside the network: virtual networking explained]]></title>
            <link>https://medium.com/@armeldemarsac/a-network-inside-the-network-virtual-networking-explained-e1cefcb9b862?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1cefcb9b862</guid>
            <category><![CDATA[overlay-network]]></category>
            <category><![CDATA[ovn]]></category>
            <category><![CDATA[openstack]]></category>
            <category><![CDATA[virtual-networking]]></category>
            <category><![CDATA[ov]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Sun, 31 May 2026 15:59:24 GMT</pubDate>
            <atom:updated>2026-05-31T15:59:24.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>Shared hardware, private networks</h3><p>If you have ever dipped your toes into sysadmin cosplay, homelabbing, or virtualization, you have probably met hypervisors, virtual machines, and the strange joy of watching a guest OS boot inside another machine.</p><p>Getting VMs to run is already a project.</p><p>But it is only half of the story.</p><p>Once a VM exists, it usually needs to talk to something. It may need to reach a database, install packages from the internet, expose a website, call an API, or communicate with another VM. A virtual machine without networking is not very useful, unless your goal is to create a very expensive digital paperweight.</p><p>Things become more interesting when several users share the same physical infrastructure.</p><p>Imagine Alice wants one private network for her application and another one for her database. Bob wants his own private network too. Both of them may choose very common private IP ranges, such as 10.0.0.0/24 or 192.168.1.0/24.</p><p>On a normal home network, if two machines use the same IP address in the same place, things break. There is only one 10.0.0.5 on that network. If two devices claim it, the rest of the network gets confused very quickly.</p><p>So how can a cloud platform let several users create their own networks freely, sometimes using the same private IP ranges, without everything colliding?</p><p>That is where virtual networking comes in.</p><p>The problem is not only that packets need to move. Packets always need to move. The real problem is that they need to move while keeping each user’s environment separated from everyone else’s.</p><p>Alice’s network should not become Bob’s network just because their VMs happen to run on the same physical cluster. If Alice exposes a database inside her private network, Bob should not automatically be able to see it. If Bob creates a network with the same private IP range as Alice, it should not conflict with Alice’s network.</p><p>From the user’s point of view, the model should be simple:</p><p>They create a network, attach machines to it, and use it.</p><p>From the cloud operator’s point of view, this should not require manually reconfiguring the physical switches every time someone wants a subnet.</p><p>Before looking at how cloud platforms solve this, it helps to start with the traditional way of separating networks: VLANs.</p><h3>VLANs help, but are too tied to the physical network</h3><p>Most homelabbers have at least heard of VLANs.</p><p>The idea is simple: one physical network can carry several logical networks. Instead of using a separate switch for every network, Ethernet frames can be tagged with a VLAN ID. A switch that understands VLANs uses that tag to know which logical network the frame belongs to.</p><p>For example, imagine two devices plugged into the same physical switch. One is in VLAN 10, the other is in VLAN 20. Even though they share the same switch, they are not in the same Layer 2 network. They cannot directly exchange Ethernet frames unless a router or firewall is configured to route traffic between those VLANs.</p><p>This is very useful.</p><p>At home, you can put your personal devices in one VLAN and your IoT devices in another. This way, if your smart light bulb suddenly decides to become a network security researcher, it does not get direct access to your laptop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*tYMohCx7PmOziJGt" /><figcaption>When my suspicious connected toothbrush tries to reach my beloved workstation VLAN.</figcaption></figure><p>You can also configure trunk ports. A trunk carries several VLANs over the same physical link. On Linux, this often appears as subinterfaces such as eth0.10 and eth0.20, where the number at the end is the VLAN ID.</p><p>So we could imagine using VLANs for tenant isolation.</p><p>Alice gets VLAN 10.<br>Bob gets VLAN 20.<br>Their traffic is separated.</p><p>That works, but it is still very tied to the physical network.</p><p>If I create a new VLAN, I usually need to make sure my switches carry it on the right ports. I may need to update trunks, routing, firewall rules, host networking configuration, or all of those at once. For a few stable networks, this is perfectly fine. For a cloud-like platform where users are supposed to create networks themselves, it becomes painful very quickly.</p><p>Imagine Alice wants a temporary private network for a test environment. Then Bob wants two networks. Then another tenant wants a network using the same private IP range as Alice. Then a VM moves from one physical node to another.</p><p>If every change requires someone to touch the physical switch or manually update host configuration, users do not really have self-service networking. They have a human standing between them and the network.</p><p>There is also a scale limit. Traditional VLAN IDs are 12 bits, which gives 4094 usable VLANs. In a homelab, that is probably not the first problem you would hit. In a real cloud, where many tenants can create many networks, it becomes a real limit.</p><p>VLANs can isolate traffic, but they do not fully give us the model we want.</p><p>We want users to create networks through an API.<br>We want those networks to be isolated.<br>We want overlapping private IP ranges to work.<br>And we do not want to reconfigure the physical switches every time a tenant creates a new network.</p><p>This is where cloud networking services come in.</p><h3>Neutron turns networks into logical objects</h3><p>In OpenStack, the networking service is called Neutron.</p><p>Neutron lets users create networking resources such as networks, subnets, ports, routers, security groups, and floating IPs.</p><p>For example, Alice can create a private network in her OpenStack project. Then she can create a subnet inside it, attach a VM to that network, and define security rules to allow SSH or HTTP traffic.</p><p>From her point of view, she is creating networking objects in OpenStack. She does not need to know which Linux bridge exists on which host, which tunnel carries the traffic, or which low-level rules are installed underneath. She does not need to ask someone to create a VLAN on a switch. She does not need to know which physical node will run her VM.</p><p>That is the useful part.</p><p>The network becomes something the platform can model and manage.</p><p>Of course, packets still have to move for real. OpenStack cannot just declare that a network exists and hope the universe politely agrees. At some point, something on the hosts has to forward packets, apply security rules, route traffic, create tunnels, or drop traffic that should not pass.</p><p>In many OpenStack deployments, this is done with OVN and Open vSwitch.</p><p>But before talking about those two, we need to look at the packet itself, because overlay networking becomes easier to understand once we remember that network traffic is already built in layers.</p><p>When a client sends a request to a server, it does not simply put “hello website” on the cable.</p><p>An HTTP request is carried by TCP.<br>TCP is carried by IP.<br>IP is carried by Ethernet on the local network.</p><p>Each layer adds the information it needs: TCP ports and sequence numbers, IP addresses, MAC addresses, and so on.</p><figure><img alt="https://cdn-images-1.medium.com/v2/resize:fit:1565/1*1lhtLGVE6n3oGRII0Vc8mg.png" src="https://cdn-images-1.medium.com/proxy/1*1lhtLGVE6n3oGRII0Vc8mg.png" /><figcaption>As you can see, a TCP request may span multiple Ethernet frames.</figcaption></figure><p>A single HTTP request may even span multiple Ethernet frames. The application does not usually care about that detail. It sends data, and the networking stack splits, wraps, forwards, reassembles, and delivers it.</p><p>That layered model matters because overlay networking uses a similar idea.</p><p>Instead of only wrapping application data inside TCP, IP, and Ethernet, we wrap a tenant network packet inside another packet that the physical network can carry.</p><h3>Overlay networking carries tenant traffic between hosts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/0*VQ5-aoyptmEBXIkM.jpg" /><figcaption>I know that’s how it sounds, but I swear, there’s more to it.</figcaption></figure><p>The basic idea of an overlay network is simple: create a virtual network on top of an existing physical network.</p><p>The physical network is still there. Packets still cross real cables, real switches, and real network cards. But tenant networks are not directly mapped to physical switch ports, dedicated cables, or manually configured VLANs.</p><p>Let’s say Alice has two VMs on the same OpenStack private network.</p><p>VM A runs on compute node 1.<br>VM B runs on compute node 2.</p><p>From Alice’s point of view, both VMs are simply attached to the same private network. VM A sends traffic to VM B as if they were on the same local network.</p><p>Physically, however, they are not on the same machine.</p><p>The frame sent by VM A reaches the virtual switching layer on node 1. That virtual switch sees that the destination VM is not local. It then wraps the original tenant frame inside another packet and sends it across the physical network to node 2.</p><p>On node 2, the receiving virtual switch removes the outer tunnel headers, recovers the original tenant frame, and forwards it to VM B’s virtual interface.</p><p>The physical network is still doing the actual transport. It carries traffic between OpenStack nodes. The overlay layer keeps track of which tenant network the traffic belongs to.</p><p>The inner frame belongs to Alice’s private network.<br>The outer packet belongs to the physical network between the OpenStack hosts.</p><figure><img alt="https://cdn-images-1.medium.com/v2/resize:fit:1565/1*dy5JM8fKEffh5QM7K2fTBQ.png" src="https://cdn-images-1.medium.com/proxy/1*dy5JM8fKEffh5QM7K2fTBQ.png" /><figcaption>The underlay physical network still exists, it just carries our network abstraction.</figcaption></figure><p>So the same traffic has two contexts:</p><p>The tenant context, where Alice’s VMs communicate inside their private network.</p><p>The transport context, where physical nodes send packets to each other across the real infrastructure.</p><p>The physical network does not need to know Alice’s full virtual topology. It does not need to know which VM is in which tenant network. It only needs to move an encapsulated packet from one host to another.</p><p>That is enough to let Alice’s network span several physical machines without creating a dedicated physical network for her.</p><p>It is worth noting that not every packet needs to cross a tunnel. If two VMs are on the same compute node, the traffic may stay local inside that host. Encapsulation becomes necessary when traffic has to cross the physical network between nodes.</p><p>The underlay still exists.</p><p>It just carries the overlay.</p><h3>Geneve is the envelope</h3><p>In OpenStack deployments using OVN, this encapsulation is commonly done with Geneve.</p><p>Geneve is not a virtual switch. It is not the service that decides where packets should go. It is the tunnel format used to carry tenant traffic across the physical network.</p><p><strong>You can think of Geneve as the envelope.</strong></p><p>The original tenant frame goes inside. Then the system adds outer headers so the physical network knows how to carry the packet from one OpenStack node to another.</p><p>Geneve uses UDP, commonly on port 6081.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbY1WA90PUUjWMWfhOUuTQ.png" /><figcaption>The overlay pictured.</figcaption></figure><p>At first, UDP may sound like a strange choice. TCP feels reassuring. It provides a reliable byte stream, retransmissions, ordering, and congestion control.</p><p>But putting tenant packets inside TCP can create awkward behavior, especially when the inner traffic is already TCP. One lost segment in the outer TCP connection could delay unrelated inner traffic behind it. The outer TCP connection would treat the tunnel as one ordered byte stream, even though the tunnel may be carrying many independent flows.</p><p><strong>UDP is simpler for this job.</strong></p><p>One UDP datagram can carry one encapsulated overlay packet. The overlay system keeps packet boundaries clear, and the inner traffic keeps its own behavior. If the inner flow is TCP, then the inner TCP connection can handle retransmissions and ordering itself.</p><p>The tunnel also carries context. The receiving side must know which logical network the packet belongs to. In overlay networking, this is typically done with tunnel metadata, such as a virtual network identifier or other information carried with the encapsulated packet.</p><p><strong>That context is essential.</strong></p><p>Without it, the receiving node would only see an inner frame with addresses such as 10.0.0.5. But 10.0.0.5 may exist in Alice’s network and Bob’s network at the same time. The address alone is not enough. The packet must also be interpreted inside the right logical network.</p><p>When a packet arrives on the destination node, Open vSwitch receives it through its Geneve tunnel port. It removes the outer Ethernet, IP, UDP, and Geneve headers. Then it recovers the original tenant Ethernet frame and forwards that frame to the correct VM interface.</p><p>The host does not extract the TCP segment and hand it directly to the VM. The VM receives normal-looking network traffic on its virtual NIC, and its own network stack handles Ethernet, IP, TCP, and the application data from there.</p><p>That detail matters.</p><p>The VM does not know about the whole tunnel machinery. From its point of view, it simply has a network interface and receives packets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4AyRZ_gBBS9OwWPZqFP-g.png" /><figcaption>The simplified decapsulation process.</figcaption></figure><p>The complicated part happens around the VM, not inside it.</p><p>Which is probably for the best.</p><p>There is one practical detail to keep in mind: MTU. The MTU is the largest packet size a network link can carry without fragmentation. Because Geneve adds an extra envelope around the original tenant frame, the resulting packet is bigger than the packet the VM originally sent. If the physical network MTU is too small, large packets may be fragmented or dropped, which can lead to very confusing network issues.</p><p>Overlay networking gives us flexibility, but it is not magic. It still has to obey physics, packet sizes, and the occasional unpleasant network debugging session.</p><h3>OVN describes the virtual network, OVS applies it locally</h3><p>Now we can talk about OVN and Open vSwitch.</p><p>Open vSwitch, often shortened to OVS, is the virtual switch running on each compute node. It moves packets between VM interfaces, local bridges, router interfaces, and tunnel ports.</p><p>OVN, for Open Virtual Network, is the system that describes what the virtual network should look like and distributes that information to the nodes.</p><p>A tenant network is not a physical switch sitting somewhere in a rack. It is represented by logical objects: logical switches, logical routers, logical ports, security rules, NAT rules, and port bindings.</p><p>These objects describe the virtual network.</p><p>They say:</p><ol><li>Which VM port belongs to which network.</li><li>Which MAC and IP addresses are attached to that port.</li><li>Which router connects which networks.</li><li>Which traffic should be allowed or blocked.</li><li>Which physical node currently hosts a VM.</li></ol><p>OVN stores the logical network state and distributes the relevant information to each node. The local OVN controller then programs OVS so packets are handled according to that logical model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*vWPWvJgXSrq_Zyol.jpg" /></figure><p>Put differently:</p><p>Neutron is the API layer users interact with.<br>OVN is the logical network control plane.<br>OVS is the local virtual switch that applies the rules.<br>Geneve is the tunnel format used when traffic must cross the physical network.</p><p>For example, if Alice’s VM on node 1 sends traffic to another VM on node 2, OVS on node 1 needs to know what to do with the packet.</p><p>Is the destination local?<br>Should the packet be sent through a Geneve tunnel?<br>Should it be routed?<br>Should it be dropped because of a security rule?<br>Should NAT be applied?</p><p>OVN provides the logical network information, and OVS uses that information to handle the packet locally.</p><p><em>A metaphor helps here.</em></p><p>Imagine a large building hosting several events at the same time. In a traditional setup, people are guided by the physical layout: corridors, barriers, locked doors, gates, signs, and security checkpoints. If you want to separate two groups, you create separate paths. If you want to change how people move, you move barriers or open and close doors.</p><p>That is similar to traditional networking, where cables, switch ports, VLANs, routers, and firewall interfaces define where traffic can go.</p><p>Now imagine the building changes all the time.</p><p>New groups arrive.<br>Some groups leave.<br>Some need private rooms.<br>Some need access to a shared exit.<br>Some may even use the same room numbers internally, but those room numbers do not mean the same thing for everyone.</p><p>You do not want to rebuild the building every time, so you place agents at checkpoints.</p><p>Each person carries a badge. The badge says which group they belong to and where they want to go. The agent reads the badge, checks the instructions, and sends the person in the right direction.</p><p>Someone from group A going to room 10 may go left.<br>Someone from group B also going to room 10 may go right.<br>The room number is the same, but the context is different.</p><p>Someone trying to reach the public exit may be sent toward another corridor. Someone without the right badge may be stopped.</p><p><strong>That is close to what happens in an overlay network.</strong></p><p>Packets are like the people.<br>OVS is like the local checkpoint agent on each node.<br>OVN is the system that prepares and distributes the instruction sheets.</p><p>The physical building still exists, just like the physical network still exists. People still walk through real corridors, and packets still cross real cables, switches, and network interfaces.</p><p>But separation is no longer created only by the physical layout. It is also created by rules applied at each checkpoint.</p><p>This is what allows several tenants to share the same physical infrastructure while still having separate networks.</p><h3>Overlapping IPs work because the IP is interpreted inside a logical network</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*WZZ6iu6cf_Jrko9F.jpg" /></figure><p>This also explains how overlapping IP ranges can work.</p><p>Alice can have a VM using 10.0.0.5 inside her private network. Bob can also have a VM using 10.0.0.5 inside his own private network.</p><p>In a normal flat network, this would be a conflict.</p><p>In OpenStack tenant networking, those addresses exist inside different logical networks.</p><p>Back to the building metaphor: two people can both say they are going to room 10, but if they belong to different events, room 10 may refer to two different places. The checkpoint agent does not only look at the room number. It also looks at the group.</p><p><strong>OVS does something similar with packets.</strong></p><p>It does not only care about the destination IP address. It also knows which logical network the packet belongs to, because OVN gave it the rules for that network and the tunnel carries the context needed when traffic moves between nodes.</p><p>So when Alice creates a network in OpenStack, she is not creating a physical switch and she is not asking someone to configure a VLAN manually. She creates a Neutron network.</p><p>Neutron turns that request into the objects needed by the backend networking system. In an OVN-based deployment, those objects are represented in OVN’s logical model. OVN distributes the relevant state, and OVS applies the corresponding behavior on each compute node.</p><p>If Alice then creates a VM and attaches it to that network, OpenStack creates the needed port and connects the VM to the virtual switching layer.</p><p>From Alice’s point of view, she has a private network.</p><p>From the operator’s point of view, the physical network does not need to be redesigned every time a tenant creates one.</p><p>This is what makes the model useful. Users can create their own private networks. Those networks are isolated. Overlapping private IP ranges can coexist. The physical switches do not need to be manually reconfigured for every new project.</p><p>There is one important nuance, though.</p><p>Overlapping IP ranges work as long as those networks remain separate logical contexts. If you try to directly route Alice’s 10.0.0.0/24 network into Bob’s 10.0.0.0/24 network without NAT, policy, or some other form of separation, the ambiguity comes back.</p><p>The platform can keep separate networks separate.</p><p>It cannot make the same address mean two different things inside the same routing context.</p><p>That solves a large part of the tenant networking problem. It mostly covers communication inside the platform: VM to VM, application to database, backend to internal service, and so on.</p><p>If a tenant wants to expose a website to the internet, there is another problem to solve. The private network eventually has to connect to something outside itself. That is where external networks, floating IPs, NAT, load balancers, or reverse proxies start to matter.</p><p><em>But that is another subject.</em></p><p>The point here is how several private networks can exist on the same shared infrastructure without becoming the same network.</p><h3>The physical network is still there</h3><p>Virtual networking can sound like the physical network has somehow been replaced by pure abstraction.</p><p><strong>It has not.</strong></p><p>The physical network is still doing the boring but very real job of moving packets between machines. Packets still cross real cables, real switches, and real network cards. If the physical network breaks, the overlay does not magically levitate frames across the room.</p><p>The difference is that tenant networks are no longer directly represented by switch ports, cables, or dedicated VLANs.</p><p><strong>They exist as logical networks.</strong></p><p>The physical network is used as a transport layer between the hosts that run them.</p><p>When Alice’s VM talks to another VM on the same tenant network, Alice does not need to care whether those VMs are on the same physical node or not. If they are local, the host can handle the traffic locally. If they are on different nodes, the traffic can be encapsulated and carried across the physical network.</p><p>OVN describes the logical network.<br>OVS applies the rules locally.<br>Geneve carries tenant frames between hosts when they need to cross the physical network.<br>Neutron gives users the API to create and manage the whole thing.</p><p>Once that clicks, cloud networking becomes a little less magical.</p><p>Not simple, exactly. Let’s not get carried away.</p><p>But at least the weirdness has a shape.</p><p>Alice can create a private network. Bob can create another one. They can even both use 10.0.0.5.</p><p>The physical infrastructure remains mostly the same, while the virtual networking layer keeps track of which packet belongs to which logical network.</p><p>Still real packets.<br>Still real cables.<br>Just more context !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1cefcb9b862" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I built my own private cloud #1]]></title>
            <link>https://medium.com/@armeldemarsac/how-i-built-my-own-private-cloud-1-aa7fc6e9b87b?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa7fc6e9b87b</guid>
            <category><![CDATA[3d-printing]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[watercooling]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 00:36:54 GMT</pubDate>
            <atom:updated>2026-05-11T08:25:10.399Z</atom:updated>
            <content:encoded><![CDATA[<p><em>In this first article I’ll lay down the basis of my custom build, part 2 will be dedicated to networking, temps and performances, part 3 to deploying openstack and the service layer.</em></p><p>If you’ve ever used any cloud service like AWS, GCP or Azure, you surely know that despite all of the cool features these platform offer, there are a lot of things that get in the way too.</p><h4>💸 Cost</h4><p>It’s no surprise, things tend to get pretty expensive as you start experimenting and adding services. First they hook you on relatively cheap VPS but as soon as you add a managed database, a kubernetes cluster, some load balancers and public ips you easily get through the 1000 bucks a year ceiling.</p><h4>🔐 Vendor lock in</h4><p>Despite being built on open standards in networking and virtualization, these platforms have built a lot of abstractions. Don’t get me wrong, theyre useful and help us navigate through sometimes pretty advanced concepts in networking. However you quickly get mentally locked and switching to another provider will start to look like a daunting endeavor.</p><h4>🤔 Hyperscaler = bad ?</h4><p>Of course not! They offer great redundancy features, they maintain and upgrade the infrastructure for you and manage the lower security layers like champs. However if you’re not a fortune 500, a scaleup or any workforce bound organization, building your own infrastructure might look like the best way to learn advanced infrastructure and networking concepts at a cost that will be recouped in a year or two of usage.</p><p>That’s why I decided to start building !</p><h4>Constraints</h4><p>For this first server build I had a few constraints, some logical and sound, other purely for the sake of the challenge and because “it sounded cool”.</p><p>🧠<strong> Compute</strong>: The virtualization stack will be managed by openstack, this adds quite a bit of overhead, furthermore I plan on running most of my deployments with kubernetes.</p><p>🤏🏼 <strong>Size</strong>: I didnt want to go for a full size 19 inch rack. I don’t have a ton of space home and I wanted this rack to be easily movable between locations, for demos or moving into a new flat.</p><p>🐜 <strong>Efficiency</strong>: I wanted to strike a balance between raw power and electricity consumption, so the whole rack could idle around 100 watts max while being able to stay cool without having its fans running full tilt.</p><p>🛫 <strong>Noise</strong>: This rack will stay in my bedroom, I don’t want any server grade fan blasting like a jet prop 24/7.</p><figure><img alt="https://www.youtube.com/watch?v=J0wg1YLhXi8" src="https://cdn-images-1.medium.com/max/1024/1*uD3pPCbczfrCO1QXoUtvag.png" /><figcaption>If you know, you know.</figcaption></figure><h4>Drafting</h4><p>With these constraints in mind I started “ideating” and choosed the components:</p><p>🧠<strong> Compute</strong>: I went with a 3 nodes design. Each node will contain its own 250 watts ATX power supply alongside which sits 128G of Crucial DDR5 ram and 32 threads of AMD 7945HX goodness. That should give us around 384G of RAM and 96 threads in total.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*ebufwR5J2fISQ6Rg.jpg" /><figcaption>What buying all that ram before the big AI crunch felt like</figcaption></figure><p>🤏🏼 <strong>Size</strong>: A10 inch rack with at least 12u of vertical space, enough to fit virtually anywhere while being easy to move around compared to a full size 19inch rack.</p><p>🐜 <strong>Efficiency</strong>: the motherboard used are not traditional. They’re the <a href="https://www.minisforum.com/fr/products/minisforum-bd795i-se">Minisforum BD 795i SE mini ITX boards</a>. They integrate a soldered AMD repurposed mobile variant of the 7945 CPU, hence the HX denomination. It keeps a low max TDP of a 100 watts, which gives us a theoretical maximum of 300 watts for our three nodes. What’s cool about this mobile variant is that all 16 cores use the same design, no P or E cores like we usually find on mobile chips.</p><p>🛫 <strong>Noise</strong>: To compensate for the very dense power architecture of the rack I decided to move to a custom water-cooling loop with a top 200mm wide and 90mm thick radiator cooled by two <a href="https://www.noctua.at/en/products/nf-a20-pwm-chromax-black-swap#hero">200mm Noctua fans</a>, in a push pull configuration. That should allow for good cooling while staying relatively quiet (bigger fans move more air per RPM, allowing for lower operating speeds and decreased noise volume).</p><blockquote>With that plan in mind, I began my long journey about a year ago, blissfully unaware of the hurdles and pain that awaited me.</blockquote><h3>The journey</h3><h4>🏢 <strong>The perfect rack</strong></h4><p>To house all of our stack I went with the <a href="https://deskpi.com/products/deskpi-rackmate-t2-rackmount-12u-server-cabinet-for-network-servers-audio-and-video-equipment#1">Rackmate T2</a> from DeskPi, a company focused on home-lab hybrid solutions. Its 28 x 26 x 59,6 cm generous dimensions were enough to accommodate the three nodes, their cooling solution and any networking equipment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vbxzh2Fmskg8yp7E" /><figcaption>What’s cool is that you can daisy chain these racks to create gigantic compute towers</figcaption></figure><h4>🧰 The cases</h4><p>For each node I went with a fully contained approach. By fully contained I mean that each case should contain the entirety of the node, including its power supply. I didn’t want barrel DC plug with power bricks stacked outside them. The case used was the <a href="https://www.myelectronics.nl/us/10-inch-2u-mini-itx-case.html">MyElectronics 10 inch 2U Mini-ITX case</a>, enough to accommodate the mini ITX motherboards I laid my eyes on. The small 2U size however meant that fitting a traditional power supply alongside the computing equipment was going to be a challenge.</p><h4>⚡️ Powa</h4><p>Big square modular PSUs were out of the equation as they didn&#39;t fit inside the cases. After a bit of digging I found these <a href="https://hdplex.com/hdplex-fanless-250w-gan-aio-atx-psu.html">250W GaN Passive AIO ATX Power Supply</a> from HD Plex, a german audio company. The gallium nitride tech allows for an above average 1.18W/cm³ power density, keeping this fully passive unit under 360g with 170(D) x 55 (W) x 25 (H) mm dimensions. Enough to fit inside the case without adding any extra noise.</p><h4>🧚🏼‍♀️ The motherboards</h4><p>As stated I went with <a href="https://www.minisforum.com/fr/products/minisforum-bd795i-se">minisforum’s BD 795i SE motherboards</a>. Their mini ITX footprint fits perfectly inside the chosen cases. The watercooling solution allowed me to save all of the space that a radiator + 120mm fan would have taken inside the case while dissipating all of the CPU related heat outside the case, at the radiator level. Each motherboard received 128 gigs of crucial DDR5 sodimm ram. Alongside the ram came a 1tb crucial SSD, leaving another PCIE 4.0 slot free. The storage will be handled by an external server later on so it wasnt a big concern.</p><blockquote>“Watercooling sounds cool,” I thought. How foolish I was. It did not take long for the laws of physics and the cruel realities of CAD modelling to teach me a lesson.</blockquote><h3>Custom watercooling hell</h3><p>By opting for watercooling, I not only created a homelab that looked less like a computing cluster and more like a deranged attempt to fit a supercharged Rolls-Royce Merlin III into a server rack, but also freed up the space that would otherwise have been taken by individual PSUs inside each case, all while moving heat away from critical components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*LCiZm-R4i9Iofm1S" /><figcaption>Believe it or not, we came dangerously close.</figcaption></figure><h4>🧊 The waterblocks</h4><p>These motherboards do not use standard Intel or AMD cooler mounting solutions. Instead, you are left with four holes spaced 45 mm apart around the CPU package, matching precisely no existing CPU water block known to mankind. Fortunately, German craftsmanship came to the rescue. As it turns out, a German engineer had designed <a href="https://www.liquidextasy.de/mb-wasserkuehler/mb-chipsatz/minisforum/wasserk%C3%BChler-nl-nsb-minisforum-bd790i-detail.html">a custom water block </a>specifically for this motherboard. At 150 bucks per block, it was a no-brainer. It had originally been made for the older BD790 variant, but it fitted the newer board perfectly. Better still, it was handmade in Germany, which only added to the mechanical flair of the whole ensemble. Great craftsmanship, however, came at a cost: in the middle of copper shortages, I had to wait six months for these little beauties to be made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RlD_tC8SNG1zWsIo.jpg" /><figcaption>I ordered them in black acetate, it was a mistake clearly given how beautiful they look in clear acrylic.</figcaption></figure><h4><strong>🦬 A short but thick radiator</strong></h4><p>No plural here. Against conventional wisdom, I decided to go with a single-radiator setup. A standard 25 mm-thick radiator was not going to tame 360 watts of maximum heat output, but <a href="https://shop.alphacool.com/en/shop/radiators/180200mm/rad-alphacool-nexxxos-monsta-full-copper-200mm-radiator">Alphacool’s NexXxoS Monsta</a> seemed almost purpose-built for this questionable endeavour. Its 20 cm footprint meant it would fit perfectly inside my rack, and what it lacked in length, it compensated for with brute thickness: 9 cm of full-copper thermal stubbornness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WcnmwHKtnG2YXEGT1XI38A.png" /><figcaption>This radiator is, simply put, the gigachad of compact rads.</figcaption></figure><h4>🦟 The pump</h4><p>At this stage, the loop consisted of three water blocks and one massive radiator. To move the coolant around, I chose the <a href="https://www.ekwb.com/shop/ek-pro-d5-combo-unit-single">EK-Pro Pump Reservoir Manifold X6 D5 — Acetal</a>. With its 12-port manifold, it had far more connectivity than my four components required. More interestingly, the distro is divided into three pairs of parallel runs. Balancing flow between parallel branches is never trivial, but this arrangement gives me one very useful feature: I can disconnect a unit from the loop while the others remain operational.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OM9umJP_iHMWMO0d.jpeg" /><figcaption>It looks like it could be in any automotive shop.</figcaption></figure><h4>🔌 Fittings</h4><p>Yep, I mentioned unplugging a node from the loop — but how? Enter the <a href="https://shop.alphacool.com/en/shop/fittings/quick-release-fasteners/13876-alphacool-es-quick-release-blh1a-pushin-set-ot-ot">Alphacool ES Quick Release BLH1A</a>. Compared to popular alternatives from Koolance, they are relatively affordable, at around 36 bucks a pair, and they offer a passthrough option that fits my use case perfectly. Coupled with soft tubing, they make maintenance much easier, in a way that a hard-tubed loop, however pretty, would simply not have allowed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aT5SKo6C1Pi_wWkv.jpg" /><figcaption>My version is slightly different, especially on the male side as it uses bulkhead fittings for threading to the cases back panels.</figcaption></figure><h4>👀 Controlling the cooling loop</h4><p>The main issue with a three-node watercooling loop is control. Should I plug the pump and fan headers into one of the nodes and let it control the entire loop? But then what happens if that node goes down? Even in the best-case scenario, its temperatures are not necessarily representative of the other two nodes. The controller could overrun the pump and fans for no good reason, or worse, underrun them and slowly cook the hardware in the process.</p><p>What I needed was an external, autonomous system dedicated to running the pump and fans. That way, the loop would be fully independent from any node-specific failure or temperature reading. To achieve this, I went with <a href="https://shop.aquacomputer.de/Monitoring-and-Controlling/QUADRO-and-OCTO/QUADRO-fan-controller-for-PWM-fans::3773.html?language=en">Aquacomputer’s QUADRO</a>: a programmable microcontroller capable of controlling and powering up to four PWM devices, which was enough for my pump and fans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*e-rZmvwHRRWE-HL5.jpg" /></figure><p>But what about temperature readings? Instead of relying on CPU temperatures, which can vary wildly from node to node, I added an <a href="https://shop.alphacool.com/en/shop/controllers-and-sensors/flow-sensor/17558-alphacool-es-flow-and-temperature-indicator-highflow-with-rpm-signal">Alphacool flow and temperature sensor</a> and fed its outputs directly into the QUADRO. I could then configure the fan and pump curves in Aquacomputer’s Aquasuite software to react to coolant temperature rather than to whichever CPU happened to be shouting the loudest at any given moment.</p><p>To power the whole system, I bought a <a href="https://www.amazon.fr/Ext%C3%A9rieur-Transformateur-Commutation-Alimentation-Applications/dp/B08RC3DDFC">12 V, 60 W LED power supply</a> and wired its 12 V output to both the pump and the QUADRO. The QUADRO also needs a 5 V source to turn on, so I added a buck converter to step one of the 12 V lines down to 5 V. In practice, the power supply output is split into three lines: one 12 V line to the pump, one 12 V line to the QUADRO, and one line stepped down from 12 V to 5 V for the QUADRO’s logic power. It took a fair bit of crimping and soldering, and the setup would probably benefit from a cleaner buck converter, but in the end, it worked.</p><h3>Assembling the puzzle</h3><h4>Fitting everything inside the cases</h4><p>The first constraint was to make the watercooling system coexist with the individual node cases. Their rear panel was designed for a standard I/O shield, certainly not for quick-disconnect watercooling fittings, and even less for the C14 220 V inlet of an internal power supply. That meant going fully custom.</p><p>The first step was to design a new back panel in CAD. It had to accommodate the watercooling fittings and the 220 V plug, while still leaving easy access to the motherboard’s rear ports. In practice, this new part would act as a custom I/O shield, but adapted to the rather unreasonable needs of the build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sOPCuIH1avQbcqRzHKP6XQ.png" /><figcaption>The CAD model.</figcaption></figure><p>I 3D-printed the parts in PETG to better withstand the heat generated inside the case. As you can see, I had to add two bulges extending backwards. This was necessary because both the C14 inlet and the male quick-disconnect fittings protruded into the case, stealing precious internal space. The bulges allowed me to move those constraints outward and free up room inside the enclosure.</p><p>After countless design iterations, I eventually reached a version I was happy with. I then sawed off most of the original aluminium rear panel and slotted my custom design into place.</p><p>The front of the case also received a custom 3D-printed part, this time to hold a small 40 mm Noctua fan. Its job is to push a bit of fresh air over the RAM, power supply, and SSD — the components that no longer benefit from a conventional airflow path once the CPU cooler has been replaced by a water block.</p><p>Finally, the power supply received its own custom 3D-printed holder to keep it securely in position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Td3MpXX2h0rva32nbqPubg.png" /><figcaption>The power supply just slides ride in, at the back of the panel, just behind its outlet.</figcaption></figure><h4>🔧 Mounting the blocks</h4><p>To mount the water block to the CPU, I used PTM 7950 from the LTT Store. It has slightly lower thermal conductivity than liquid metal, but it is neither corrosive nor electrically conductive, and its performance improves over time as it repeatedly cycles between its solid and liquid phases. In other words, it offered most of the performance benefits I wanted without turning the motherboard into a very expensive chemistry experiment.</p><p>The real problem appeared once everything had to fit inside the case. The tubing runs between the male quick-disconnect fittings on the rear panel and the water block were extremely short. At first, I assumed I would simply bolt the motherboard in, then connect the hoses afterwards. This assumption lasted exactly until I tried to do it. There was no room to push the tubing onto the fittings, no room to tighten anything, and barely enough room to get my fingers in. For a brief moment, I genuinely thought the whole design was doomed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/0*8SXPMDKzIvb2n5kr.jpg" /><figcaption>When you’re almost a year and 4000 bucks deep in this project and realize it might just not work.</figcaption></figure><p>Fortunately there was a solution. It was to reverse the assembly order entirely. Instead of installing the motherboard first, I had to mount the quick-disconnect fittings onto the custom back panel while it was still outside the case. I then connected the short tubing runs to those fittings and attached the other ends to the water block. Only after that could I lower the entire dangling assembly — back panel, fittings, tubing, water block, and motherboard — into the case as one awkward mechanical octopus, before finally bolting the motherboard to its standoffs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I43Hzh9EH07Jm0o7gRYQbw.png" /><figcaption>A tight fit !</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbVeLzvPgPcjSbaRa-oc0A.png" /><figcaption>As you can see there was no space to spare here. The right run is very short !</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_piRWBQJadHfOU2gowLx2Q.png" /><figcaption>The precious ram.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Amunuoark99qboe7Crh3gQ.png" /><figcaption>The three nodes, assembled and ready to roll. You can see the PSU in their holder on the left, the waterblock and its fittings in the center, the ram and the tiny 40mm fan on the front. (ai enhanced)</figcaption></figure><h4>🐙 Pluging the loop</h4><p>Once all the components were fitted inside their individual cases, I moved on to assembling the cooling loop itself. I first designed and printed a shelf-and-bracket assembly to hold the pump, the Aquacomputer QUADRO, and their dedicated power supply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DDXDlHItP0LJmpveyLoR0w.png" /><figcaption>The pump and Quadro shelf. The pump is mounted sideways on the gray bracket while the PSU sits on the carved out front section, with the quadro in between them.</figcaption></figure><p>A second shelf was then added to support the radiator and its two 200 mm Noctua fans. This radiator was at the very top of the rack, under it sat the pump. This way any air bubble can flow upward inside the radiator and we keep the pump under a big chunk of water. That’s especially important as the pump was placed on its back, horizontally. Again not very orthodox but perfectly fine.</p><p>Connecting everything to the pump’s distro plate was relatively easy. For the loop order, I chose to send coolant first through the lowest and furthest node, with the second node connected in parallel on the same stage. The third and closest node was then connected to the next stage of the manifold. I left the second port of that stage unused and placed the radiator at the end of the loop, so the coolant must pass through it before returning to the pump.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KxTiaYd4zkDaIIMKHh-83g.png" /><figcaption>Loop diagram, each outlet sends the water to its two outputs, in parallel. The outlets 4 and 6 are unused.</figcaption></figure><p>Looking at the loop diagram, you might ask: won’t Node 1 run hotter? After all, the coolant it receives has already been warmed up by Nodes 2 and 3.</p><p>The answer is: not meaningfully. In a watercooling loop, the coolant does not “cool” the CPU by being ice-cold. Its job is to absorb heat at the water block and transport it to the radiator. Because water has a high specific heat capacity and the loop flow rate is continuous, the coolant temperature difference across the loop remains fairly small. By the time it reaches Node 1, the coolant may be one or two degrees warmer than it was right after leaving the radiator, but that does not significantly reduce its ability to carry heat away from the CPU.</p><p>In practice, mounting pressure, block contact, flow distribution, and radiator performance matter far more than the exact order of components in the loop.</p><h4>🚿 Filling the loop</h4><p>Once everything except the nodes was plugged in, I started filling the loop with two liters of Alphacool Apex cooling fluid. Priming the pump and bleeding the air bubbles turned out to be quite a challenge. At one point, I even had to lay the entire server on its side to convince the trapped air to move.</p><p>There was plenty of wasted coolant, a few small jump scares, and several moments where I questioned my life choices. Fortunately, I had toilet paper nearby, along with spare fluid — two items that suddenly felt like mission-critical infrastructure.</p><h4>🔮 Booting</h4><p>After what felt like an eternity, all three nodes finally booted. I applied a few BIOS configurations that I will detail in the second article. And then, at what should have been the triumphant climax of a year of work and several thousand bucks invested, I realized I did not have a single USB key to boot from. A truly magnificent feeling of loneliness.</p><p>I eventually managed to find an SD card and pair it with a USB-C dongle, only to discover that my custom 3D-printed I/O shield had slightly faulty tolerances around the USB-C ports. The connector could not be inserted all the way in. So much for the emergency plan.</p><p>At that point, I had to go for the least convenient but most educational option: booting over Ethernet with PXE. This meant turning my laptop into a temporary provisioning gateway. I had to set up the boot server on the laptop, serve the installer over the network, provide DHCP/TFTP or HTTP boot services, and forward LAN traffic so the nodes could reach the rest of the network through it. In other words, my laptop briefly became the world’s least glamorous data center appliance.</p><p>Quite a ride.</p><h4>🎁 The final result</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLfppqJcoPp0hR7XU-6UEg.png" /><figcaption>The three nodes sit at the bottom while the cooling solution occupies the top half. Not the best ratio TBH. A 3D printed shelf will sit right in front of the PSU shelf to hide it and a small touch screen displaying useful stats will sit in front of the radiator at the very top. (ai enhanced, or is it)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*WsTLX0uNEEWjXKJdYEsouw.png" /><figcaption>I reworked the rack two weeks later, after receiving the first switch</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msI-fKKDBG5cbuZIH5sVvA.png" /><figcaption>Rear view of the server, now you understand why I told you about an engine before. (ai enhanced)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*rUlGsAtCLV-_GCdKj6jssw.png" /><figcaption>Let’s move closer. The back of the nodes, each wired and plugged to the loop. (ai enhanced)</figcaption></figure><h4>🧭 What’s next</h4><p>In a couple of days, I should receive the 10G SFP+ networking gear needed to complete this beast properly. The next article will cover the full networking setup, BIOS configuration, temperatures, and performance results.</p><p>I do not want to tease too much, but against all odds, everything works.</p><p>Thanks for following along on this slightly unreasonable journey. Sorry for the average ai enhanced picture, my phone is not the best for pictures so I tried to brighten things a bit through gpt. Don’t hesitate to leave a comment if you have suggestions, advice, or ideas for improving the build. This is my first PC build, so I still have plenty to learn!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa7fc6e9b87b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I taught a microcontroller to understand French]]></title>
            <link>https://medium.com/@armeldemarsac/why-i-taught-a-microcontroller-to-understand-french-7ac8e9d17b99?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ac8e9d17b99</guid>
            <category><![CDATA[embedded-ai]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[nlp-training]]></category>
            <category><![CDATA[ai-training]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Fri, 10 Apr 2026 10:04:44 GMT</pubDate>
            <atom:updated>2026-04-10T10:04:44.268Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How a keyboard implant, a Teensy MITM, and a LoRa link turned a malware assessment into an embedded NLP project</em></p><p><a href="https://github.com/armeldemarsac92/embedded_nlp"><em>Repo link</em></a></p><p>During a cybersecurity assessment, we had to design and implement a malware scenario. I did not want a purely software implant. I wanted a physical ingress point that could live in plain sight, so I used a keyboard as the host and hid the whole system inside it.</p><p>The setup was simple to describe and much harder to build. A Teensy sat between the original keyboard controller and the computer, acting as a man-in-the-middle on the keystroke path. It received the keystrokes coming from the keyboard electronics, forwarded them so the keyboard still behaved normally for the user, and logged the stream for the implant. The concept was neat. The reality was a lot of soldering, wiring, signal issues, power constraints, and the usual embedded frustration of fitting several boards into a shell that was only ever meant to contain a keyboard.</p><p>At that point, though, the hardware was only half the problem. Building a discreet ingress is one thing. Moving data out without being noticed is another.</p><p>There is little value in building a hidden implant if the moment it starts talking, it gets noticed by the network. Hiding on a host and hiding on a monitored enterprise network are not the same thing. Proxies, inspection systems, and anomaly detection make ordinary exfiltration channels much harder to trust. So instead of fighting that battle over TCP, I chose a different outbound path: LoRa.</p><p>So I decided to cram a RAK Lora board inside the keyboard and wire it to the controller to allow outbound communication. That solved one problem and created the next. LoRa gave me a discreet, long-range, low-power channel that made sense for an embedded implant. It also gave me a severe bandwidth limit. Once your outbound path is narrow, raw exfiltration becomes a bad strategy. You cannot afford to ship everything and decide later what matters. The device has to decide locally what is worth sending.</p><p>That constraint is what turned the project from a hardware implant into an embedded NLP problem.</p><h3>The actual goal</h3><p>Once bandwidth became the central constraint, the real task became much clearer. I was not trying to make a microcontroller “understand French” in the broad sense. I only needed it to do one practical thing well: classify short French workplace-style messages into a small set of useful categories so the implant could send only the interesting ones.</p><p>The final label set was:</p><p>`ACCOUNTING`, `BANKING`, `BUSINESS`, `CYBER`, `GOSSIP`, `HR_COMPLAINT`, `HR_HIRING`, `INFRA`, `LOVE`, `MISC`, `TECH`</p><p>This was not an academic benchmark. It was a triage system. A sentence about lunch or scheduling did not deserve the same bandwidth as a sentence about credentials, financial operations, infrastructure failures, or internal conflict.</p><p>Once the task was framed that way, the hardware constraints started to matter in a much more concrete way. The target platform was a Teensy 4.1: a 600 MHz Cortex-M7 with about 8 MiB of flash and 1 MiB of RAM. That is generous for a microcontroller and tiny for modern NLP, which meant the design had to stay small, deterministic, and easy to reproduce in C++.</p><p>That also changed how I thought about the data. The final cleaned dataset contained 24,842 labeled French samples, but the real work was not chasing architectural novelty. It was finding where the classifier was confused and reshaping the data to address those cases: `TECH` versus `CYBER`, `INFRA` versus `ACCOUNTING`, `HR_COMPLAINT` versus `GOSSIP`, and the always awkward `MISC` class. Under tight constraints, a small model has very little room to waste capacity on noisy labels, generator artifacts, or vague boundaries, so data quality mattered a lot.</p><p>Once the task, the hardware budget, and the data constraints were all clear, the next question became straightforward: what kind of pipeline could actually fit?</p><h3>The pipeline</h3><p>The final pipeline was intentionally simple:</p><p>1. Normalize the text.<br>2. Extract symbolic features from it.<br>3. Hash those features into a fixed-size vector.<br>4. Feed that vector to a small MLP classifier.</p><p>This was the key simplification. Instead of storing a vocabulary and an embedding table, the system used deterministic text processing: lowercase, accent removal, punctuation cleanup, truncation to the first 25 words, then a mix of character n-grams, word unigrams, bigrams, trigrams, and positional markers. Those features were hashed into a vector of length `8192`.</p><p>That fixed-size representation solved several problems at once. It kept memory usage predictable, avoided shipping a live vocabulary to the device, and made the Python pipeline reproducible in embedded C++. But to understand why that helps, one idea needs to be very clear first: the idea of a bucket.</p><h3>What a bucket actually is</h3><p>This was the part I found hardest to explain clearly at first.</p><p>A phrase is converted into one vector of length `8192`. You can picture it as an array with positions numbered from `0` to `8191`. Each position is a bucket. At the start, every bucket contains `0`.</p><p>So yes: each phrase becomes one 8192-dimensional vector. Not 8192 separate vectors, and not a custom number of features that changes with the sentence. Every phrase is projected into the same fixed space.</p><p>That is where hashing comes in. We never store a live vocabulary. Instead, every symbolic token produced by the feature extractor is sent through a hash function and assigned to one of those 8192 buckets. Once that idea is clear, the rest of the pipeline becomes much easier to read.</p><h3>How a sentence becomes a vector</h3><p>Take this french sentence:</p><p>`Le serveur principal est down`</p><p>Here is what happens, step by step.</p><p><strong>1. Normalize the text.</strong><br> Lowercase it, strip accents, remove punctuation, and keep only the first 25 words. <br> Here we get:</p><p>`[“le”, “serveur”, “principal”, “est”, “down”]`</p><p><strong>2. Generate character-level tokens.</strong><br> Each word is padded with angle brackets to mark word boundaries. <br> `serveur` becomes `&lt;serveur&gt;` <br> Then the code extracts overlapping character n-grams. Depending on the configured range, that gives tokens such as:</p><p>`C_&lt;se`, `C_ser`, `C_erv`, `C_rve`, `C_veu`, `C_eur`, `C_ur&gt;`</p><p><strong>3. Generate word-level tokens.</strong><br> The same sentence also produces:</p><p>`W_le`, `W_serveur`, `W_principal`, `W_est`, `W_down`</p><p><strong>4. Generate phrase tokens.</strong><br> Local context is captured with bigrams and trigrams:</p><p>`B_le_serveur`, `B_serveur_principal`, `B_principal_est`, `B_est_down`</p><p>and possibly:</p><p>`T_le_serveur_principal`, `T_serveur_principal_est`, `T_principal_est_down`</p><p><strong>5. Add position tokens.</strong><br> The first and last words are marked explicitly:</p><p>`POS_START_le`, `POS_END_down`</p><p>At this point, the sentence is no longer just raw text. It has become a collection of symbolic signals. The next step is to place those signals into the fixed vector space.</p><p><strong>6. Hash each symbolic token into a bucket.</strong><br> Each token is hashed with MurmurHash3, then mapped to one bucket with:</p><p>`j = abs(h(token)) mod 8192`</p><p>If `W_serveur` hashes to `1532`, that means bucket `1532` in the sentence vector will be updated. If `C_ser` hashes to `287`, then bucket `287` will be updated. Those bucket numbers are not meaningful by themselves. What matters is that the mapping is deterministic.</p><p>Hashing tells us *where* a token contributes. The next question is *how much* it contributes.</p><p><strong>7. Apply a signed weighted update.</strong><br> In the current extractor, each token updates the vector with:</p><p>`x[j] += s(token) * w(token)`</p><p>where:</p><p>- `x` is the 8192-dimensional vector<br> — `j` is the bucket index<br> — `s(token)` is either `+1` or `-1`<br> — `w(token)` is the weight of that feature family</p><p>So if `W_serveur` lands in bucket `1532` with positive sign and weight `9.2`, then `x[1532]` becomes `+9.2`. If `C_ser` lands in bucket `287` with negative sign and weight `3.1`, then `x[287]` becomes `-3.1`.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GrxAKjMUMbjtE8lumkdTOQ.png" /><figcaption>Tokenization process visualized</figcaption></figure><p><strong>8. Repeat for every token in the sentence.</strong><br> When the process ends, most buckets are still zero. Only a small subset has been touched. That final sparse vector is what the classifier sees.</p><p>This is the important intuition: the word `serveur` does not become one coordinate. It becomes a small cloud of contributions spread across the vector through character fragments, word tokens, phrase tokens, and sometimes positional markers.</p><p>If two different tokens land in the same bucket, that is a collision. It sounds bad, but it is the trade-off that keeps the representation small enough to deploy. With enough buckets and useful feature families, collisions behave like manageable noise rather than a complete failure.</p><p>Once the mechanics of the vector are clear, one more part of the design starts to matter: not every token family should contribute equally.</p><h3>Why the weights matter</h3><p>Not all token families carry the same kind of information.</p><p>In practice, word-level tokens tend to carry the strongest weight, character n-grams help with noisy spelling and variations, and bigrams or trigrams add local context. The result is not just a bag of hashed tokens. It is a weighted combination of several views of the same sentence.</p><p>That matters because it explains why the system holds up on short, messy text. If the exact word changes slightly, the character n-grams still carry signal. If the wording is clean, the unigrams and phrase tokens give stronger semantic anchors. All of that ends up in the same fixed vector.</p><p>At that stage, the remaining problem is no longer feature design in principle. It is parameter tuning in practice.</p><h3>Moving through the parameters space</h3><p>There were too many interacting parameters to tune by hand. The feature extractor had its own knobs, such as the relative weights of word tokens, character n-grams, bigrams, and trigrams. The classifier added more choices with hidden-layer sizes, activation function, regularization, and learning rate. Changing one of these could affect the usefulness of the others, which made manual tuning slow and unreliable.</p><p><strong>That is where Optuna came in.</strong></p><p>Optuna is a hyperparameter optimization framework. In simple terms, it automates the part of machine learning where you would otherwise spend hours changing parameters by hand, retraining, checking the results, and repeating the process. Instead of guessing which combination of settings might work best, you define a search space, for example the weight of character n-grams, the size of the hidden layers, or the learning rate, and Optuna runs many training trials to explore that space for you.</p><p>For this project, that meant turning parameter tuning into a structured search. Each trial trained a candidate configuration, measured its performance, and used that result to guide the next trials toward more promising regions of the space.</p><p>It tuned:</p><p>- the weights of each feature family<br>- the minimum and maximum character n-gram sizes<br>- the hashed input size<br>- the two hidden-layer widths of the MLP<br>- the activation function<br>- the regularization strength<br>- the learning rate</p><p>The objective was not just raw accuracy. In a multi-class system like this, raw accuracy can hide a weak class. So the search favored more balanced behavior: balanced accuracy, mean recall, minimum class recall, and resistance to overfitting.</p><p>That matters because a search procedure is only useful if it produces a model that is not just accurate on average, but actually usable under the original hardware constraints.</p><h3>What it achieved</h3><p>Across the Optuna runs, the model family settled in the low-90% range on the held-out test set, which was the first sign that the idea was actually viable. The most convincing compact checkpoint in the workspace reached 91.65% balanced accuracy, with 84.06% recall on the weakest class, while staying around 1.51 MiB in float32. That mattered because it showed the project was not just an interesting prototype on a laptop: it was small enough to start making sense on a microcontroller.</p><p>For the concrete sentence-level demonstration below, I recreated the strongest committed checkpoint and used it as the reference model. That version has 529,227 parameters, occupies about <strong>2.02 MiB</strong> in float32, and drops to roughly <strong>0.505 MiB</strong> once quantized to INT8, a reduction of about 75%. On a Teensy 4.1, that makes the real constraint very clear: the problem is mostly flash, not RAM. The temporary buffers stay relatively small; the weights are what dominate the footprint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYgSB6JPwmQBLA7agxdVdg.png" /><figcaption>Overall model performances</figcaption></figure><p>Numbers alone are not very satisfying, though. A balanced accuracy score tells you the model is doing something useful, but it does not tell you how it behaves on actual phrases. To make that visible, I built a small sentence suite with one clean sentence and one typo variant for each class. The goal was not to create a benchmark in the academic sense, but to test whether the model still behaved sensibly on short, realistic phrases of the kind it was meant to triage locally.</p><p>On that suite, both the float and quantized versions classified every sentence correctly. More importantly, the confidence scores stayed almost identical after quantization. In other words, reducing the storage cost changed the memory story far more than it changed the model’s behavior. That is exactly what you want in an embedded setting: smaller weights without suddenly making the classifier erratic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hsPSTTZmgMqh4QKq-gCmLQ.png" /></figure><p>I also wanted the evaluation to stay readable by a human. Instead of hiding everything behind aggregate metrics, the sentence suite shows the actual phrases that were used for the test, along with their typo variants. That makes the results easier to trust, because you can judge whether the classifier is reacting to meaningful signals rather than to some accidental artifact of the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUh-n3CJby7bQ7Po1DF6Dw.png" /></figure><p>That brings the project back to its original purpose. The point was never to put AI on a microcontroller for the spectacle of it. The point was to solve a physical constraint: a hidden implant with a very narrow covert channel could not afford to send everything. It needed to decide locally which text was worth the cost of transmission. Once the model became small enough to fit, stable enough to reproduce, and accurate enough to filter useful content from ordinary noise, the whole approach stopped being a gimmick and started making engineering sense.</p><h3>What I took from it</h3><p>That is what I like about this project. The classifier was not there because it was fashionable. It was there because bandwidth made it the cleanest solution.</p><p>In the end, this was less a story about model ambition than about fitting the right amount of intelligence into the right place. A hidden keyboard implant with a LoRa channel did not need a general language model. It needed a small on-device filter that could decide which messages were worth sending.</p><p>That is exactly what this project became.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ac8e9d17b99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding TLS and certificates]]></title>
            <link>https://medium.com/@armeldemarsac/understanding-tls-and-certificates-c5e4b99d6e59?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5e4b99d6e59</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[tls]]></category>
            <category><![CDATA[tls-certificate]]></category>
            <category><![CDATA[httpscertificate]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Thu, 31 Jul 2025 14:56:16 GMT</pubDate>
            <atom:updated>2025-08-01T08:51:46.432Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever sailed the waters of the world wide web you’ve learned to trust, as sailors once trusted the familiar beam of a lighthouse, the small lock icon next to any website’s address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*5FojtUZ6hZ7KWt76s3wt9Q.png" /></figure><p>When it comes however to understanding the intricacies of said lighthouse, things tend, as always in this tech world, to get a bit more complicated. Worry no more traveler ! In this short post, I’ll guide you through the abyss of TLS. First, a bit of context!</p><h3>Warming up</h3><h4>Context</h4><p>What is a website ? Really it’s just a process running on a distant computer we call a server. This process generally has a UI that humans can understand and navigate. The thing is, as intuitive modern web interfaces have become, we still have to access them in a human friendly way.</p><p>In our phones we have hundreds of contacts. Do we memorize their phone numbers? God no!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fYS-thcddUNBqVTw.png" /><figcaption>2000s have called and they want their cheesy memes back</figcaption></figure><h4>It always comes down to DNS</h4><p>If I want to call Jane, I just look for Jane’s name in my phone and call here straight away. I don’t even know her phone number.</p><p>Guess what, the same principle applies to the internet. If I want to go on Medium I don’t just type Medium’s server IP in my search bar, I use their domain name: medium.com. Does this replace IPs entirely? Sadly no, routers need IPs to understand how to route you request to Medium’s servers. Check my <a href="https://medium.com/@armeldemarsac/the-intricacies-of-internet-routing-and-bgp-db86b9ac16bd">short post</a> about internet routing to dive deeper in this subject.</p><p>Basically your browser will first query a giant contat list, the DNS server, to find the IP of the site you’re looking for, then when this address is retrieved it will send the request to your nearest router that will, in turn, send it to the web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i_VqqX2dhg099u7FQixZ9w.png" /><figcaption>The DNS resolution process, notice the importance of the router</figcaption></figure><h4>Vulnerabilites</h4><p>We can see one big problem with this system: the browser has to first retrieve the IP corresponding to the domain name. This means that theoretically, someone could just create a clone of the Medium’s UI, host it on a publicly accessible server and edit the DNS records for medium.com to have his IP listed instead of the official one. You wouldn’t notice a thing and possibly send to this fake site your Medium’s credentials.</p><p>It’s pretty hard to do because it would mean getting admin access to Medium’s DNS records. But there is an even simpler way: ARP poisoning. In this man in the middle attack, a malicious actor will impersonate your router so that, when the DNS resolution process occurs, it will give the IP of the malicious Medium clone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zy82Vis88qTe7hrabsNrSA.png" /><figcaption>In this setup the router is bypassed entirely, which means the attacker is using its own means to reach the internet (4g modem, etc). However the attacker could still use it to forward the traffic to the malicious website</figcaption></figure><p>Furthermore a malicious actor could also intercept plain http communications with the upstream server to retrieve sensitive data.</p><h4>What we need</h4><p>Given the potential for attacks, we would need a way to make sure the server we’re sending our request to is who he claims to be. We also need all of our communications with the server to be encrypted so an external attacker cannot read them.</p><h3>Is it you, John Wayne?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*HW3dOpDrtT8xMGRm.jpg" /><figcaption>What the server sees each time a client tries to establish a TCP session with him.</figcaption></figure><p>Let’s say the DNS query for medium.com returned an IP, our client will try to establish a TCP session with said IP but, first, we want to make sure who we are talking to. We need to know if the ip we got from our DNS query for medium.com is actually a medium.com official IP. But how so?</p><p>As humans we faced the same challenge. As our societies grew larger we had to find a way to build trust between individuals. How can I be sure as a landlord who I am leasing to? By establishing ID cards. Documents issued by the government to prove someone’s identity. Of course we don’t want anybody just printing its own ID card, we need this document to be trustworthy so we embed in it a lot of security measures to deceive counterfeiters: a chip, holographic elements, bumps and crevasses, in short a lot of elements that all add up to its credibility. When you think about it it’s the same for our money bills: they’re so incredibly complex and hard to replicate that we can be sure the money we got is actually issued by the government.</p><h4>Numerical ID card</h4><p>So why not provide our server with an ID card? Something that would contain the domain name and prove that the server is who he claims to be. When a client wants to connect to establish a connection with it, it asks for its ID card and then checks the domain name provided with the one returned by the query. If they match then our client knows it’s a legit website. If not it just blocks the connection.</p><p>We call these server ID cards TLS certificates and you can find them in multiple flavors:</p><ol><li>Certificate of authority: This is the “root” certificate. If I go back to our analogy it’s like a government official seal, top trusted. It’s not on the server but on your browser! Yes, every browser comes bundled with these official certificates.</li><li>Intermediate certificates: This bridges the gap between the certificate of authority and our server certificates, it mentions the organization name, country and some useful ID details. This one, along with the next one, is on the server.</li><li>Server certificates: This is the last one, it mentions the domain names that the servers on which it is located cover.</li></ol><p>When our client tries to establish a connection with the server, it receives the intermediate certificates and the server certificates, it will use them both to verify if the server is who he claims to be. But… How ? Why use three certificates ? Why not just one? And why putting one certificate in our browser? At first glance it doesn’t make much sense. To understand, we need to jump back to our ID card analogy.</p><h4>Asymmetric cryptography</h4><p>As useful as they are, all the physical security measures embedded into the money and ID cards we’re used to trust have a crucial limitation: they’re physical. When we switch to the digital world we are much more limited because it always comes down to one and zeros. Anyone can replicate anything. How can I be sure that the server certificate I receive is legit and trustworthy? This is where asymmetric cryptography comes in.</p><p>What is asymmetric cryptography? Google it up! To put it shortly it’s the process of generating two related but different keys with one mathematical formula. We talk about one secret key, and one public key. They both have different but complementary capabilities. For example, If I encrypt a message with the public key, only the secret key will be able to decrypt it. Not the public key. Let’s say you’re a journalist, you could share your public key on your website. Anyone who wants to leak some top secret info can just use the public key to encrypt it, then only you, with your secret key, will be able to decode it. The opposite is true: if I encrypt a message with the secret key, only its public key would be able to decode it.</p><p>Generating a private key is as simple as this, you can use different algorithms, RSA for example.</p><pre>openssl genpkey -algorithm ED25519 -out private-key.pem</pre><p>The two keys being related, you can generate the public key from the previously created private key:</p><pre>openssl pkey -in private-key.pem -pubout -out public-key.pem</pre><p>Guess what, public and secret keys are the heart of creating TLS certificates, they’re even part of the bash command to create them! Let’s buckle on.</p><h3>TLS certificates: diving into the specifics</h3><h4>Certificate generation</h4><p>Remember the two keys we generated before? Let’s use ‘em.</p><pre>openssl req -x509 -new -key private-key.pem -out certificate.pem -days 365</pre><p>We will be prompted to enter our ID card details:</p><pre>You are about to be asked to enter information that will be incorporated<br>into your certificate request.<br>What you are about to enter is what is called a Distinguished Name or a DN.<br>There are quite a few fields but you can leave some blank<br>For some fields there will be a default value,<br>If you enter &#39;.&#39;, the field will be left blank.<br>-----<br>Country Name (2 letter code) [XX]:FR<br>State or Province Name (full name) []:Ile de France<br>Locality Name (eg, city) [Default City]:Paris<br>Organization Name (eg, company) [Default Company Ltd]:OtterCorp<br>Organizational Unit Name (eg, section) []:OtterComputerIntelligence<br>Common Name (eg, your name or your server&#39;s hostname) []:ottercorp.com<br>Email Address []:ottercorp@kotaro.com</pre><p>And there you go, we now have our certificate. To view it we can just enter this command:</p><pre>openssl x509 -in certificate.pem -text -noout</pre><pre>Certificate:<br>    Data:<br>        Version: 3 (0x2)<br>        Serial Number:<br>            0e:27:a3:74:d3:63:17:88:75:28:01:ac:5c:da:5d:87:f1:bc:ec:14<br>        Signature Algorithm: ED25519<br>        Issuer: C=FR, ST=Ile de France, L=Paris, O=OtterCorp, OU=OtterComputerIntelligence, CN=ottercorp.com, emailAddress=ottercorp@kotaro.com<br>        Validity<br>            Not Before: Jul 31 13:01:51 2025 GMT<br>            Not After : Jul 31 13:01:51 2026 GMT<br>        Subject: C=FR, ST=Ile de France, L=Paris, O=OtterCorp, OU=OtterComputerIntelligence, CN=ottercorp.com, emailAddress=ottercorp@kotaro.com<br>        Subject Public Key Info:<br>            Public Key Algorithm: ED25519<br>                ED25519 Public-Key:<br>                pub:<br>                    36:dc:b9:26:8b:5b:be:66:ec:a9:a3:5c:78:1d:a6:<br>                    8f:e2:55:9c:f1:ab:31:a5:43:1c:3e:ec:a1:a5:c4:<br>                    6a:b8<br>        X509v3 extensions:<br>            X509v3 Subject Key Identifier: <br>                B8:E5:51:ED:94:92:BB:38:6D:E7:E2:E5:7B:D1:62:71:82:F7:BE:18<br>            X509v3 Authority Key Identifier: <br>                B8:E5:51:ED:94:92:BB:38:6D:E7:E2:E5:7B:D1:62:71:82:F7:BE:18<br>            X509v3 Basic Constraints: critical<br>                CA:TRUE<br>    Signature Algorithm: ED25519<br>    Signature Value:<br>        90:3a:18:c6:08:04:69:98:a6:c7:cd:7e:20:da:29:6a:51:dd:<br>        7c:1f:ee:39:07:67:da:39:07:b7:ce:ed:06:c2:3f:0d:91:de:<br>        e8:fe:95:aa:c5:c7:78:91:85:90:9e:43:32:6f:0d:61:4e:d9:<br>        f9:51:c7:b7:2e:90:61:21:09:0a</pre><p>We can visualize the whole process with this schema. The “Ca creation process” is the command we just ran.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Km3flGxiMBZdhLxqJeapA.png" /><figcaption>Root CA generation process</figcaption></figure><h4>Certificate authenticity</h4><p>Take a look at the certificate above. Did you notice the <em>signature</em> block?</p><pre>Signature Algorithm: ED25519<br>    Signature Value:<br>        90:3a:18:c6:08:04:69:98:a6:c7:cd:7e:20:da:29:6a:51:dd:<br>        7c:1f:ee:39:07:67:da:39:07:b7:ce:ed:06:c2:3f:0d:91:de:<br>        e8:fe:95:aa:c5:c7:78:91:85:90:9e:43:32:6f:0d:61:4e:d9:<br>        f9:51:c7:b7:2e:90:61:21:09:0a</pre><p>It’s the encrypted hash of the certificate data. The schema above shows you exactly where this signature comes from. When a recipient gets the certificate, he can just decrypt the encrypted hash with the provided public key, hash the infos and compare the two hashes together to verify data hasn’t been tempered with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EV-BAkHKTVh3VO1xbFE_Gg.png" /><figcaption>How to check that the ID informations haven’t been altered</figcaption></figure><p>Given the fact that you NEED the private key to create the checksum of the information we can be sure that, unless the attacker has compromised the server, then the ID data contained in the certificate is trustworthy.</p><p>If you’re following along you may be asking yourself: if the attacker is using a malicious clone of medium.com, then he will have control over this server and be able to issue a perfectly valid certificate with it’s own keypair. And you’ll be right! That’s where the certificates chain comes in.</p><h4>Different kind of certificates</h4><p>Remember when we talked about the three different types of certificates earlier? Root, intermediate and server. The certificate we just created is a root certificate. Why? Because it depends on nothing but itself: we self signed the certificate with the keypair we just created. This root CA, while perfectly valid for traffic between different services inside a server, cannot be used for public facing websites.</p><p>We’ve agreed on a standard: root certificates will be created by a few recognized organizations such as Let’s Encrypt (or the government in our previous analogy), and then baked into every web browser on earth. Security wise it’s not a problem, the public key can be sent to billion of devices so they can decrypt the signature made with the private key of said root CA.</p><p>When you want to create a certificate for your server, you go to Let’s Encrypt website and file a demand for a certificate bound to a domain name. Could you ask for a cert covering facebook.com? You could try but these authorities ask you to put a token in the DNS records of your namespace to prove that you’re the owner of said name. Good luck hacking facebook’s domain administration panel! If Let’s Encrypt finds the token in your DNS records, then the intermediate and server certificates are issued to you. Both of these two files will be presented to any browser that wants to check your server’s identity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yb4FI1PjHo2qFxycdGMhwg.png" /><figcaption>The certificates chain pictured</figcaption></figure><h4>The certificates chain of trust</h4><p>When a browser connects to a secure server, it receives the server’s certificate and the intermediate certificate. The browser then verifies the chain of trust in two steps:</p><ol><li>First, it uses the <strong>public key</strong> from the <strong>intermediate certificate</strong> to check the signature on the server certificate. This proves the server certificate is authentic and was correctly issued by that intermediate CA.</li><li>Next, the browser uses the <strong>public key</strong> of the <strong>Root CA</strong> — which is already built into its trusted list — to check the signature on the intermediate certificate. This proves the intermediate CA itself is legitimate and trusted.</li></ol><p>Because the server certificate is validated by the intermediate, and the intermediate is validated by a trusted root, the browser can be confident it is connected to the right server. Crucially, this check also guarantees the <strong>integrity</strong> of the certificate. Since the signature is created from a unique fingerprint (a hash) of the certificate’s data, a successful verification proves that information like the domain name has not been tampered with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YdCtJjmaPz8pFdGiVSmn2w.png" /><figcaption>The trust relationship between the three certificates illustrated</figcaption></figure><p>Remember the certificate creation schema above? If we want it to illustrate how intermediate and server certificates are issued we can edit it as such:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_csYT0bjv3odm-QTcIudRw.png" /><figcaption>But what are the server certificate’s public and private key for if it’s the last certificate of the chain?</figcaption></figure><h3>Encrypting traffic</h3><p>Now that we know that we’re talking to the right server, we want to make sure no one can know what we’re talking about. We could use cryptography to cipher our messages. So to establish a secure connection we need to exchange the needed keys… while the secure connection is not yet established. Anyone could read our keys. We have a chicken and egg problem.</p><h4>Asymmetric cryptography, again</h4><p>Take a look at the schema above. We learned that the key pairs were linking the certificates together so we can verify their authenticity. But then why generate a keypair for the server certificate as it is the last one? To verify its authenticity we can just use the public key A from the intermediate certificate. So why bother creating a keypair for it? If you’ve followed along you should know that if I encrypt something with the public key, only the associated private key will be able to decrypt it. Then… We got it! Once the certificates authenticity is proved, the client can just generate a small secret, encrypt it with the server certificate’s public key and send it back to the server which can, in turn, decrypt it with its private key.</p><h4>Symmetric cryptography, at last</h4><p>Now that the server and the client share a common secret, they can use it to generate the same secure keys to encrypt and decrypt traffic. For each session, both the client and server generate the following identical keys:</p><ul><li><strong>Encryption Keys:</strong> One key for encrypting data sent from the client to the server, and another for data from the server to the client. This ensures <strong>confidentiality</strong>.</li><li><strong>Integrity Keys (MAC Keys):</strong> One key for each direction to create a Message Authentication Code. This acts like a signature for every message, allowing the receiver to verify that the data has not been <strong>tampered with</strong> during transit.</li></ul><p>This ensures the connection is both private and protected from modification.</p><h3>Wrap up</h3><p>I hope this post helped you understand the intricacies of TLS and certificates. If you have any question or if you want to add something, feel free to comment this post. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5e4b99d6e59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Metallb with Kubernetes & OpenBSD]]></title>
            <link>https://medium.com/@armeldemarsac/integrating-metallb-with-kubernetes-openbsd-f5a4caf57136?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5a4caf57136</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[metallb]]></category>
            <category><![CDATA[kubernetes-networking]]></category>
            <category><![CDATA[bgp]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Wed, 30 Jul 2025 11:05:28 GMT</pubDate>
            <atom:updated>2025-07-30T11:05:28.778Z</atom:updated>
            <content:encoded><![CDATA[<p>You’ve built your app, deployed your cluster, applied deployment manifests, created the services, secrets and so on. There only one thing left to do, allow external traffic to reach your apps. How so ? Well if you ever deployed a Kubernetes cluster on EKS (I didn’t) you know that once your ingress service (nginx, Kong, Traeffik, etc) is deployed, it’s pretty much magical: your front facing service automatically gets bound to an ELB with an external IP. But cloud providers are expensive. Painfully expensive. So you decided to switch to a baremetal solution and now, you’re stuck: how can my ingress service get an external IP? That’s where MetalLB comes into play.</p><h3>Architecture and prerequisites</h3><p>This tutorial will be focusing on an on-premise deployment of Kubernetes as Metallb is not needed if you use GCP, AWS or Azure.</p><p>Metallb comes in two flavours, an ARP mode or a BGP mode. Here we’ll use its BGP mode.</p><p>Your Kubernetes nodes need to be on a VLAN managed by a switch/ router with BGP capabilities. If you have any compatibility issue, feel free to opt for their ARP mode which is broadly compatible. For this tutorial, we’ll be deploying all of the needed VMs using virtualbox directly on our computer and using an OpenBSD vm with BGP configured on it as a gateway.</p><h4>Why Metallb?</h4><p>When you create a Kubernetes cluster in a cloud environment like AWS, the LoadBalancer type services receive an external IP from AWS’s ELB. On prem however, there is no automated external system to attribute an external IPs to your LoadBalancer services. That’s where Metallb shines. Its role is to give to your services IPs from the VLAN range where their node lies.</p><h4>What is BGP ?</h4><p>The Border Gateway Protocol was made to allow servers to efficiently route traffic between them and discover routes. Please check <a href="https://medium.com/@armeldemarsac/the-intricacies-of-internet-routing-and-bgp-db86b9ac16bd">my post on this subject</a>.</p><h3>Preparing the gateway</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0Clv54ATPA4Sm3EZx878w.png" /><figcaption>An overview of the architecture used in our case</figcaption></figure><p><em>If your nodes are on a network with a BPG compatible router, skip this section and refer to your router’s documentation in order to configure BGP.</em></p><h4>Port forwarding &amp; VLAN</h4><p>First you’ll have to configure the gateway’s VM to enable NAT and port forwarding while also configuring it as a DHCP server to manage its own VLAN as it’s where the nodes will reside.</p><h4>BGP configuration</h4><p>Then we’ll define the BGP configuration.</p><pre># bgp.conf<br><br>AS 65001<br>router-id 192.168.10.1<br>listen on 192.168.10.1<br>holdtime 180<br>holdtime min 3<br>fib-update yes<br><br># What we allow MetalLB to announce<br>prefix-set metallb-ips {<br>    192.168.10.20/32<br>    192.168.10.21/32<br>    192.168.10.22/32<br>    192.168.10.23/32<br>    192.168.10.24/32<br>    192.168.10.25/32<br>    192.168.10.26/32<br>    192.168.10.27/32<br>    192.168.10.28/32<br>    192.168.10.29/32<br>    192.168.10.30/32<br>}<br><br># Inbound: allow worker nodes IPs<br>allow from 192.168.10.10 prefix-set metallb-ips</pre><p>From top to bottom:</p><ul><li><strong>AS 65001</strong>: Defines the local Autonomous System (AS) number for this BGP router. AS 65001 is a private AS number.</li><li><strong>router-id 192.168.10.1</strong>: Sets the unique identifier for this BGP router within the BGP network.</li><li><strong>listen on 192.168.10.1</strong>: Specifies the local IP address on which the BGP daemon will listen for incoming BGP connections.</li><li><strong>holdtime 180</strong>: Configures the BGP Hold Time (in seconds), the maximum time a BGP speaker will wait for a keepalive or update message from a neighbor before declaring the neighbor down.</li><li><strong>holdtime min 3</strong>: Sets the minimum acceptable Hold Time that a neighbor can propose during session negotiation.</li><li><strong>fib-update yes</strong>: Enables the BGP daemon to update the local Forwarding Information Base (FIB) or routing table with routes learned via BGP.</li><li><strong>prefix-set metallb-ips { ... }</strong>: Defines a named group of IP prefixes (/32 meaning single IP addresses) that are specifically designated for use by MetalLB.</li><li><strong>remote-as 64512</strong>: Specifies the AS number of the remote BGP peers in this group (also a private AS).</li><li><strong>allow from ... prefix-set metallb-ips</strong>: These are inbound BGP policies. They explicitly permit this BGP router to accept and install routes only for the IP addresses defined in the metallb-ips prefix-set, but <em>only</em> if those routes are received from the specified MetalLB neighbor IP addresses. This ensures that only the IPs managed by MetalLB are accepted from those specific peers. These are the nodes of our Kubernetes cluster.</li></ul><h4>Configuring the BPG client</h4><p>Then we’ll need to configure the BGP client. Fortunately, OpenBSD comes packaged with the BGP utility so we just have to copy the configuration file and enable it.</p><pre><br>- name: Copy bgp conf files<br>  ansible.builtin.copy:<br>    src: &lt;BPG_CONF_FILE_PATH&gt;<br>    dest: &quot;/etc/&quot;<br><br>- name: enable bgp<br>  ansible.builtin.command: rcctl enable bgpd<br>  <br>- name: start bgp<br>  ansible.builtin.command: rcctl start bgpd</pre><h3><strong>Installing Metallb</strong></h3><p>To install the app we’ll use Ansible with the following task:</p><pre>- name: Create MetalLB system namespace with labels<br>  kubernetes.core.k8s:<br>    state: present<br>    resource_definition:<br>      apiVersion: v1<br>      kind: Namespace<br>      metadata:<br>        name: metallb-system<br>        labels:<br>          pod-security.kubernetes.io/enforce: privileged<br>          pod-security.kubernetes.io/audit: privileged<br>          pod-security.kubernetes.io/warn: privileged<br><br>- name: Add MetalLB Helm repository<br>  kubernetes.core.helm_repository:<br>    name: metallb<br>    repo_url: https://metallb.github.io/metallb<br><br>- name: Update Helm repositories<br>  shell: helm repo update<br>  changed_when: false<br><br>- name: Copy MetalLB value files<br>  ansible.builtin.copy:<br>    src: &quot;&lt;PATH_TO_RESSOURCES&gt;&quot;<br>    dest: &quot;&lt;PATH_TO_RESSOURCES&gt;&quot;<br>    mode: &#39;0644&#39;<br>    backup: yes<br><br>- name: Check if MetalLB is already installed<br>  shell: helm list -n metallb-system --output json<br>  register: metallb_helm_check<br>  changed_when: false<br>  failed_when: false<br><br>- name: Enable strict ARP and switch kube-proxy to ipvs mode<br>  shell: |<br>    kubectl get configmap kube-proxy -n kube-system -o yaml | \<br>    sed -e &#39;s/strictARP: false/strictARP: true/&#39; \<br>        -e &#39;s/mode: &quot;&quot;/mode: &quot;ipvs&quot;/&#39; | \<br>    kubectl apply -f -<br>  when: &quot;&#39;metallb&#39; not in metallb_helm_check.stdout&quot;<br><br>- name: Restart kube-proxy pods<br>  shell: kubectl delete pods -n kube-system -l k8s-app=kube-proxy<br>  when: &quot;&#39;metallb&#39; not in metallb_helm_check.stdout&quot;<br><br>- name: Install MetalLB using Helm<br>  kubernetes.core.helm:<br>    name: metallb<br>    chart_ref: metallb/metallb<br>    namespace: metallb-system<br>    create_namespace: true<br>    values_files:<br>      - &lt;PATH_TO_VALUES&gt;<br>    timeout: 600s<br>  when: &quot;&#39;metallb&#39; not in metallb_helm_check.stdout&quot;<br>  register: metallb_installed<br><br>- name: Wait for 60 seconds for MetalLB to be ready<br>  ansible.builtin.pause:<br>    seconds: 60<br><br>- name: Apply all MetalLB resources from directory<br>  shell: kubectl apply -f &lt;PATH_TO_RESSOURCES&gt;<br>  register: kubectl_apply_result<br>  changed_when: &quot;&#39;configured&#39; in kubectl_apply_result.stdout or &#39;created&#39; in kubectl_apply_result.stdout&quot;<br>  failed_when:<br>    - kubectl_apply_result.rc != 0<br>    - &quot;&#39;no objects passed to apply&#39; not in kubectl_apply_result.stderr&quot;<br>  when: &quot;&#39;metallb&#39; not in metallb_helm_check.stdout&quot;</pre><p>You can customize <a href="https://github.com/metallb/metallb/tree/main/charts/metallb">Metallb helm values</a> as you want, for this tutorial we’ll use the chart’s default values. The task copies Metallb’s ressource files defined later in the post.</p><h4>Understanding Metallb components</h4><pre>[root@controlserver gateway]# kubectl get pods -n metallb-system<br>NAME                                 READY   STATUS    RESTARTS   AGE<br>metallb-controller-ccdf5cd85-7fcgr   1/1     Running   0          3d7h<br>metallb-speaker-59cnl                4/4     Running   0          3d7h<br>metallb-speaker-65sgl                4/4     Running   0          3d6h<br>metallb-speaker-dqvcf                4/4     Running   0          3d7h<br>metallb-speaker-h5jlb                4/4     Running   0          3d6h</pre><p>The app is made of a controller, who assigns requested IPs to Kubernetes LoadBalancer services, and speakers, deployed on every node. When they detect that a pod with a service of type LB is deployed on their node, they tell the router “hey, if you’re looking for 192.168.10.20, please forward it to me, I’ll handle the rest”.</p><h4>Configuring Metallb</h4><p>The first step is to define the BGP peers , the router that manages the VLAN of our nodes. Note that the ASNs match those defined above in bgp.conf .</p><pre>apiVersion: metallb.io/v1beta2<br>kind: BGPPeer<br>metadata:<br>  name: openbsd-gateway<br>  namespace: metallb-system<br>spec:<br>  peerAddress: 192.168.10.1        # OpenBSD Gateway&#39;s IP<br>  peerASN: 65001                   # OpenBSD Gateway&#39;s ASN<br>  myASN: 64512                     # Metallb&#39;s ASN</pre><p>Thanks to this resources, all of our metallb speakers will know who to broadcast their routing information to. In our case it’s the OpenBSD gateway that manages the VLAN, hence the 192.168.10.1 ip.</p><p>Next, we’ll define a set of ip address that Metallb can actually assign to our services of type LoadBalancer .</p><pre>apiVersion: metallb.io/v1beta1<br>kind: IPAddressPool<br>metadata:<br>  name: lan-pool<br>  namespace: metallb-system<br>spec:<br>  addresses:<br>  - 192.168.10.20-192.168.10.30</pre><p>Be aware that your DHCP server has to be aware that this IP range cannot be used to assign IPs to new nodes in the VLAN.</p><p>At last, we just have to tell Metallb that it can use the IP pool we just defined:</p><pre>apiVersion: metallb.io/v1beta1<br>kind: BGPAdvertisement<br>metadata:<br>  name: default<br>  namespace: metallb-system<br>spec:<br>  aggregationLength: 32<br>  ipAddressPools:<br>  - lan-pool</pre><h3>Using Metallb</h3><p>Now that everything is setup, it’s time to test the system! We have two ways of attributing IPs to our front facing services. Tag them with the MetalLB annotation and declare a static IP, useful if you have only one gateway that you want to port forward to from your firewall. The other way is to let MetalLB do its magic. If it sees a service of type LoadBalancer, it will automatically try to assign it an external IP from its pool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5a4caf57136" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kong Gateway Operator and KIC, understanding the differences]]></title>
            <link>https://medium.com/@armeldemarsac/kong-gateway-operator-and-kic-understanding-the-differences-a4ae2a3f5775?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4ae2a3f5775</guid>
            <category><![CDATA[kong]]></category>
            <category><![CDATA[kong-gateway-operator]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kong-gateway]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Fri, 25 Jul 2025 17:51:19 GMT</pubDate>
            <atom:updated>2025-07-25T17:51:19.735Z</atom:updated>
            <content:encoded><![CDATA[<p>You were planning to deploy a Kubernetes cluster and stumbled onto the Kong offer when trying to decide for an ingress solution. The offer however is a bit unclear: they have three completely different helm charts, documentation about resources that seem related while a bit different, in short its a documentation overload!</p><h3>The Kubernetes Gateway API</h3><p>Fundamentally Kong relies on Kubernetes new standard for inbound traffic: the <a href="https://gateway-api.sigs.k8s.io/">Gateway API</a>. The naming can be a bit confusing though. The API here is a reference to a set of standards, not an actual API server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*1gcUqSZ7Wc8v7emh.png" /><figcaption>schema to visualize how the crds interact</figcaption></figure><p>I wont dive deeper into the Gateway API as it’s a big chunk to dissect. Just know Kong use these CRDs.</p><h3>The Kong components</h3><p>No matter the deployment topology, Kong always deploys these two components:</p><h4>The gateway</h4><p>Also called:</p><p>. “Kong Gateway”</p><p>. “Data Plane”</p><p>It’s the core of Kong, the software actually handling and routing the requests to the upstream services.</p><h4>The ingress controller</h4><p>Also called:</p><p>. “KIC”</p><p>. “Kong Ingress Controller”</p><p>. “Control Plane”</p><p>It’s the program that transforms the kubernetes routing objects into configuration that the gateway can understand. Its role is to apply the user’s routing configuration like httpRoute, TLSRoute or GRPCRoute to the dataplane.</p><p>These two software are directly deployed when you use the helm charts <a href="https://github.com/Kong/charts/tree/main/charts/ingress">kong/ingress</a> or <a href="https://github.com/Kong/charts/tree/main/charts/kong">kong/kong</a>. You can also customize which component you want to deploy. You could use a kong/kong helm chart to only define the dataPlane and another one to only deploy the controlPlane. The deployment philosophy is centered around the helm chart where you can configure every aspect of the deployment. You then push new configurations to the deployed gateway by applying the CRDs from the Kubernetes Gateway API.</p><p>In the helm charts and in the docs you’ll find mentioned the admin api, this is the legacy way of configuring Kong, using their API and ressource definition. As things went by, they moved towards a deeper integration with Kubernetes, using Kubernets Gateway Api ressources definitions and their own CRDs.</p><h3>Evolving towards a deeper integration with Kubernetes</h3><p>This approach, while very flexible and convenient posed some challenges, mainly when it came to orchestrate gateway deployment across multiple environments but also regarding maintainability. The helm charts, while convenient also added some complexity config wise.</p><h4>Kong Gateway Operator</h4><p>That’s why Kong introduced the Kong Gateway Operator, a more Kubernetes oriented approach of deploying and managing the gateway and its controller. It introduces a third Kong resource to the equation: the Kong Gateway Operator. This pod is responsible for deploying and scaling the gateway and its operator(s). It is deployed inside the cluster.</p><p>Instead of defining all of the options in the helm chart, you define them in a new CRD, the GatewayConfiguration object.</p><pre>kind: GatewayConfiguration<br>apiVersion: gateway-operator.konghq.com/v1beta1<br>metadata:<br>  name: kong<br>  namespace: kong<br>spec:<br>  dataPlaneOptions:<br>    network:<br>      services:<br>        ingress:<br>          type: LoadBalancer<br>          name: gateway-lb<br>          annotations:<br>            metallb.io/loadBalancerIPs: 192.168.10.20<br>    deployment:<br>      podTemplateSpec:<br>        spec:<br>          containers:<br>          - name: proxy<br>            image: armeldemarsac/kong-oidc:4.0.0<br>            imagePullPolicy: Always<br>            env:<br>              - name: KONG_DATABASE<br>                value: &quot;off&quot;<br>              - name: KONG_PLUGINS<br>                value: &quot;bundled,oidc,jwt-keycloak&quot;<br>              - name: KONG_LOG_LEVEL<br>                value: &quot;debug&quot;<br>  controlPlaneOptions:<br>    deployment:<br>      podTemplateSpec:<br>        spec:<br>          containers:<br>          - name: controller<br>            image: kong/kubernetes-ingress-controller:3.5<br>            env:<br>            - name: CONTROLLER_LOG_LEVEL<br>              value: debug</pre><p>In this file you can define a “template” you want to use for your control planes and data planes. The kong gateway options are defined in the “dataPlaneOptions” section. You can find more infos about the CRD on its <a href="https://developer.konghq.com/operator/reference/custom-resources/#gatewayconfigdataplaneoptions">official documentation</a>. The “controlPlaneOptions” on the other hand, allows you to configure the ingress controller. CRD documentation can be found <a href="https://developer.konghq.com/operator/reference/custom-resources/#controlplaneoptions">here</a>.</p><p>But do this file actually deploys our data and control planes ? The answer is… No! While the helm chart approach actually deploys the gateway and controller pods, this is not the spirit here. As you remember KGO was thought as a kubernetes native approach. This means that instead of using Kong custom helm chart to deploy and customize your planes, you’ll use the CRDS defined by the <a href="https://gateway-api.sigs.k8s.io/">Kubernetes Gateway Api specs</a>.</p><p>For the Gateway Operator to actually deploy a dataplane and its master controlplane, you’ll first have to define the GatewayClass and Gateway ressources.</p><pre>kind: GatewayClass<br>apiVersion: gateway.networking.k8s.io/v1<br>metadata:<br>  name: kong<br>  namespace: kong<br>spec:<br>  controllerName: konghq.com/gateway-operator<br>  parametersRef:<br>    group: gateway-operator.konghq.com<br>    kind: GatewayConfiguration<br>    name: kong<br>    namespace: kong</pre><pre>apiVersion: gateway.networking.k8s.io/v1<br>kind: Gateway<br>metadata:<br>  name: kong<br>spec:<br>  gatewayClassName: kong<br>  listeners:<br>  - name: global-https<br>    port: 443<br>    protocol: HTTPS<br>    hostname: &quot;otterstack.local&quot;<br>    tls:<br>      mode: Terminate<br>      certificateRefs:<br>        - kind: Secret<br>          name: global-cert-secret<br>    allowedRoutes:<br>      namespaces:<br>        from: All</pre><p>I’ll delve into Gateway API CRDs in a specific post.</p><p>It’s only when these two components are defined and applied that the gateway operator can actually apply the configuration and spin up the dataplane and its dedicated controlplane that is responsible for managing its routing behavior.</p><h3>Growing</h3><p>The great thing about KGO is that deploying new Gateways is as simple as creating a new Gateway file and applying it.</p><pre>apiVersion: gateway.networking.k8s.io/v1<br>kind: Gateway<br>metadata:<br>  name: kong-cp<br>spec:<br>  gatewayClassName: kong<br>  listeners:<br>  - name: global-https<br>    port: 444<br>    protocol: HTTPS<br>    hostname: &quot;otterstack.local&quot;<br>    tls:<br>      mode: Terminate<br>      certificateRefs:<br>        - kind: Secret<br>          name: global-cert-secret<br>    allowedRoutes:<br>      namespaces:<br>        from: All</pre><pre>[root@controlserver gateway]# kubectl get pods -n default<br>NAME                                               READY   STATUS    RESTARTS        AGE<br>controlplane-kong-2v8hp-n9gx6-5c95db95dd-ndmsg     1/1     Running   12 (3d2h ago)   3d3h<br>controlplane-kong-cp-qwkd8-cmtmm-7d58fd765-jwkw8   1/1     Running   0               40m<br>dataplane-kong-4psvh-qbf5r-996b57f6b-f5cgt         1/1     Running   0               45h<br>dataplane-kong-cp-ncvq8-sndxk-7cd4557499-m62fq     1/1     Running   0               40m</pre><p>As you see the KGO operator has detected the new GatewayObject and automatically applied it to our cluster by launching a new pair CP/DP.</p><p>For it to work however, I had to modify the GatewayConfiguration shown above:</p><pre>network:<br>      services:<br>        ingress:<br>          type: LoadBalancer<br>          name: gateway-lb<br>          annotations:<br>            metallb.io/loadBalancerIPs: 192.168.10.20</pre><p>Here I was assigning an IP to the LoadBalancer service exposing the gateway to the outside VLAN, using MetalLB (on prem cluster). This section being used as a template, it prevented the KGO to spin up a new dataplane because the service name and ips would be identical, thus creating a conflict. To avoid any issue I modified the network section as follows:</p><pre>network:<br>      services:<br>        ingress:<br>          type: LoadBalancer</pre><p>Here we let MetalLB, which is listening for LoadBalancer type services, automatically assign an IP from its defined pool to the LB services. No more naming and IP conflict.</p><pre>apiVersion: metallb.io/v1beta1<br>kind: IPAddressPool<br>metadata:<br>  name: lan-pool<br>  namespace: metallb-system<br>spec:<br>  addresses:<br>  - 192.168.10.20-192.168.10.30</pre><h3>Limitations</h3><p>While the Kong Gateway Operator aims for comprehensive Gateway API support, it’s crucial to be aware of current limitations. As of KGO v1.6.1, the Operator <strong>does not fully support advanced routing types like </strong><strong>TLSRoute</strong>. This means if your use case requires TLSRoute for functionalities such as TLS Passthrough, you might still need to rely on direct deployments using the kong/kong or kong/ingress Helm charts, where the embedded Kong Ingress Controller <em>does</em> offer TLSRoute capabilities. Please consult the official Kong Gateway Operator documentation for the latest feature support matrix. You can also check the <a href="https://github.com/Kong/kong-operator/issues/64">opened issue</a>, the feature was planned for KGO 2.0.0 but has been removed from the milestone so no idea when this will become available. You can rely on Kubernetes’s <a href="https://gateway-api.sigs.k8s.io/api-types/backendtlspolicy/">BackendTLSPolicy</a> if your upstream services requires TLS.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4ae2a3f5775" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The intricacies of internet routing and BGP]]></title>
            <link>https://medium.com/@armeldemarsac/the-intricacies-of-internet-routing-and-bgp-db86b9ac16bd?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/db86b9ac16bd</guid>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[internet-traffic]]></category>
            <category><![CDATA[bgp]]></category>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 17:27:00 GMT</pubDate>
            <atom:updated>2025-07-25T11:19:48.359Z</atom:updated>
            <content:encoded><![CDATA[<p>Depending on your linux and networking skills, you necessarily have, one day or another, ran this classic command to diagnose a networking error :</p><pre>ping google.com</pre><p>Simple, right ? Send an ICMP ping request to Google’s servers, get a response back. But have you ever delve under beyond this ? Went looking for the other half of the iceberg ? Well, I have and I would like to tell you a bit more about it.</p><h3>We don’t call it web for nothing</h3><p>Wifi, 5G, modems, we’re so used to accessing a network by selecting one in a networking menu that we might have loose sight of what internet really is: a PHYSICAL network, made of 10 of thousands of kilometers of cables, layed accross continents and oceans. Yes, as one famously said: it even works… Under water! The wireless access points we so often use are the termination points of this giant squid we call the web.</p><h3>Cable management</h3><p>As we know, being about a desk or the world wide web, cable management is fundamental. Are the both of them as simple however ? Not really. The thing is, as simple as building a network could be -after all, building a network is as simple as plugin two computers together- it tends to get a bit harder when you want to connect every device on earth with one another. Let’s try a simple thought experiment: how to connect 7 computers together? To do it we’ll plug at the back of each computer, 6 cables going to every computer in the room so that they can talk together and, while we’re at it, model it with a schema:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y90Nk2pkcLTS-JANEwS-Zg.png" /></figure><p>Every computer is linked to the 6 others and they can all talk with each other. Functional but a glorious mess. Now imagine replicating this approach to the billion of devices composing the internet. We would run out of optic fiber and available ports quickly!</p><h3>Cable management, part two</h3><p>To organize things a bit, we’ve quickly come for a solution: using routers. Routers are small hubs that manage the communication of machines in their network. This way we just have to connect our 8 computers to one router.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cjPOaz30cvrsdqK4PBOnQ.png" /></figure><p>Now every computer is connected to another one. If it has something to say to another machine, it just sends its letter to the router and let it do its magic. But what about the world wide web, you might add? Well we just replicate the same approach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4m0TRJhdrpRa--1qtHrirw.png" /><figcaption>It’s not always possible to plug two data centers directly together due to economic and geographical factors, hence the randomness of the connections.</figcaption></figure><p>As you’ve noticed, things are harder at scale: we now have routers that are sitting 2 to 3 nodes away. How to enable nodes sittings behind other nodes to communicate with each other?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFM_4Qlu3e3MezxMtIFEZA.png" /></figure><h3>Going beyond the cables with the Border Gateway protocol</h3><p>How could router A even know that it needs to send its packet to router B in the first place? That’s impossible. This is where software takes over. Brilliant minds have engineered the BGP, a protocol that allow routers to know about the existence of routers far beyond their neighbors.</p><p>More than a metaphor, the neighboring part is actually quite relevant: the neighbors of a node are all the one that have a direct physical connection to it. In the schema above, the neighbors of router B are E, A, G, H and C.</p><p>How can BGP allow router D to make router A aware of its existence and how to reach it? By quite a bit of chatting it turns out.</p><ol><li>Router D tells his neighbors: “Hey, just to tell you that I am your friend.”</li><li>All the neighbors of router D tell their neighbor: “Actually did you knew that router D was my friend? Call me if you need to reach him!”</li><li>All the neighbors of the neighbors of router D tell their respective neighbors: “I know a guy who knows a guy… Just call me if you want to reach router D”</li></ol><p>So now when router A receives a message for router D, it looks its internal contact list and sees router D with an annotation “to reach him, just go by router B which will then go by router G, its friend.” But if you look closely at the schema, you can see that the traffic could also go by router E. Yes, and router A knows it. He has another line for router D: “to reach him, just go by router E who will then go by its chap, router B, which in turn will go by its mate router G, the friend of router D”. Our router being very clever, he will go through his giant address book and pick the quickest one. Not the shortest because other factors like traffic and latency come into play to spread out the load evenly across the web.</p><h3>Practical example</h3><p>We can visualize the path our packets take to hit a server the following way:</p><pre>traceroute to google.com (142.250.75.238), 20 hops max, 60 byte packets<br> 1  _gateway (192.168.1.254)  1.747 ms  1.922 ms  2.116 ms<br> 2  * * *<br> 3  212-195-252-28.abo.bbox.fr (212.195.252.28)  7.847 ms  8.092 ms  7.932 ms<br> 4  * * *<br> 5  la10.bsr01-bie.net.bbox.fr (212.194.170.90)  9.402 ms  9.195 ms  8.945 ms<br> 6  212.194.170.71 (212.194.170.71)  8.646 ms  6.736 ms  6.386 ms<br> 7  * * *<br> 8  142.250.175.198 (142.250.175.198)  4.722 ms  4.303 ms  8.555 ms<br> 9  172.253.70.165 (172.253.70.165)  8.128 ms  7.871 ms  8.585 ms<br>10  216.239.48.45 (216.239.48.45)  7.330 ms  7.845 ms 216.239.48.139 (216.239.48.139)  7.448 ms<br>11  par10s41-in-f14.1e100.net (142.250.75.238)  7.339 ms  7.990 ms  8.175 ms</pre><p>Here, the request travels through 9 nodes before reaching the target returned by the initial DNS query. You can read more about its options in <a href="https://linux.die.net/man/8/traceroute">this documentation</a>.</p><h3>Wrap up</h3><p>I hope this small conceptual talk about internet traffic routing was of any help, I personally find it quite amazing. Feel free to comment if you have anything more to had.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db86b9ac16bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding OAuth2.0 and OpenidConnect]]></title>
            <link>https://medium.com/@armeldemarsac/understanding-oauth2-0-and-openidconnect-d3ce695cee62?source=rss-fb8fcc98e7dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3ce695cee62</guid>
            <dc:creator><![CDATA[Armel de Marsac]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 14:52:56 GMT</pubDate>
            <atom:updated>2025-07-24T15:58:47.180Z</atom:updated>
            <content:encoded><![CDATA[<p>If you look at the tutorials available online, you’ll find the same explanation with a few variations: OAuth 2.0 is a system that allows an application to be delegated access to the resources of our account. This remains very conceptual, so I suggest we dive into the specifics.</p><p>OAuth 2.0 is a protocol, a set of standards that must be used by applications wanting to allow third-party services to access their users’ resources. Therefore, OAuth 2.0 is not the key itself, but the definition of how these keys should be issued. It’s a bit like airport security. OAuth 2.0 is not the security gate; it’s the list of procedures distributed to all airports to allow passengers to access the plane: start by checking the passport, if it’s valid, have the passenger go through a scanner to detect any sharp objects, etc. In short, Facebook, Google, and all sorts of applications have agreed to use a protocol considered optimal for delegating access to their users’ resources.</p><p>The standards defined by OAuth 2.0 form a complete framework that precisely defines every aspect of the protocol. Just as an airport needs to define who does what and how, OAuth 2.0 establishes four essential roles: the <strong>Resource Owner</strong> who owns the data, the <strong>Client</strong> that requests access, the <strong>Authorization Server</strong> that issues authorizations, and the <strong>Resource Server</strong> that holds the protected resources.</p><p>The protocol also defines the mandatory entry points (endpoints) that each implementation must provide. The <strong>authorization endpoint</strong> is used to obtain the user’s consent, while the <strong>token endpoint</strong> is used to exchange authorizations for access tokens. This is comparable to the different checkpoints in an airport, each with its specific role in the overall process.</p><p>Communication between these different actors is strictly regulated. OAuth 2.0 specifies exactly which parameters must be present in requests, how responses must be formatted (usually in JSON), and which error codes to use in each situation. This standardization ensures that all implementations can communicate coherently.</p><p>The protocol provides for different authorization flows to adapt to various use cases. Just as an airport has different procedures for passengers in transit, direct flights, or diplomats, OAuth 2.0 offers several flows. The modern best practice for any application with a user is the <strong>Authorization Code Flow with PKCE</strong>. Other flows exist for specific scenarios, such as the <strong>Client Credentials Flow</strong> for server-to-server communications. Older flows like the Implicit Flow are now considered legacy and are not recommended for new applications due to security risks.</p><p>Security is at the heart of the protocol. OAuth 2.0 imposes strict security measures such as the use of the state parameter to prevent CSRF attacks, rigorous validation of redirection URIs, and precise rules for token management. These security measures are not optional—they are an integral part of the protocol, just as security measures are non-negotiable in an airport.</p><p>This comprehensive standardization explains why OpenID Connect, developed later, chose to build upon OAuth 2.0 rather than creating a new protocol. OpenID Connect adds an identity layer on top of OAuth 2.0, reusing all these standardized mechanisms while adapting them to its specific authentication needs. It’s a bit like adding new procedures specific to identity checks in an airport, while keeping the existing security infrastructure.</p><h3>The Relationship Between OAuth 2.0 and OpenID Connect</h3><h4>A Common Point of Confusion</h4><p>In online tutorials, OAuth 2.0 and OpenID Connect are sometimes presented as two distinct systems:</p><ul><li>OpenID Connect is for <strong>authentication</strong> (who is the user?).</li><li>OAuth 2.0 is for <strong>authorization</strong> (what can the user’s app do?).</li></ul><p>This distinction is actually correct and crucial. The confusion arises when they are viewed as competing alternatives. In reality, they are designed to work together as layers.</p><h4>The Reality: A Layered System</h4><p>OAuth 2.0 by itself is an authorization framework; it was not designed to tell a client application who a user is. OpenID Connect (OIDC) was created as a simple identity layer that sits directly on top of OAuth 2.0 to fill this gap.</p><p>Here is how you correctly access identity information:</p><p><strong>Via OpenID Connect (The Standard Method)</strong></p><ul><li>By using the openid scope in your request. This signals to the server that you are performing an OIDC authentication flow.</li><li>You receive a special <strong>ID Token</strong> in addition to an access token. The ID Token is a JWT (JSON Web Token) that contains verifiable claims about the user’s identity and is meant to be read by your application.</li><li>You can use the access token to call the standard <strong>UserInfo Endpoint</strong>, which returns user profile information in a standardized format.</li></ul><p><strong>Via “Classic” OAuth 2.0 (The Proprietary, Pre-OIDC Method)</strong></p><ul><li>Before OIDC was standardized, services would use a pure OAuth 2.0 flow to get an access token.</li><li>The application would then have to call a separate, <strong>proprietary API endpoint</strong> (for example, Facebook’s /me endpoint) to get user information.</li><li>This method lacked standardization. Each service had a different endpoint, and the response format was not guaranteed. This is the exact interoperability problem that OIDC was created to solve.</li></ul><p>The key takeaway is that the <strong>UserInfo Endpoint is a feature of OpenID Connect, not core OAuth 2.0</strong>.</p><h3>The Scope: A Central Mechanism</h3><p>The scope parameter is at the heart of the system. It defines:</p><ul><li>Which resources are requested.</li><li>What permissions are being asked for.</li><li>Which protocols are activated. The openid scope is what activates the OpenID Connect identity layer.</li></ul><h4>With OpenID Connect (Authentication &amp; Authorization)</h4><p>GET /authorize?scope=openid%20profile%20email&amp;response_type=code&amp;client_id=CLIENT_ID</p><p>openid: Activates the OIDC flow and enables the issuance of an ID Token.</p><p>profile and email: These are standard OIDC scopes that request access to specific sets of user profile claims, which are returned in the ID Token or from the UserInfo Endpoint.</p><h4>With Third-Party APIs (Pure Authorization)</h4><p>GET /authorize?scope=https://www.googleapis.com/auth/drive.readonly&amp;response_type=code&amp;client_id=CLIENT_ID</p><p>This is a pure OAuth 2.0 request. It does not use OIDC and does not return an ID Token. It simply requests permission (a scope) to perform a specific action on an API — in this case, read-only access to the user’s Google Drive.</p><h3>A unified system</h3><p>Whether using OpenID Connect for identity or OAuth 2.0 for other resources, the underlying mechanism is the same:</p><ol><li>You request permissions via scopes.</li><li>The user gives their consent.</li><li>You receive an <strong>access token</strong> that contains these permissions.</li><li>You use this access token to call the authorized resources (like an API or the UserInfo Endpoint).</li><li>If you requested the openid scope, you also receive an <strong>ID Token</strong> that you can validate to confirm the user&#39;s identity.</li></ol><p>In the end, OpenID Connect is not an alternative to OAuth 2.0, but a specialized identity layer built upon its robust and flexible foundation, turning it into a complete authentication and authorization solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3ce695cee62" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>