<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://themixedestate.com/">
  <title>The Mixed Estate</title>
  <subtitle>IT and end user computing, explained properly.</subtitle>
  <link href="https://themixedestate.com/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="https://themixedestate.com/" rel="alternate" type="text/html"/>
  <id>https://themixedestate.com/</id>
  <updated>2026-10-17T00:00:00Z</updated>
  <author><name>The Mixed Estate</name></author>
  <entry>
    <title>Switch vs router</title>
    <link href="https://themixedestate.com/posts/router/"/>
    <id>https://themixedestate.com/posts/router/</id>
    <updated>2026-10-17T00:00:00Z</updated>
    <content type="html">&lt;p&gt;Last time, DHCP (Dynamic Host Configuration Protocol) handed a device an address and, tucked in alongside it, a default gateway. We swept straight past it to talk about options. Time to go back and ask the obvious question: what does that gateway actually do with your traffic the moment it leaves your device?&lt;/p&gt;
&lt;p&gt;Almost everything else in networking quietly assumes you already know. This is the article that stops waving its hands about it.&lt;/p&gt;
&lt;h2&gt;Switch vs router&lt;/h2&gt;
&lt;p&gt;The quickest way to keep these straight is to think about where each one makes its decisions.&lt;/p&gt;
&lt;p&gt;A &lt;strong&gt;switch&lt;/strong&gt; moves traffic &lt;em&gt;within&lt;/em&gt; a single network. Every device it&#39;s dealing with is on the same subnet, and it forwards frames using MAC (Media Access Control) addresses at Layer 2.&lt;/p&gt;
&lt;p&gt;A &lt;strong&gt;router&lt;/strong&gt; moves traffic &lt;em&gt;between&lt;/em&gt; different networks: other subnets, other sites, or out to the internet. It makes its decisions using Internet Protocol (IP) addresses at Layer 3.&lt;/p&gt;
&lt;p&gt;That&#39;s genuinely the whole distinction. If two devices are on the same subnet, a switch alone gets them talking and a router isn&#39;t part of the conversation. The moment a device wants something on a &lt;em&gt;different&lt;/em&gt; subnet, which includes anything outside its own virtual LAN (VLAN), it has no choice but to hand the packet to a router and let that router work out the next step.&lt;/p&gt;
&lt;h2&gt;The default gateway, properly explained&lt;/h2&gt;
&lt;p&gt;This is what Option 3 from the DHCP article was quietly setting up. The &lt;strong&gt;default gateway&lt;/strong&gt; is simply the router a device should use for anything that clearly isn&#39;t on its own local subnet.&lt;/p&gt;
&lt;p&gt;Before sending anything, the device compares the destination address against its own address and subnet mask. If the destination is local, it sends the traffic directly. If it isn&#39;t, it hands the packet to the gateway and lets that deal with the rest of the journey.&lt;/p&gt;
&lt;p&gt;Leave out the gateway, or get it wrong, and a device can talk happily to everything on its own subnet while being unable to reach anything else. That&#39;s the classic &amp;quot;the network&#39;s fine but nothing works&amp;quot; ticket, and it sends people looking in all the wrong places first.&lt;/p&gt;
&lt;h2&gt;What&#39;s inside a routing table&lt;/h2&gt;
&lt;p&gt;A router&#39;s whole job runs off one structure: the &lt;strong&gt;routing table&lt;/strong&gt;. Every entry is essentially a rule saying that traffic for this network should go out of this interface, towards this next hop.&lt;/p&gt;
&lt;p&gt;You can see one on your own machine. On Linux or a Mac, &lt;code&gt;ip route&lt;/code&gt; or &lt;code&gt;netstat -rn&lt;/code&gt; will show it. On Windows, use &lt;code&gt;route print&lt;/code&gt;. A tiny one looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.50
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each entry has:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;destination network&lt;/strong&gt;, the range the rule applies to.&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;interface&lt;/strong&gt; to send matching traffic out of.&lt;/li&gt;
&lt;li&gt;Usually a &lt;strong&gt;next hop&lt;/strong&gt;, the next router along the path, if the destination isn&#39;t directly attached.&lt;/li&gt;
&lt;li&gt;Often a &lt;strong&gt;metric&lt;/strong&gt;, a cost value used to prefer the cheaper or faster path when more than one route could do the job.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Every table also has a &lt;strong&gt;default route&lt;/strong&gt;, usually written as &lt;code&gt;0.0.0.0/0&lt;/code&gt;. It&#39;s the catch-all: if nothing more specific matches, send it here. On a home or office router, that entry is what points towards your internet service provider (ISP), and it&#39;s how a router says &amp;quot;I&#39;ve no specific rule for this, so it&#39;s probably headed for the wider internet.&amp;quot;&lt;/p&gt;
&lt;h2&gt;How a router picks a route&lt;/h2&gt;
&lt;p&gt;This is the part that catches people out the first time. A routing table can contain several entries that all match the same destination: a broad one and a much more specific one. So which wins?&lt;/p&gt;
&lt;p&gt;The rule is &lt;strong&gt;longest prefix match&lt;/strong&gt;. The router always prefers the &lt;em&gt;most specific&lt;/em&gt; matching route, meaning the one with the longest prefix, over a broader one, whatever the metric says.&lt;/p&gt;
&lt;p&gt;Say a table contains these two routes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt; via router A&lt;/li&gt;
&lt;li&gt;&lt;code&gt;10.0.5.0/24&lt;/code&gt; via router B&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A packet for &lt;code&gt;10.0.5.20&lt;/code&gt; matches both. The &lt;code&gt;/24&lt;/code&gt; is more specific, so it goes via router B, every time. Metric only comes into play as a tiebreaker when two entries are equally specific.&lt;/p&gt;
&lt;p&gt;It&#39;s how a router can hold a broad default route pointing at the internet plus a handful of specific routes for internal networks, and never mix the two up.&lt;/p&gt;
&lt;h2&gt;Static vs dynamic routing&lt;/h2&gt;
&lt;p&gt;There are two ways entries get into that table.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Static routes&lt;/strong&gt; are configured by hand. They&#39;re reliable and predictable, but they don&#39;t adapt: if a link goes down, a static route has no idea it should route around the problem.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dynamic routing&lt;/strong&gt; uses a routing protocol, with OSPF (Open Shortest Path First) and BGP (Border Gateway Protocol) being the big names. Routers talk to each other, share what they know about the network, and update their tables automatically when something changes, such as a link failing. Those protocols are dense enough to deserve their own articles, so this is only a signpost.&lt;/p&gt;
&lt;p&gt;Most home and small-office setups need little more than a single default route, because there&#39;s only one sensible way out to the internet. Larger networks with more than one possible path lean on dynamic routing precisely because they need to adapt without a human noticing and fixing it.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;Switches move traffic within a network, and routers move it between networks. Every router relies on a routing table full of &amp;quot;send this destination out this way&amp;quot; entries, and it always prefers the most specific match available. Static routes are hand-configured and simple. Dynamic routing adapts automatically, at the cost of real complexity.&lt;/p&gt;
&lt;p&gt;With that in place, we can go back to addressing, because IPv6 (Internet Protocol version 6) doesn&#39;t hand out addresses the way DHCP does. Next up: SLAAC vs DHCPv6.&lt;/p&gt;
&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc1122&#34;&gt;RFC 1122: Requirements for Internet Hosts, Communication Layers&lt;/a&gt; (how a host decides between local delivery and a gateway)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc1812&#34;&gt;RFC 1812: Requirements for IP Version 4 Routers&lt;/a&gt; (including longest prefix match)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc4632&#34;&gt;RFC 4632: Classless Inter-domain Routing (CIDR)&lt;/a&gt; (prefix notation such as /24)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc1918&#34;&gt;RFC 1918: Address Allocation for Private Internets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc2328&#34;&gt;RFC 2328: OSPF Version 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc4271&#34;&gt;RFC 4271: A Border Gateway Protocol 4 (BGP-4)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>DHCP and its options: more than just an IP address</title>
    <link href="https://themixedestate.com/posts/dhcp/"/>
    <id>https://themixedestate.com/posts/dhcp/</id>
    <updated>2026-10-13T00:00:00Z</updated>
    <content type="html">&lt;p&gt;Every device on a network starts out the same way: it has no address, no idea who else is there, and no way to ask anyone directly. So it shouts… DHCP is the protocol that answers.&lt;/p&gt;
&lt;p&gt;It&#39;s easy to take for granted, but most of what makes a network feel like it &amp;quot;just works&amp;quot; (the printer that appears on its own, the laptop that behaves on a new Wi-Fi network) comes down to DHCP doing its job quietly in the background. It&#39;s also one of the first places to look when something stops working.&lt;/p&gt;
&lt;h2&gt;Why DHCP exists&lt;/h2&gt;
&lt;p&gt;Before DHCP, addressing was manual. Every device got a static IP, recorded somewhere: a spreadsheet if you were lucky, a sticky note if you weren&#39;t. That falls apart quickly at any kind of scale.&lt;/p&gt;
&lt;p&gt;DHCP (Dynamic Host Configuration Protocol) solves one problem: getting a device everything it needs to talk on the network, automatically, without anyone touching it.&lt;/p&gt;
&lt;p&gt;The important phrase there is &lt;em&gt;everything it needs&lt;/em&gt;. An IP address is only part of it. A device also needs a subnet mask, a default gateway and DNS servers, and sometimes a boot server or a time source. Those extras are delivered as &lt;strong&gt;options&lt;/strong&gt;, which are covered below.&lt;/p&gt;
&lt;h2&gt;DORA: how a device gets its address&lt;/h2&gt;
&lt;p&gt;The exchange is four packets, and it has a name worth remembering: &lt;strong&gt;DORA&lt;/strong&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Discover.&lt;/strong&gt; The device has no IP yet, so it can&#39;t address anything directly. It broadcasts to 255.255.255.255, effectively asking whether any DHCP server is out there.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Offer.&lt;/strong&gt; A DHCP server replies with a candidate lease: an IP address, a lease time and its own identity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Request.&lt;/strong&gt; This is the step that catches people out. The client doesn&#39;t simply accept the offer. It broadcasts again, naming the specific offer and server it wants. If there&#39;s more than one DHCP server on the segment, that broadcast tells the others their offers weren&#39;t chosen.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Acknowledge.&lt;/strong&gt; The chosen server confirms the lease and hands over the full set of options.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Four packets take a device from nothing to fully configured.&lt;/p&gt;
&lt;p&gt;It also explains something you&#39;ll see in the wild: &lt;strong&gt;APIPA&lt;/strong&gt;. If a device ends up with a 169.254.x.x address, DORA failed somewhere. No Offer came back, so the device gave itself a fallback address that can only talk to other APIPA devices on the same segment. It isn&#39;t broken, just a client giving up gracefully.&lt;/p&gt;
&lt;h2&gt;Scopes, leases and reservations&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;scope&lt;/strong&gt; is the pool of addresses a DHCP server is allowed to hand out, along with the rules attached to it: the subnet, any exclusions and the lease duration.&lt;/p&gt;
&lt;h3&gt;Lease time&lt;/h3&gt;
&lt;p&gt;Lease time is a setting most people leave on the default and forget about. That&#39;s usually fine, until it isn&#39;t.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Short leases&lt;/strong&gt; mean devices renew often. That suits environments where addresses churn, such as guest Wi-Fi or a large kiosk fleet where devices come and go.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Long leases&lt;/strong&gt; mean less renewal traffic, but changes take longer to reach devices. If you change the DNS servers or the gateway, clients won&#39;t pick that up until they next renew, which could be days.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A long lease can also be perfectly sensible. If DHCP is running on a modest router and your network rarely changes, there&#39;s no reason to make it work harder than it needs to.&lt;/p&gt;
&lt;h3&gt;Reservations&lt;/h3&gt;
&lt;p&gt;A reservation sits between static and dynamic addressing. The device still uses DHCP, but its MAC address is pinned so it always receives the same IP. It&#39;s the sensible way to give a printer or server a predictable address without configuring it by hand on the device itself.&lt;/p&gt;
&lt;p&gt;One real-world note: end users tend to think of a reservation as a static address. It&#39;s worth knowing the difference, because the configuration lives on the DHCP server, not the device.&lt;/p&gt;
&lt;h2&gt;Options: where the real configuration lives&lt;/h2&gt;
&lt;p&gt;The IP address is almost the least interesting thing DHCP provides. The options carry the configuration that makes that address useful, and each one has a number.&lt;/p&gt;
&lt;p&gt;A few come up constantly when managing a real estate:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Router&lt;/td&gt;
&lt;td&gt;The default gateway. Without it, a device knows its own subnet but can&#39;t reach anything beyond it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;DNS servers&lt;/td&gt;
&lt;td&gt;Get this wrong across a large estate and you&#39;ll spend a day chasing &amp;quot;the internet&#39;s down&amp;quot; tickets that turn out to be DNS in disguise.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;Domain name&lt;/td&gt;
&lt;td&gt;Feeds suffix search lists, which is why a device can resolve &amp;quot;fileserver&amp;quot; without the full FQDN being typed. Using FQDNs everywhere is still the better habit.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;66 / 67&lt;/td&gt;
&lt;td&gt;TFTP server and boot filename&lt;/td&gt;
&lt;td&gt;Essential for PXE boot, imaging and zero-touch provisioning. The device is told not just an address, but where to go to boot an operating system.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Vendor-specific options&lt;/h3&gt;
&lt;p&gt;Option 43 is the classic vendor-specific option. Wireless controllers use it so that an access point can find its controller automatically on first boot, with no manual configuration. It&#39;s the difference between unboxing 200 access points and having them configure themselves, and touching every one by hand.&lt;/p&gt;
&lt;p&gt;Options are also where platform differences show up in a mixed estate. Not every operating system honours every option in the same way, so it&#39;s worth checking before assuming a setting will work everywhere.&lt;/p&gt;
&lt;p&gt;There&#39;s a further catch: different vendors sometimes use the same option number for entirely different things. If DHCP isn&#39;t running on a proper server, it can be very hard to specify an option on a per-vendor, per-device basis.&lt;/p&gt;
&lt;h2&gt;Where DHCP breaks&lt;/h2&gt;
&lt;p&gt;Three failure patterns turn up again and again.&lt;/p&gt;
&lt;h3&gt;Scope exhaustion&lt;/h3&gt;
&lt;p&gt;The pool runs dry, usually because the lease time is too long for the number of devices passing through the subnet. New devices get nothing.&lt;/p&gt;
&lt;p&gt;Take a pub running residential kit for customer Wi-Fi on a busy day. Two hundred customers, nearly all on a phone, and half of them with a watch as well, is 300 addresses. But the router&#39;s default setup is 192.168.1.0/24, a Class C network with the mask 255.255.255.0, which only has room for 254 usable addresses. The customers who arrived last can&#39;t get online.&lt;/p&gt;
&lt;h3&gt;Rogue DHCP servers&lt;/h3&gt;
&lt;p&gt;Someone plugs in a cheap router with DHCP enabled by default, and now part of the segment is getting offers from two servers. This is exactly what DHCP snooping on managed switches is for: it lets you specify that only certain ports are allowed to answer DHCP requests.&lt;/p&gt;
&lt;p&gt;The usual explanation is that they were only trying to get five devices online from the one ethernet port they&#39;d been given.&lt;/p&gt;
&lt;h3&gt;Option drift&lt;/h3&gt;
&lt;p&gt;Someone updates the DNS servers on one scope and forgets the other four. A chunk of the estate then quietly resolves against a decommissioned server until every lease naturally expires.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;DORA hands out the lease. Scopes define the pool and the rules around it. Options are the payload that makes the address worth having. Get the options wrong, and the address barely matters.&lt;/p&gt;
&lt;p&gt;Understanding DHCP also raises an obvious question: once a device has its default gateway, what does that gateway actually do with its traffic? That&#39;s covered in the next article, on what a router really does.&lt;/p&gt;
&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc2131&#34;&gt;RFC 2131: Dynamic Host Configuration Protocol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc2132&#34;&gt;RFC 2132: DHCP Options and BOOTP Vendor Extensions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc3927&#34;&gt;RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses&lt;/a&gt; (the 169.254.x.x fallback)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc1918&#34;&gt;RFC 1918: Address Allocation for Private Internets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
</feed>
