<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Networking 101: how computers talk · Network Doodles</title><link>https://networkdoodles.com/lessons/networking-101/</link><description>Start from zero. What a host is, the OSI model, hubs, switches and routers, data centers, IP addresses and subnets, a step-by-step trace of a laptop getting its address, and the port numbers that say which program a message is for. Animated diagrams you can pause and step through, and nothing to install.</description><language>en-us</language><managingEditor>David Henderson</managingEditor><lastBuildDate>Wed, 11 Nov 2026 09:00:00 -0500</lastBuildDate><atom:link href="https://networkdoodles.com/lessons/networking-101/index.xml" rel="self" type="application/rss+xml"/><item><title>Ports: TCP, UDP and the common numbers</title><link>https://networkdoodles.com/lessons/networking-101/task-5-1/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-5-1/</guid><description>What a port is, TCP vs UDP, source and ephemeral ports, sockets, the handshake, common port numbers checked against IANA, and why firewalls care.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Which program is this for?</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="one-address-lots-of-programs">One address, lots of programs</h3>
<p>A block of flats has one street address, but dozens of people live there. A parcel needs the street address
<em>and</em> a flat number, or it sits in the hall.</p>
<p>A computer is the same. Its <strong>IP address</strong> (lesson 3.1) gets a message to the right computer. But on that
computer a web browser, an email app and a video call are all running at once, and the message is for one of
them. The flat number is the <strong>port number</strong>: a number from <code>0</code> to <code>65535</code> that says <em>which program</em>.</p>
<p>You met ports in <a href="/lessons/networking-101/task-1-2/">lesson 1.2</a>: they&rsquo;re <strong>layer 4</strong>, transport. And in
<a href="/lessons/networking-101/task-4-1/">lesson 4.1</a>, DHCP&rsquo;s messages went to port <code>67</code> on the server and back to
port <code>68</code> on the laptop.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The IP address finds the computer; the port number finds the program on it.</p>
<h3 id="listening-and-source-and-destination-ports">Listening, and source and destination ports</h3>
<p>A program that offers a service, like a web server, <strong>listens</strong> on a port: it tells the computer <em>anything
that arrives for port 443 is mine</em>. Everyone knows the number in advance, so nobody has to ask.</p>
<p>Every message carries <strong>two</strong> ports, like it carries two IP addresses:</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Who picks it</th>
          <th>Example, laptop to web server</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>destination port</strong></td>
          <td>the service&rsquo;s well-known number</td>
          <td><code>443</code>: the secure web server</td>
      </tr>
      <tr>
          <td><strong>source port</strong></td>
          <td>the computer that starts the conversation picks a spare one, for this conversation only</td>
          <td><code>51000</code></td>
      </tr>
  </tbody>
</table>
<p>That temporary source port is called an <strong>ephemeral</strong> port (<em>ephemeral</em> means <em>short-lived</em>). When the server
answers, it swaps them round: the answer comes <strong>from</strong> <code>443</code> and goes <strong>to</strong> <code>51000</code>, so the laptop knows
which program, and which conversation, it&rsquo;s for.</p>
<p>Which numbers count as spare depends on the system. Windows and macOS pick from <code>49152</code> to <code>65535</code>; Linux, by
default, from <code>32768</code> to <code>60999</code>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The destination port is the service&rsquo;s well-known number; the source port is a temporary one the asking computer picks.</p>
<h3 id="sockets">Sockets</h3>
<p>An IP address and a port together are called a <strong>socket</strong>, written with a colon: <code>192.168.1.10:51000</code>. A
conversation between two programs is two sockets, one at each end:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">192.168.1.10:51000  ⇄  192.168.2.10:443
</span></span><span class="line"><span class="cl">   the laptop            the web server
</span></span></code></pre></div><p>Open a second tab to the same site and you get a second conversation, <code>192.168.1.10:51001 ⇄ 192.168.2.10:443</code>. The server&rsquo;s side is the same; the laptop&rsquo;s port is different. That&rsquo;s how one computer keeps
dozens of conversations apart.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A socket is an IP address plus a port; a conversation is a pair of sockets.</p>
<h3 id="two-ways-to-send-tcp-and-udp">Two ways to send: TCP and UDP</h3>
<p>Layer 4 has two main protocols, and every port number belongs to one of them (or to both, separately: TCP port
53 and UDP port 53 are two different doors).</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th><strong>TCP</strong></th>
          <th><strong>UDP</strong></th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>stands for</td>
          <td><em>Transmission Control Protocol</em></td>
          <td><em>User Datagram Protocol</em></td>
      </tr>
      <tr>
          <td>like</td>
          <td>a phone call: you say hello first, and you know if the other side hung up</td>
          <td>a postcard: you write it and post it</td>
      </tr>
      <tr>
          <td>before sending</td>
          <td>a <strong>three-way handshake</strong> sets up a connection</td>
          <td>nothing: it just sends</td>
      </tr>
      <tr>
          <td>lost pieces</td>
          <td>noticed and sent again; pieces arrive in order</td>
          <td>lost is lost; the program has to ask again if it cares</td>
      </tr>
      <tr>
          <td>cost</td>
          <td>slower to start, more to keep track of</td>
          <td>quick and light</td>
      </tr>
      <tr>
          <td>used for</td>
          <td>web pages, email, file copies, logging in to a router: anything that must arrive whole</td>
          <td>DNS questions, DHCP, the time (NTP), monitoring (SNMP), voice and video calls</td>
      </tr>
  </tbody>
</table>
<p>Voice and video use UDP for a reason: a bit of sound that arrives late is no use, so there&rsquo;s no point sending
it again. Better to skip it and carry on.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> TCP sets up a connection and makes sure everything arrives; UDP just sends, and is quicker for it.</p>
<h3 id="the-three-way-handshake">The three-way handshake</h3>
<p>Before TCP sends any data, the two sides agree to talk. Three messages, named after the <strong>flags</strong> they carry
(a flag is a switch in the TCP header, on or off):</p>
<ol>
<li><strong>SYN</strong> (<em>synchronise</em>): the laptop says <em>I&rsquo;d like to talk, and I&rsquo;ll number my pieces starting here</em>.</li>
<li><strong>SYN-ACK</strong>: the server says <em>OK</em> (<strong>ACK</strong>, acknowledge) <em>and here&rsquo;s where my numbering starts</em> (SYN).</li>
<li><strong>ACK</strong>: the laptop says <em>got it</em>.</li>
</ol>
<p>Now the connection is <strong>established</strong>, and data flows both ways. Every piece is numbered, and the other side
acknowledges what it got, so anything missing is noticed and sent again. When they&rsquo;re done, each side sends a
<strong>FIN</strong> (<em>finish</em>) to close it.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> SYN, SYN-ACK, ACK: TCP&rsquo;s hello, before any data.</p>
<h3 id="three-ranges">Three ranges</h3>
<p>The numbers <code>0</code> to <code>65535</code> are split into three ranges. <strong>IANA</strong>, the <em>Internet Assigned Numbers Authority</em>, the
organisation that keeps the official list, writes down who each number is for.</p>
<table>
  <thead>
      <tr>
          <th>Range</th>
          <th>Name</th>
          <th>What&rsquo;s in it</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>0</code>–<code>1023</code></td>
          <td><strong>well-known</strong> (system) ports</td>
          <td>the core services: web, email, DNS, SSH. On Linux, only an administrator&rsquo;s program may listen on these</td>
      </tr>
      <tr>
          <td><code>1024</code>–<code>49151</code></td>
          <td><strong>registered</strong> (user) ports</td>
          <td>services a company or project asked IANA for, like RDP on <code>3389</code></td>
      </tr>
      <tr>
          <td><code>49152</code>–<code>65535</code></td>
          <td><strong>dynamic</strong> (private) ports</td>
          <td>never given to anyone: free for ephemeral ports</td>
      </tr>
  </tbody>
</table>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>The common ports</h2>
  </header>
  <div class="lab-stage-body">
    <p>You don&rsquo;t need all 65,536. These are the ones network engineers see every day, from IANA&rsquo;s list and the RFC
(the standard) for each protocol:</p>
<table>
  <thead>
      <tr>
          <th>Port</th>
          <th>Protocol</th>
          <th>Name</th>
          <th>What it&rsquo;s for</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>20</code>, <code>21</code></td>
          <td>TCP</td>
          <td><strong>FTP</strong></td>
          <td><em>File Transfer Protocol</em>: copying files. 21 carries the commands; 20 carries the files in FTP&rsquo;s older <em>active</em> mode. Sends passwords as plain text</td>
      </tr>
      <tr>
          <td><code>22</code></td>
          <td>TCP</td>
          <td><strong>SSH</strong></td>
          <td><em>Secure Shell</em>: logging in to a switch, router or server and typing commands, encrypted. Also carries file copies (SCP, SFTP)</td>
      </tr>
      <tr>
          <td><code>23</code></td>
          <td>TCP</td>
          <td><strong>Telnet</strong></td>
          <td>the same job as SSH, but <strong>not encrypted</strong>: anyone who can see the traffic can read the password. Turned off on modern kit</td>
      </tr>
      <tr>
          <td><code>25</code></td>
          <td>TCP</td>
          <td><strong>SMTP</strong></td>
          <td><em>Simple Mail Transfer Protocol</em>: email servers passing mail to each other. Your mail app usually sends on <code>587</code> instead (<em>submission</em>)</td>
      </tr>
      <tr>
          <td><code>53</code></td>
          <td>UDP and TCP</td>
          <td><strong>DNS</strong></td>
          <td><em>Domain Name System</em>: names to addresses. Questions go over UDP; big answers and copies of whole zones go over TCP</td>
      </tr>
      <tr>
          <td><code>67</code>, <code>68</code></td>
          <td>UDP</td>
          <td><strong>DHCP</strong></td>
          <td><code>67</code> is the server, <code>68</code> the client: lesson 4.1</td>
      </tr>
      <tr>
          <td><code>69</code></td>
          <td>UDP</td>
          <td><strong>TFTP</strong></td>
          <td><em>Trivial File Transfer Protocol</em>: a very simple file copy, no password at all. Often used to load software onto network kit</td>
      </tr>
      <tr>
          <td><code>80</code></td>
          <td>TCP</td>
          <td><strong>HTTP</strong></td>
          <td>web pages, not encrypted</td>
      </tr>
      <tr>
          <td><code>110</code>, <code>143</code></td>
          <td>TCP</td>
          <td><strong>POP3</strong>, <strong>IMAP</strong></td>
          <td>collecting email from a mail server (encrypted versions: <code>995</code>, <code>993</code>)</td>
      </tr>
      <tr>
          <td><code>123</code></td>
          <td>UDP</td>
          <td><strong>NTP</strong></td>
          <td><em>Network Time Protocol</em>: keeps every device&rsquo;s clock right, which matters when you compare their logs</td>
      </tr>
      <tr>
          <td><code>161</code>, <code>162</code></td>
          <td>UDP</td>
          <td><strong>SNMP</strong></td>
          <td><em>Simple Network Management Protocol</em>: monitoring. The monitoring server asks devices on <code>161</code>; devices send alerts (<em>traps</em>) to it on <code>162</code></td>
      </tr>
      <tr>
          <td><code>179</code></td>
          <td>TCP</td>
          <td><strong>BGP</strong></td>
          <td><em>Border Gateway Protocol</em>: routers telling each other which networks they can reach, across the internet</td>
      </tr>
      <tr>
          <td><code>389</code>, <code>636</code></td>
          <td>TCP</td>
          <td><strong>LDAP</strong>, <strong>LDAPS</strong></td>
          <td>looking up users and passwords in a directory. <code>636</code> is the encrypted one</td>
      </tr>
      <tr>
          <td><code>443</code></td>
          <td>TCP (and UDP)</td>
          <td><strong>HTTPS</strong></td>
          <td>web pages, encrypted with TLS. The newest version, HTTP/3, usually runs on UDP <code>443</code></td>
      </tr>
      <tr>
          <td><code>514</code></td>
          <td>UDP</td>
          <td><strong>syslog</strong></td>
          <td>devices sending their log messages to a log server (over TLS, it&rsquo;s TCP <code>6514</code>)</td>
      </tr>
      <tr>
          <td><code>3389</code></td>
          <td>TCP</td>
          <td><strong>RDP</strong></td>
          <td><em>Remote Desktop Protocol</em>: using a Windows computer&rsquo;s screen from somewhere else</td>
      </tr>
  </tbody>
</table>
<p>Notice the pairs: plain and encrypted versions of the same service usually have <strong>different</strong> ports (<code>80</code> and
<code>443</code>, <code>143</code> and <code>993</code>, <code>389</code> and <code>636</code>). The port tells you which one you&rsquo;re talking to.</p>
<p>A port number is an agreement, not a law. You can run a web server on port <code>8080</code>, and people often do. The
well-known numbers are just where everyone looks first.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A handful of numbers cover most of what you&rsquo;ll see: 22, 53, 80, 443, and the rest of this table.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Watch the ports</h2>
  </header>
  <div class="lab-stage-body">
    <p>A laptop at <code>192.168.1.10</code> looks up a name, then opens a secure web page, twice. Press <strong>Play</strong>, or step with
→. In each step, look at <strong>layer 4</strong> in the box under the diagram: the protocol, and the two ports.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A laptop asks a DNS server for a name over UDP port 53, then opens two TCP connections to a web server on port 443, each from a different source port, with a three-way handshake. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A laptop asks a DNS server for a name over UDP port 53, then opens two TCP connections to a web server on port 443, each from a different source port, with a three-way handshake"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":380,"links":[["pc","rtr"],["rtr","web"],["rtr","dns"]],"narrow":{"at":{"dns":[275,470],"pc":[180,90],"rtr":[180,270],"web":[85,470]},"h":600,"w":360},"nodes":{"dns":{"kind":"server","label":"DNS server","sub":"192.168.2.53","sub2":"listens on UDP 53","x":390,"y":300},"pc":{"kind":"laptop","label":"Laptop","sub":"192.168.1.10","x":95,"y":150},"rtr":{"kind":"router","label":"Router","sub":"","x":390,"y":150},"web":{"kind":"server","label":"Web server","sub":"192.168.2.10","sub2":"listens on TCP 443","x":685,"y":150}},"steps":[{"hot":["web","dns"],"say":{"dns":"UDP 53\nis mine","web":"TCP 443\nis mine"},"table":{"cols":["host","protocol","port","program"],"rows":[["web server","TCP","443","HTTPS"],["DNS server","UDP","53","DNS"]],"title":"Who's listening"},"text":"The web server's program is **listening** on TCP port `443`; the DNS server's on UDP port `53`. Nothing has been sent yet. The laptop wants `https://web.lab`, so first it needs web's address.","title":"Two servers, each listening."},{"frame":{"layers":[{"fields":[["src IP","192.168.1.10"],["dst IP","192.168.2.53"]],"l":3,"name":"IP"},{"fields":[["src port","50123",true],["dst port","53 (DNS)",true]],"l":4,"name":"UDP"},{"fields":[["question","web.lab, address?"]],"l":7,"name":"DNS"}],"title":"Inside the **DNS question**"},"hot":["pc","dns"],"links":[["pc","rtr"],["rtr","dns"]],"packets":[{"c":"violet","label":"DNS?","path":["pc","rtr","dns"]}],"text":"No handshake: the laptop just sends. The **destination** port is `53`, DNS. The **source** port, `50123`, is one the laptop picked for this question.","title":"A DNS question: UDP, one message."},{"frame":{"layers":[{"fields":[["src IP","192.168.2.53"],["dst IP","192.168.1.10"]],"l":3,"name":"IP"},{"fields":[["src port","53",true],["dst port","50123",true]],"l":4,"name":"UDP"},{"fields":[["answer","web.lab is 192.168.2.10"]],"l":7,"name":"DNS"}],"title":"Inside the **DNS answer**"},"hot":["dns","pc"],"links":[["rtr","dns"],["pc","rtr"]],"packets":[{"c":"violet","label":"DNS!","path":["dns","rtr","pc"]}],"text":"The answer comes **from** `53` and goes **to** `50123`, so the laptop knows it's the answer to *that* question. One message there, one back: that's all DNS needed.","title":"The answer: ports swapped."},{"frame":{"layers":[{"fields":[["src IP","192.168.1.10"],["dst IP","192.168.2.10"]],"l":3,"name":"IP"},{"fields":[["src port","51000",true],["dst port","443 (HTTPS)",true],["flags","SYN",true]],"l":4,"name":"TCP"}],"title":"Inside the **SYN**"},"hot":["pc"],"links":[["pc","rtr"],["rtr","web"]],"packets":[{"c":"amber","label":"SYN","path":["pc","rtr","web"]}],"text":"Now TCP. Before any data, the handshake. The laptop picks a new source port, `51000`, and sends a **SYN** to port `443`.","title":"SYN: can we talk?"},{"frame":{"layers":[{"fields":[["src port","443"],["dst port","51000"],["flags","SYN, ACK",true]],"l":4,"name":"TCP"}],"title":"Inside the **SYN-ACK**"},"hot":["web"],"links":[["rtr","web"],["pc","rtr"]],"packets":[{"c":"amber","label":"SYN-ACK","path":["web","rtr","pc"]}],"text":"The web server agrees: **SYN-ACK**. Ports swapped, as always on the way back.","title":"SYN-ACK: yes, can we?"},{"hot":["pc","web"],"links":[["pc","rtr"],["rtr","web"]],"packets":[{"c":"amber","label":"ACK","path":["pc","rtr","web"]}],"table":{"cols":["laptop socket","server socket","state"],"hl":0,"rows":[["192.168.1.10:51000","192.168.2.10:443","established"]],"title":"The laptop's connections"},"text":"The laptop's **ACK** completes the handshake. The connection is **established**: two sockets, `192.168.1.10:51000` and `192.168.2.10:443`.","title":"ACK: connected."},{"hot":["pc","web"],"links":[["pc","rtr"],["rtr","web"]],"packets":[{"c":"green","label":"request","path":["pc","rtr","web"]},{"at":2.3,"c":"green","label":"page","path":["web","rtr","pc"]}],"text":"Now the page: the request goes to `443`, the page comes back to `51000`. Each piece is numbered and acknowledged, so if one goes missing, TCP sends it again.","title":"Data, both ways."},{"frame":{"layers":[{"fields":[["src port","51001",true],["dst port","443"],["flags","SYN"]],"l":4,"name":"TCP"}],"title":"Inside the second tab's **SYN**"},"hot":["pc","web"],"links":[["pc","rtr"],["rtr","web"]],"packets":[{"c":"amber","label":"SYN","path":["pc","rtr","web"]},{"at":2.3,"c":"amber","label":"SYN-ACK","path":["web","rtr","pc"]},{"at":4.6,"c":"amber","label":"ACK","path":["pc","rtr","web"]}],"table":{"cols":["laptop socket","server socket","state"],"hl":1,"rows":[["192.168.1.10:51000","192.168.2.10:443","established"],["192.168.1.10:51001","192.168.2.10:443","established"]],"title":"The laptop's connections"},"text":"Open the same site in another tab. Same server socket, `192.168.2.10:443`, but a new source port, `51001`, and a handshake of its own. The two answers can't get mixed up: they go to different ports.","title":"A second tab: a second conversation."}],"w":780}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p>What to notice:</p>
<ol>
<li>The <strong>destination</strong> port on the way out is always the service&rsquo;s well-known number: <code>53</code>, <code>443</code>.</li>
<li>The <strong>source</strong> port is one the laptop picks, a new one for each conversation.</li>
<li>On the way back, the two ports swap places.</li>
<li>UDP: one message each way. TCP: three messages of handshake before any data.</li>
</ol>
<p class="lab-recap"><span class="mono">in one sentence</span> Out to the service&rsquo;s port from a temporary one; back with the two swapped.</p>
<h3 id="why-firewalls-care-about-ports">Why firewalls care about ports</h3>
<p>A <strong>firewall</strong> sits between networks and decides which messages may pass. A router can do a simpler version
of the same job with an <strong>ACL</strong> (<em>access control list</em>): a list of <em>permit</em> and <em>deny</em> lines it checks, top
to bottom. Both decide mostly on four things in each message: the <strong>protocol</strong> (TCP or UDP), the <strong>source</strong>
and <strong>destination IP address</strong>, and the <strong>destination port</strong>.</p>
<p>The destination port is what says <em>which service</em>. So <em>let people reach the web server, and nothing else on
it</em> becomes <em>allow TCP to <code>192.168.2.10</code> port <code>443</code></em>. Here it is as a router&rsquo;s ACL line:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">permit tcp any host 192.168.2.10 eq 443
</span></span></code></pre></div><p><em>Permit TCP from any address to the one host <code>192.168.2.10</code>, when the destination port equals 443.</em> At the end
of every list is an unwritten <em>deny everything else</em>, so SSH, Telnet and the rest are blocked without anyone
writing a line for them.</p>
<p>What about the answers coming back? They&rsquo;re <strong>from</strong> port <code>443</code> <strong>to</strong> some ephemeral port, which nobody can
know in advance. A <strong>stateful</strong> firewall solves that: it remembers each conversation it let out, and lets that
conversation&rsquo;s answers back in. That&rsquo;s what the <em>established</em> in the table above is for.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A firewall in front of a web server allows TCP port 443 and blocks Telnet on port 23; the web server&#39;s answer is let back in because the firewall remembers the connection. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A firewall in front of a web server allows TCP port 443 and blocks Telnet on port 23; the web server&#39;s answer is let back in because the firewall remembers the connection"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":300,"links":[["pc","fw"],["fw","web"]],"narrow":{"at":{"fw":[180,250],"pc":[180,80],"web":[180,420]},"h":520,"w":360},"nodes":{"fw":{"kind":"firewall","label":"Firewall","sub":"allow TCP 443 to web","x":390,"y":140},"pc":{"kind":"laptop","label":"Laptop","sub":"192.168.1.10","x":95,"y":140},"web":{"kind":"server","label":"Web server","sub":"192.168.2.10","x":685,"y":140}},"steps":[{"hot":["fw"],"table":{"cols":["protocol","to","port","action"],"rows":[["TCP","192.168.2.10","443","allow"],["any","any","any","deny"]],"title":"Firewall rules, checked top to bottom"},"text":"The first rule allows TCP to the web server on port `443`. The second denies everything else.","title":"The rules."},{"hot":["fw"],"links":[["pc","fw"],["fw","web"]],"packets":[{"c":"green","label":"TCP 443","path":["pc","fw","web"]}],"table":{"cols":["protocol","to","port","action"],"hl":0,"rows":[["TCP","192.168.2.10","443","allow"],["any","any","any","deny"]],"title":"Firewall rules, checked top to bottom"},"text":"A SYN to port `443`. It matches the first rule, so it passes, and the firewall writes the conversation down.","title":"HTTPS: allowed."},{"hot":["fw"],"links":[["fw","web"],["pc","fw"]],"packets":[{"c":"green","label":"reply","path":["web","fw","pc"]}],"say":{"fw":"I let that\nconversation out"},"table":{"cols":["laptop socket","server socket"],"hl":0,"rows":[["192.168.1.10:51000","192.168.2.10:443"]],"title":"Conversations the firewall remembers"},"text":"The SYN-ACK comes from `443` to `51000`. No rule mentions port `51000`, but the firewall remembers the conversation it just let out, so the answer gets through.","title":"The answer: let back in."},{"hot":["fw"],"links":[["pc","fw"]],"packets":[{"c":"red","end":"drop","label":"TCP 23","path":["pc","fw"]}],"say":{"fw":"Port 23?\nNo rule allows it"},"table":{"cols":["protocol","to","port","action"],"hl":1,"rows":[["TCP","192.168.2.10","443","allow"],["any","any","any","deny"]],"title":"Firewall rules, checked top to bottom"},"text":"Someone tries Telnet, TCP port `23`, to the same server. The first rule doesn't match (wrong port); the second does: **deny**. The message never reaches the server.","title":"Telnet: blocked."}],"w":780}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> Firewalls and ACLs pick which services to allow by protocol and destination port; a stateful firewall lets the answers back in.</p>
<h3 id="try-it-on-your-own-computer-optional">Try it on your own computer (optional)</h3>
<p>You can list your own computer&rsquo;s conversations, with both sockets for each.</p>
<p><strong>On Windows</strong>, open <em>Command Prompt</em> and type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">netstat -an
</span></span></code></pre></div><p><strong>On a Mac</strong>, open <em>Terminal</em> and type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">netstat -an -p tcp
</span></span></code></pre></div><p>Each line is one conversation: your socket on the left (<em>Local Address</em>), the other end&rsquo;s on the right
(<em>Foreign Address</em>), and its <strong>state</strong>. <code>ESTABLISHED</code> is a connection that finished its handshake; <code>LISTEN</code>
(Windows says <code>LISTENING</code>) is a program waiting for one. Look for a <code>:443</code> on the right: that&rsquo;s a secure
website, and your side of it has a high, temporary port. (On a Mac, the port comes after a dot instead of a
colon: <code>192.168.1.10.51000</code>.)</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Get past the firewall</h2>
  </header>
  <div class="lab-stage-body">
    <p>A small office has this firewall in front of its servers:</p>
<table>
  <thead>
      <tr>
          <th>#</th>
          <th>protocol</th>
          <th>to</th>
          <th>port</th>
          <th>action</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>1</td>
          <td>TCP</td>
          <td><code>10.1.1.20</code></td>
          <td><code>22</code></td>
          <td>allow</td>
      </tr>
      <tr>
          <td>2</td>
          <td>TCP</td>
          <td><code>10.1.1.30</code></td>
          <td><code>443</code></td>
          <td>allow</td>
      </tr>
      <tr>
          <td>3</td>
          <td>UDP</td>
          <td><code>10.1.1.53</code></td>
          <td><code>53</code></td>
          <td>allow</td>
      </tr>
      <tr>
          <td>4</td>
          <td>any</td>
          <td>any</td>
          <td>any</td>
          <td>deny</td>
      </tr>
  </tbody>
</table>
<p>For each attempt below, say which rule it matches and whether it gets through:</p>
<ol>
<li>an engineer logs in to <code>10.1.1.20</code> with SSH;</li>
<li>the same engineer tries Telnet to <code>10.1.1.20</code>;</li>
<li>a browser opens <code>https://10.1.1.30</code>;</li>
<li>a browser opens <code>http://10.1.1.30</code> (no <em>s</em>);</li>
<li>a laptop asks <code>10.1.1.53</code> for a name, in a normal small DNS question;</li>
<li>the same laptop asks <code>10.1.1.53</code> for a name whose answer is too big for one UDP message.</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Turn each attempt into <em>protocol and destination port</em> first, from the common-ports table. Then go down the
rules from the top: the first one that matches wins.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p><code>http://</code> and <code>https://</code> are different ports. And when a DNS answer doesn&rsquo;t fit, the computer asks again over
the other protocol, on the same port number.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <table>
  <thead>
      <tr>
          <th></th>
          <th>Attempt</th>
          <th>Protocol and port</th>
          <th>Rule</th>
          <th>Result</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>1</td>
          <td>SSH to <code>10.1.1.20</code></td>
          <td>TCP <code>22</code></td>
          <td>1</td>
          <td>allowed</td>
      </tr>
      <tr>
          <td>2</td>
          <td>Telnet to <code>10.1.1.20</code></td>
          <td>TCP <code>23</code></td>
          <td>4</td>
          <td>blocked: the right server, but the wrong port</td>
      </tr>
      <tr>
          <td>3</td>
          <td>HTTPS to <code>10.1.1.30</code></td>
          <td>TCP <code>443</code></td>
          <td>2</td>
          <td>allowed</td>
      </tr>
      <tr>
          <td>4</td>
          <td>HTTP to <code>10.1.1.30</code></td>
          <td>TCP <code>80</code></td>
          <td>4</td>
          <td>blocked: plain HTTP is a different port</td>
      </tr>
      <tr>
          <td>5</td>
          <td>DNS question to <code>10.1.1.53</code></td>
          <td>UDP <code>53</code></td>
          <td>3</td>
          <td>allowed</td>
      </tr>
      <tr>
          <td>6</td>
          <td>big DNS answer from <code>10.1.1.53</code></td>
          <td>TCP <code>53</code></td>
          <td>4</td>
          <td>blocked: rule 3 only allows UDP</td>
      </tr>
  </tbody>
</table>
<p>Number 6 is a real fault: everyday names work, and the odd one with a big answer fails, which is confusing
until you remember DNS uses <strong>both</strong> UDP and TCP on port 53. The fix is a fifth rule, above the deny:
<em>allow TCP to <code>10.1.1.53</code> port <code>53</code></em>.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>DHCP, step by step</title><link>https://networkdoodles.com/lessons/networking-101/task-4-1/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-4-1/</guid><description> 1 explainHow does a new laptop get an address? The new student It’s a new student’s first day. They don’t know anyone or where to sit. So they stand at the front and ask the whole room, “Where can I sit?” The teacher walks over and says, just to them, “Desk 10 is free.” The student says, out loud to everyone, “I’ll take desk 10!” And the teacher says, just to them, “It’s yours, for this term.”</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>How does a new laptop get an address?</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="the-new-student">The new student</h3>
<p>It&rsquo;s a new student&rsquo;s first day. They don&rsquo;t know anyone or where to sit. So they stand at the front and ask the
whole room, <em>&ldquo;Where can I sit?&rdquo;</em> The teacher walks over and says, just to them, <em>&ldquo;Desk 10 is free.&rdquo;</em> The
student says, out loud to everyone, <em>&ldquo;I&rsquo;ll take desk 10!&rdquo;</em> And the teacher says, just to them, <em>&ldquo;It&rsquo;s yours,
for this term.&rdquo;</em></p>
<p>A brand-new laptop plugged into a network is that new student. It has a <strong>MAC address</strong> (its name, lesson 1.1)
but no <strong>IP address</strong> (where it lives, lesson 3.1), so it can&rsquo;t talk to anything beyond the end of its cable.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A new laptop is like a new student: it has a name, but no seat yet.</p>
<h3 id="dhcp-the-teacher-who-hands-out-seats">DHCP: the teacher who hands out seats</h3>
<p>Nobody wants to type addresses by hand into every phone and laptop. So one computer on the network has the job
of handing them out: the <strong>DHCP server</strong>. <em>DHCP</em> stands for <em>Dynamic Host Configuration Protocol</em>. Taking it
apart:</p>
<ul>
<li><strong>Dynamic</strong>: automatic, done as needed.</li>
<li><strong>Host</strong>: a laptop, phone or anything else that sends its own messages (lesson 1.1).</li>
<li><strong>Configuration</strong>: its settings.</li>
<li><strong>Protocol</strong>: the agreed rules (lesson 1.2).</li>
</ul>
<p>So: <em>the rules for giving hosts their settings automatically</em>. At home, the DHCP server is inside your home
router. At school or in an office, it&rsquo;s often a server in a data center (lesson 2.3).</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A DHCP server hands out addresses and settings to new hosts automatically.</p>
<h3 id="shouting-and-whispering">Shouting and whispering</h3>
<p>There are two ways to send a message, and DHCP uses both:</p>
<ul>
<li><strong>Broadcast</strong>: to <em>everyone</em> on the network, like the student asking the whole room. In a frame, the
broadcast MAC address is <code>FF:FF:FF:FF:FF:FF</code>, and the broadcast IP address is <code>255.255.255.255</code>. Both mean
<em>all of you</em>.</li>
<li><strong>Unicast</strong>: to <em>one</em> host only, like the teacher talking to just the student. It uses that host&rsquo;s own
address. (<em>Uni</em> means one, like a unicycle has one wheel.)</li>
</ul>
<p class="lab-recap"><span class="mono">in one sentence</span> A broadcast goes to everyone on the network; a unicast goes to just one host.</p>
<h3 id="dora-four-messages">DORA: four messages</h3>
<p>The laptop and the DHCP server swap four messages, and their first letters spell <strong>DORA</strong>:</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Message</th>
          <th>Sent by</th>
          <th>In plain words</th>
          <th>Who gets it</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>D</strong></td>
          <td><strong>Discover</strong></td>
          <td>laptop</td>
          <td>Is there a DHCP server out there?</td>
          <td>everyone: a <strong>broadcast</strong></td>
      </tr>
      <tr>
          <td><strong>O</strong></td>
          <td><strong>Offer</strong></td>
          <td>server</td>
          <td>You can have <code>192.168.1.10</code></td>
          <td>just the laptop: a <strong>unicast</strong></td>
      </tr>
      <tr>
          <td><strong>R</strong></td>
          <td><strong>Request</strong></td>
          <td>laptop</td>
          <td>Yes please, I&rsquo;ll take <code>192.168.1.10</code></td>
          <td>everyone: a broadcast</td>
      </tr>
      <tr>
          <td><strong>A</strong></td>
          <td><strong>Ack</strong></td>
          <td>server</td>
          <td>It&rsquo;s yours for 24 hours</td>
          <td>just the laptop: a unicast</td>
      </tr>
  </tbody>
</table>
<p><em>Ack</em> is short for <em>acknowledge</em>: to say <em>yes, got it</em>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Discover (shout), Offer (to you), Request (shout), Ack (to you): DORA.</p>
<h3 id="what-the-laptop-gets">What the laptop gets</h3>
<p>It doesn&rsquo;t just get an address. It gets four settings:</p>
<ol>
<li>its <strong>IP address</strong>, like <code>192.168.1.10</code>;</li>
<li>the <strong>subnet mask</strong>, which says which addresses are on its own network (lesson 3.2);</li>
<li>the <strong>default gateway</strong>: the router, the way out to other networks (lesson 2.1);</li>
<li>a <strong>DNS server</strong>. <em>DNS</em> stands for <em>Domain Name System</em>: the internet&rsquo;s phone book. People use names like
<code>networkdoodles.com</code>, but computers need IP addresses, so the DNS server looks names up and gives back the
address.</li>
</ol>
<p>It gets them for a while, not forever, like borrowing a library book. That loan is called the <strong>lease</strong>.
Halfway through, the laptop asks to keep its address for longer, and usually the answer is yes.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The laptop borrows an address, a mask, a gateway and a DNS server, for the length of a lease.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>The network we&rsquo;ll watch</h2>
  </header>
  <div class="lab-stage-body">
    <p>A small home network: your laptop, a printer and the home router, all plugged into one <strong>switch</strong> (from
<a href="/lessons/networking-101/task-2-1/">lesson 2.1</a>). Each one has a MAC address, burned into its network card. We&rsquo;ve
made them easy to spot:</p>
<table>
  <thead>
      <tr>
          <th>Host</th>
          <th>MAC address</th>
          <th>IP address</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Your laptop</td>
          <td><code>AA:AA:AA:11:11:11</code></td>
          <td>none yet</td>
      </tr>
      <tr>
          <td>Printer</td>
          <td><code>BB:BB:BB:22:22:22</code></td>
          <td><code>192.168.1.5</code></td>
      </tr>
      <tr>
          <td>Home router, the DHCP server</td>
          <td><code>CC:CC:CC:33:33:33</code></td>
          <td><code>192.168.1.1</code></td>
      </tr>
  </tbody>
</table>
<p>DHCP messages travel inside the layers from <a href="/lessons/networking-101/task-1-2/">lesson 1.2</a>, like every other
message. Under the animation, the <strong>inside the frame</strong> box opens each one up:</p>
<ul>
<li><strong>L1, physical</strong>: the signal on the cable, ones and zeros.</li>
<li><strong>L2, data link</strong>: the Ethernet frame, with a <strong>destination MAC</strong> and a <strong>source MAC</strong>. The switch reads this.</li>
<li><strong>L3, network</strong>: the IP packet, with a destination and source <strong>IP address</strong>.</li>
<li><strong>L4, transport</strong>: <strong>UDP</strong> (<em>User Datagram Protocol</em>: a quick way to send a message without checking first that
the other side is ready, like dropping a postcard in a postbox), with <strong>port numbers</strong>. A port number says
which program a message is for: DHCP servers listen on port <strong>67</strong>, and the computer asking for an address
(the <strong>client</strong>, meaning <em>the one asking for a service</em>) listens on port <strong>68</strong>.</li>
<li><strong>L7, application</strong>: the DHCP message itself: Discover, Offer, Request or Ack, and the settings.</li>
</ul>
<p>Next to it is the switch&rsquo;s <strong>MAC address table</strong>: which MAC address lives on which port. It starts empty and
fills up as the switch sees frames.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Three hosts on one switch, each with its own MAC address, and a frame you can open layer by layer.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Watch the laptop get its address</h2>
  </header>
  <div class="lab-stage-body">
    <p>Press <strong>Play</strong>, or step through with → (the arrow keys work too). Turn on <strong>Slow</strong> for the busy steps. In each
step, look at the <strong>highlighted</strong> parts of the frame: they&rsquo;re what changes.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A laptop plugs into a switch with a printer and a home router, and gets its IP address with DHCP: a broadcast Discover, a unicast Offer, a broadcast Request and a unicast Ack. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A laptop plugs into a switch with a printer and a home router, and gets its IP address with DHCP: a broadcast Discover, a unicast Offer, a broadcast Request and a unicast Ack"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":380,"links":[["pc","sw",{"b":"port 1","bf":0.25}],["sw","prn",{"a":"port 2","af":0.42}],["sw","rtr",{"a":"port 3","af":0.25}]],"narrow":{"at":{"pc":[90,130],"prn":[180,495],"rtr":[270,130],"sw":[180,330]},"h":610,"links":{"0":{"bf":0.42},"2":{"af":0.42}},"w":360},"nodes":{"pc":{"kind":"laptop","label":"Your laptop","sub":"IP: none yet","sub2":"MAC AA:AA:AA:11:11:11","x":95,"y":170},"prn":{"kind":"printer","label":"Printer","sub":"192.168.1.5","sub2":"MAC BB:BB:BB:22:22:22","x":390,"y":300},"rtr":{"kind":"wifi","label":"Home router","sub":"DHCP server · 192.168.1.1","sub2":"MAC CC:CC:CC:33:33:33","subNarrow":"DHCP · 192.168.1.1","x":685,"y":170},"sw":{"kind":"switch","label":"Switch","sub":"","x":390,"y":170}},"steps":[{"frame":{"layers":[{"fields":[["cable","plugged in, link light on",true]],"l":1,"name":"physical"},{"fields":[["my MAC","AA:AA:AA:11:11:11"]],"l":2,"name":"data link"},{"fields":[["my IP","none yet (0.0.0.0)",true],["DHCP server","don't know who"]],"l":3,"name":"network"}],"title":"What the laptop knows"},"hot":["pc","sw"],"links":[["pc","sw"]],"say":{"pc":"I have a MAC address,\nbut no IP address"},"table":{"cols":["port","MAC address"],"empty":"empty: it hasn't seen any frames yet","rows":[],"title":"Switch's MAC address table"},"text":"The cable goes in and the link lights come on: that's **layer 1**, the physical connection, working. The laptop has a MAC address, burned in at the factory, but **no IP address**. It can't talk to anyone yet.","title":"Plugged in."},{"frame":{"layers":[{"fields":[["signal","1s and 0s on the cable"]],"l":1,"name":"physical"},{"fields":[["dst MAC","FF:FF:FF:FF:FF:FF",true],["src MAC","AA:AA:AA:11:11:11"],["type","IPv4"]],"l":2,"name":"Ethernet"},{"fields":[["src IP","0.0.0.0",true],["dst IP","255.255.255.255",true]],"l":3,"name":"IP"},{"fields":[["src port","68 (DHCP client)"],["dst port","67 (DHCP server)"]],"l":4,"name":"UDP"},{"fields":[["message","DISCOVER",true],["client MAC","AA:AA:AA:11:11:11"],["transaction ID","0x3903F326"]],"l":7,"name":"DHCP"}],"title":"Inside the **DISCOVER**, layer by layer"},"hot":["pc"],"links":[["pc","sw"]],"packets":[{"c":"amber","end":"stay","label":"DISCOVER","path":["pc","sw"]}],"text":"The laptop shouts. It doesn't know who the DHCP server is, so it sends to **everyone**: destination MAC `FF:FF:FF:FF:FF:FF`, destination IP `255.255.255.255`. It has no IP address, so its source IP is `0.0.0.0`.","title":"D: Discover."},{"hot":["sw"],"links":[["sw","prn"],["sw","rtr"]],"packets":[{"c":"amber","end":"drop","label":"DISCOVER","path":["sw","prn"]},{"c":"amber","label":"DISCOVER","path":["sw","rtr"]}],"say":{"prn":"Not a DHCP server.\nIgnored.","rtr":"A Discover!\nI can help."},"sayAt":{"prn":{"narrow":"above","wide":"right"}},"table":{"cols":["port","MAC address"],"hl":0,"rows":[["1","AA:AA:AA:11:11:11"]],"title":"Switch's MAC address table"},"text":"First the switch reads the **source** MAC and writes it down: `AA:AA:AA:11:11:11` is on port 1. Then it reads the **destination**: `FF:FF:FF:FF:FF:FF`, a broadcast. Broadcasts go out of **every other port**, so the printer and the router both get a copy.","title":"The switch learns, then floods."},{"hot":["rtr"],"say":{"rtr":"Pool: .10 to .200\n.10 is free!"},"text":"The router's DHCP server looks in its **pool**, the range of addresses it's allowed to hand out (here `192.168.1.10` to `192.168.1.200`), and finds one nobody's using: `192.168.1.10`. It remembers the transaction ID so it can match the answer to the question.","title":"The server picks an address."},{"frame":{"layers":[{"fields":[["signal","1s and 0s on the cable"]],"l":1,"name":"physical"},{"fields":[["dst MAC","AA:AA:AA:11:11:11",true],["src MAC","CC:CC:CC:33:33:33"],["type","IPv4"]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.1"],["dst IP","192.168.1.10",true]],"l":3,"name":"IP"},{"fields":[["src port","67 (server)"],["dst port","68 (client)"]],"l":4,"name":"UDP"},{"fields":[["message","OFFER",true],["your IP","192.168.1.10",true],["subnet mask","255.255.255.0"],["router","192.168.1.1"],["DNS","192.168.1.1"],["lease","86400 s (24 hours)"],["transaction ID","0x3903F326"]],"l":7,"name":"DHCP"}],"title":"Inside the **OFFER**"},"hot":["rtr","pc"],"links":[["rtr","sw"],["sw","pc"]],"packets":[{"c":"green","label":"OFFER","path":["rtr","sw","pc"]}],"say":{"prn":"(nothing for me)"},"table":{"cols":["port","MAC address"],"hl":1,"rows":[["1","AA:AA:AA:11:11:11"],["3","CC:CC:CC:33:33:33"]],"title":"Switch's MAC address table"},"text":"Now the router knows exactly who asked: the laptop's MAC came in the Discover. So the Offer is a **unicast**: destination MAC `AA:AA:AA:11:11:11`, to the address it's offering, `192.168.1.10`. The switch learns the router is on port 3 and, because it already knows `AA:AA:AA:11:11:11` is on port 1, sends it **only** there. The printer never sees it.","title":"O: Offer."},{"frame":{"layers":[{"fields":[["signal","1s and 0s on the cable"]],"l":1,"name":"physical"},{"fields":[["dst MAC","FF:FF:FF:FF:FF:FF",true],["src MAC","AA:AA:AA:11:11:11"],["type","IPv4"]],"l":2,"name":"Ethernet"},{"fields":[["src IP","0.0.0.0",true],["dst IP","255.255.255.255",true]],"l":3,"name":"IP"},{"fields":[["src port","68 (client)"],["dst port","67 (server)"]],"l":4,"name":"UDP"},{"fields":[["message","REQUEST",true],["requested IP","192.168.1.10",true],["server ID","192.168.1.1",true],["transaction ID","0x3903F326"]],"l":7,"name":"DHCP"}],"title":"Inside the **REQUEST**"},"hot":["pc"],"links":[["pc","sw"],["sw","prn"],["sw","rtr"]],"packets":[{"c":"amber","end":"stay","label":"REQUEST","path":["pc","sw"]},{"at":1,"c":"amber","end":"drop","label":"REQUEST","path":["sw","prn"]},{"at":1,"c":"amber","label":"REQUEST","path":["sw","rtr"]}],"say":{"pc":"I'll take\n192.168.1.10, please"},"text":"The laptop answers, and it **shouts again**: broadcast MAC, source IP still `0.0.0.0`, because the address isn't officially its own yet. Shouting means that if two servers had made offers, both hear which one it picked. The switch floods it out of every port again.","title":"R: Request."},{"frame":{"layers":[{"fields":[["signal","1s and 0s on the cable"]],"l":1,"name":"physical"},{"fields":[["dst MAC","AA:AA:AA:11:11:11",true],["src MAC","CC:CC:CC:33:33:33"],["type","IPv4"]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.1"],["dst IP","192.168.1.10",true]],"l":3,"name":"IP"},{"fields":[["src port","67 (server)"],["dst port","68 (client)"]],"l":4,"name":"UDP"},{"fields":[["message","ACK",true],["your IP","192.168.1.10",true],["subnet mask","255.255.255.0"],["router","192.168.1.1"],["DNS","192.168.1.1"],["lease","86400 s (24 hours)"]],"l":7,"name":"DHCP"}],"title":"Inside the **ACK**"},"hot":["rtr","pc"],"links":[["rtr","sw"],["sw","pc"]],"packets":[{"c":"green","label":"ACK","path":["rtr","sw","pc"]}],"say":{"rtr":"It's yours\nfor 24 hours"},"text":"The router writes it down, *`192.168.1.10` belongs to `AA:AA:AA:11:11:11` for 24 hours*, and sends the **Ack**: a unicast again, straight to the laptop. The switch sends it out of port 1 only.","title":"A: Ack."},{"frame":{"layers":[{"fields":[["my MAC","AA:AA:AA:11:11:11"]],"l":2,"name":"data link"},{"fields":[["my IP","192.168.1.10",true],["subnet mask","255.255.255.0 (/24)",true],["default gateway","192.168.1.1",true],["DNS server","192.168.1.1",true],["lease","24 hours, ask again in 12",true]],"l":3,"name":"network"}],"title":"What the laptop knows now"},"hot":["pc"],"say":{"pc":"I'm 192.168.1.10!"},"set":{"pc":"IP: 192.168.1.10/24"},"text":"The laptop puts on its new settings. It's `192.168.1.10`, its network is `192.168.1.0/24`, anything for another network goes to the gateway `192.168.1.1`, and it asks `192.168.1.1` to look up names. From now on it can send unicasts with a real source IP.","title":"Configured!"},{"hot":["pc","rtr"],"packets":[{"c":"amber","label":"D","path":["pc","sw","rtr"]},{"at":1,"c":"amber","end":"drop","label":"D","path":["sw","prn"]},{"at":2.3,"c":"green","label":"O","path":["rtr","sw","pc"]},{"at":4.6,"c":"amber","label":"R","path":["pc","sw","rtr"]},{"at":5.6,"c":"amber","end":"drop","label":"R","path":["sw","prn"]},{"at":6.9,"c":"green","label":"A","path":["rtr","sw","pc"]}],"text":"**Discover** (shout) → **Offer** (to you) → **Request** (shout) → **Ack** (to you). Broadcast, unicast, broadcast, unicast. Amber messages went to everyone; green ones to just the laptop. The printer heard both shouts and neither answer.","title":"The whole thing again: D-O-R-A."}],"w":780}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p>What to notice, step by step:</p>
<ol>
<li><strong>Plugged in</strong>: layer 1 comes up first. No cable (or no Wi-Fi), no network.</li>
<li><strong>Discover</strong>: the destination MAC is <code>FF:FF:FF:FF:FF:FF</code> and the source IP is <code>0.0.0.0</code>. Both say <em>I don&rsquo;t
know anyone and I&rsquo;m nobody yet</em>.</li>
<li><strong>The switch learns, then floods</strong>: it learns from the <strong>source</strong> MAC and decides where to send from the
<strong>destination</strong> MAC. A broadcast goes everywhere; the printer opens it and throws it away.</li>
<li><strong>The server picks an address</strong> from its pool.</li>
<li><strong>Offer</strong>: now it&rsquo;s a <strong>unicast</strong> to <code>AA:AA:AA:11:11:11</code>, and the switch, which learned that address in step 3,
sends it to port 1 only.</li>
<li><strong>Request</strong>: broadcast again. Same shape as the Discover, with the address it wants inside.</li>
<li><strong>Ack</strong>: unicast again.</li>
<li><strong>Configured</strong>: four settings, and a lease.</li>
</ol>
<p><strong>Wi-Fi works the same way.</strong> A phone joining Wi-Fi does exactly these four steps; the &ldquo;cable&rdquo; is radio
instead of copper, and the access point does the switch&rsquo;s job.</p>
<h3 id="try-it-on-your-own-computer-optional">Try it on your own computer (optional)</h3>
<p>You can see the result of DORA on your own laptop: the address, the DHCP server it came from, and the lease.</p>
<p><strong>On Windows</strong>, open <em>Command Prompt</em> (press the Windows key, type <code>cmd</code>, press Enter) and type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">ipconfig /all
</span></span></code></pre></div><p>Find your Wi-Fi or Ethernet adapter. Look for <strong>Physical Address</strong> (your MAC), <strong>IPv4 Address</strong>, <strong>DHCP Server</strong>,
<strong>Lease Obtained</strong> and <strong>Lease Expires</strong>. To watch it happen again, <code>ipconfig /release</code> gives the address back
and <code>ipconfig /renew</code> runs DORA for a new one (your internet drops for a few seconds in between).</p>
<p><strong>On a Mac</strong>, open <em>Terminal</em> (press <kbd>Cmd</kbd>+<kbd>Space</kbd>, type <code>terminal</code>, press Enter) and type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">ipconfig getpacket en0
</span></span></code></pre></div><p>That prints the last DHCP <strong>Ack</strong> your Mac got on Wi-Fi (<code>en0</code> is usually Wi-Fi; try <code>en1</code> if it&rsquo;s empty).
Look for <code>yiaddr</code> (<em>your IP address</em>), <code>chaddr</code> (your MAC), <code>subnet_mask</code>, <code>router</code>, <code>domain_name_server</code> and
<code>lease_time</code> (in seconds). You just read the inside of a real Ack.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The laptop shouts twice and the server whispers twice, and at the end the laptop has its address.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>A second laptop joins</h2>
  </header>
  <div class="lab-stage-body">
    <p>Your friend plugs their laptop into <strong>port 4</strong> of the same switch. Its MAC address is <code>DD:DD:DD:44:44:44</code>,
and the router offers it <code>192.168.1.11</code>. The switch still has its table from the animation.</p>
<p>Work out, for your friend&rsquo;s <strong>Discover</strong> and the router&rsquo;s <strong>Offer</strong> back to them:</p>
<ol>
<li>the destination MAC and source MAC;</li>
<li>the destination IP and source IP;</li>
<li>which ports the switch sends each one out of, and so whether your laptop sees it;</li>
<li>what the switch&rsquo;s MAC address table looks like after both.</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Every Discover and Request looks the same from the outside: the shout to everyone. Only the source MAC changes.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>The switch learns from the <strong>source</strong> MAC of every frame it receives. So after the Discover it knows port 4.
Broadcasts go out of every port <em>except the one they came in on</em>.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>For the Offer, the switch looks up the <strong>destination</strong> MAC in its table. It learned <code>DD:DD:DD:44:44:44</code> a moment ago.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <table>
  <thead>
      <tr>
          <th></th>
          <th>Discover</th>
          <th>Offer</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>dst MAC</td>
          <td><code>FF:FF:FF:FF:FF:FF</code> (broadcast)</td>
          <td><code>DD:DD:DD:44:44:44</code> (unicast)</td>
      </tr>
      <tr>
          <td>src MAC</td>
          <td><code>DD:DD:DD:44:44:44</code></td>
          <td><code>CC:CC:CC:33:33:33</code></td>
      </tr>
      <tr>
          <td>dst IP</td>
          <td><code>255.255.255.255</code></td>
          <td><code>192.168.1.11</code></td>
      </tr>
      <tr>
          <td>src IP</td>
          <td><code>0.0.0.0</code></td>
          <td><code>192.168.1.1</code></td>
      </tr>
      <tr>
          <td>out of ports</td>
          <td>1, 2 and 3 (everything except 4)</td>
          <td>4 only</td>
      </tr>
      <tr>
          <td>your laptop sees it?</td>
          <td>yes, and ignores it (it&rsquo;s not a DHCP server)</td>
          <td>no</td>
      </tr>
  </tbody>
</table>
<p>The switch&rsquo;s table after both:</p>
<table>
  <thead>
      <tr>
          <th>port</th>
          <th>MAC address</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>1</td>
          <td><code>AA:AA:AA:11:11:11</code></td>
      </tr>
      <tr>
          <td>3</td>
          <td><code>CC:CC:CC:33:33:33</code></td>
      </tr>
      <tr>
          <td>4</td>
          <td><code>DD:DD:DD:44:44:44</code></td>
      </tr>
  </tbody>
</table>
<p>The printer still isn&rsquo;t in it: it hasn&rsquo;t <em>sent</em> anything yet, and the switch only learns from frames it receives.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>Subnetting with VLSM</title><link>https://networkdoodles.com/lessons/networking-101/task-3-3/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-3-3/</guid><description> 1 explainSharing out a block of addresses Sharing a pizza fairly Five friends share a big pizza. One is starving, one is quite hungry, and three just want a nibble. If you cut it into five equal slices, the starving one goes hungry and the nibblers leave crusts. If you cut big slices for the hungry ones and small slivers for the rest, everyone gets what they need and there might even be some left over.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Sharing out a block of addresses</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="sharing-a-pizza-fairly">Sharing a pizza fairly</h3>
<p>Five friends share a big pizza. One is starving, one is quite hungry, and three just want a nibble. If you cut it
into five equal slices, the starving one goes hungry and the nibblers leave crusts. If you cut big slices for
the hungry ones and small slivers for the rest, everyone gets what they need and there might even be some left
over.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Give each person the size of slice they need, not the same slice for everyone.</p>
<h3 id="subnets">Subnets</h3>
<p>A school or company is usually given one <strong>block</strong> of addresses, like <code>192.168.10.0/24</code> (256 addresses: from
lesson 3.2). Cutting that block into smaller networks is called <strong>subnetting</strong>, and each small network is a
<strong>subnet</strong> (<em>sub</em> means <em>under</em> or <em>part of</em>, like a submarine goes under the sea).</p>
<p>Why cut it up?</p>
<ul>
<li><strong>Groups</strong>: students, teachers and cameras each get their own subnet, so each can have its own rules.</li>
<li><strong>Fewer announcements</strong>: each subnet is its own broadcast domain (lesson 2.2), so broadcasts stay smaller.</li>
<li><strong>No waste</strong>: each group gets the size it needs.</li>
</ul>
<p class="lab-recap"><span class="mono">in one sentence</span> Subnetting cuts one block of addresses into smaller networks called subnets.</p>
<h3 id="vlsm-a-different-size-for-each">VLSM: a different size for each</h3>
<p>The simple way is to cut equal pieces, but groups aren&rsquo;t equal: 100 students and 2 addresses for a cable between
two routers. Equal pieces big enough for the biggest group would waste nearly all of the small ones.</p>
<p><strong>VLSM</strong> stands for <em>Variable Length Subnet Masks</em>. <em>Variable</em> means <em>can change</em>, and the <em>length</em> is the
prefix from lesson 3.2. So: each subnet gets its <strong>own</strong> prefix, just big enough for its group. That&rsquo;s the
pizza cut to fit.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> VLSM gives each subnet its own prefix, so each group gets the size it needs.</p>
<h3 id="sizes-come-in-doubles">Sizes come in doubles</h3>
<p>Subnets can&rsquo;t be any size: they come in <strong>powers of two</strong>, numbers you get by doubling, starting from 1: 2, 4, 8,
16, 32, 64, 128, 256. That&rsquo;s because each host bit doubles the addresses (lesson 3.2). And remember, every subnet
loses two addresses: the network address and the broadcast.</p>
<table>
  <thead>
      <tr>
          <th>Hosts needed (up to)</th>
          <th>+ 2</th>
          <th>Block size</th>
          <th>Prefix</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>2</td>
          <td>4</td>
          <td>4</td>
          <td>/30</td>
      </tr>
      <tr>
          <td>6</td>
          <td>8</td>
          <td>8</td>
          <td>/29</td>
      </tr>
      <tr>
          <td>14</td>
          <td>16</td>
          <td>16</td>
          <td>/28</td>
      </tr>
      <tr>
          <td>30</td>
          <td>32</td>
          <td>32</td>
          <td>/27</td>
      </tr>
      <tr>
          <td>62</td>
          <td>64</td>
          <td>64</td>
          <td>/26</td>
      </tr>
      <tr>
          <td>126</td>
          <td>128</td>
          <td>128</td>
          <td>/25</td>
      </tr>
      <tr>
          <td>254</td>
          <td>256</td>
          <td>256</td>
          <td>/24</td>
      </tr>
  </tbody>
</table>
<p class="lab-recap"><span class="mono">in one sentence</span> A subnet&rsquo;s size is a power of two, and two of its addresses are always taken.</p>
<h3 id="the-recipe">The recipe</h3>
<ol>
<li><strong>List the groups, biggest first.</strong></li>
<li>For each group, <strong>add 2</strong> (for the network address and the broadcast).</li>
<li>Find the <strong>smallest power of two</strong> that&rsquo;s at least that number. That&rsquo;s the <strong>block size</strong>. Which power it is,
is the number of host bits: 64 = 2⁶, so 6 host bits.</li>
<li>The <strong>prefix</strong> is 32 minus the host bits: 32 − 6 = <strong>/26</strong>.</li>
<li><strong>Place it</strong> at the next free address. A block has to start at a multiple of its own size (a block of 64
starts at 0, 64, 128 or 192). Going biggest first means it always does, with no gaps.</li>
<li>Write down the <strong>network</strong> (the first address), the <strong>hosts</strong> (everything between) and the <strong>broadcast</strong>
(the network plus the block size, minus 1).</li>
</ol>
<p class="lab-recap"><span class="mono">in one sentence</span> Biggest first, add 2, round up to a power of two, place it at the next free address.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>A school&rsquo;s network</h2>
  </header>
  <div class="lab-stage-body">
    <p>A school has the block <code>192.168.10.0/24</code>: 256 addresses. It needs five subnets:</p>
<table>
  <thead>
      <tr>
          <th>Group</th>
          <th>Hosts</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Students</td>
          <td>100</td>
      </tr>
      <tr>
          <td>Teachers</td>
          <td>50</td>
      </tr>
      <tr>
          <td>Office</td>
          <td>20</td>
      </tr>
      <tr>
          <td>Cameras</td>
          <td>10</td>
      </tr>
      <tr>
          <td>Link between two routers</td>
          <td>2</td>
      </tr>
  </tbody>
</table>
<p>With equal pieces, every subnet would have to fit 100 students: a /25 each, 128 addresses. Five of those is
640 addresses, and the school only has 256. It doesn&rsquo;t fit! With VLSM, it does, with room to spare. Watch.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Equal slices don&rsquo;t fit this school&rsquo;s 256 addresses; slices cut to size do.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Carve it up, step by step</h2>
  </header>
  <div class="lab-stage-body">
    <p>The bar is the whole block, <code>.0</code> on the left to <code>.255</code> on the right. Each step carves out one subnet, and the
table fills in. Press <strong>Play</strong>, or step with → and say each answer out loud before you look.</p>
<figure class="ipw vlsm" data-vlsm tabindex="0" aria-label="Subnetting with VLSM, step by step. Use the buttons or the arrow keys.">
  <div class="v-barwrap"><div class="v-bar" data-bar></div><div class="v-ticks mono" data-ticks></div></div>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-v="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-v="prev" aria-label="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-v="play"><span data-vplay>Play</span></button>
    <button class="icon-btn" type="button" data-v="next" aria-label="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <span class="ns-count mono" data-vcount></span>
  </div>
  <figcaption class="ns-caption" data-vcap aria-live="polite"></figcaption>
  <div class="v-tablewrap"><table class="ns-table v-table" data-vtable>
    <thead><tr><th>subnet</th><th>hosts</th><th>block</th><th>network</th><th>usable hosts</th><th>broadcast</th></tr></thead>
    <tbody></tbody>
  </table></div>
  <script type="application/json">{"block":"192.168.10.0/24","needs":[{"hosts":100,"name":"Students"},{"hosts":50,"name":"Teachers"},{"hosts":20,"name":"Office"},{"hosts":10,"name":"Cameras"},{"hosts":2,"name":"Router link"}]}</script>
</figure>
<script src="/js/ipcalc.c693c6a3d6b5c9e6ba2ba07ebd4fc0bbd7d43044d1d2e6e9c8ebb8749a59ba83.js" integrity="sha256-xpPGo9a1yea6K6B&#43;vU/Au9fUMETR0ubpyOu4dJpZuoM=" defer></script>
<p>Let&rsquo;s check one by hand, the Office:</p>
<ol>
<li>20 hosts + 2 = 22.</li>
<li>The smallest power of two that&rsquo;s at least 22 is <strong>32</strong> = 2⁵. So <strong>5</strong> host bits.</li>
<li>Prefix: 32 − 5 = <strong>/27</strong>.</li>
<li>Students used <code>.0</code> to <code>.127</code>, Teachers <code>.128</code> to <code>.191</code>. The next free address is <strong><code>.192</code></strong>, and 192 is a
multiple of 32. ✓</li>
<li>Network <code>192.168.10.192/27</code>, hosts <code>.193</code> to <code>.222</code>, broadcast <code>.192 + 32 − 1</code> = <strong><code>.223</code></strong>.</li>
</ol>
<p>Now check the Cameras the same way, then compare with the table.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Each subnet takes the smallest power-of-two block that fits its hosts plus two, placed biggest first.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Your turn: a gaming club</h2>
  </header>
  <div class="lab-stage-body">
    <p>A gaming club has the block <code>172.16.0.0/24</code>. Plan its subnets with VLSM:</p>
<table>
  <thead>
      <tr>
          <th>Group</th>
          <th>Hosts</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Library</td>
          <td>25</td>
      </tr>
      <tr>
          <td>Gaming lab</td>
          <td>60</td>
      </tr>
      <tr>
          <td>Printers</td>
          <td>5</td>
      </tr>
      <tr>
          <td>Staff</td>
          <td>12</td>
      </tr>
      <tr>
          <td>Router link A</td>
          <td>2</td>
      </tr>
      <tr>
          <td>Router link B</td>
          <td>2</td>
      </tr>
  </tbody>
</table>
<p>For each one, write the prefix, network, usable hosts and broadcast. How many addresses are left over?</p>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Sort them first: Gaming lab 60, Library 25, Staff 12, Printers 5, then the two links.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Gaming lab: 60 + 2 = 62, so a block of 64, a /26, starting at <code>172.16.0.0</code>. Library: 25 + 2 = 27, so a block of 32, a /27, starting at <code>.64</code>.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Each router link is a /30, a block of 4.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <p>Here it is, step by step:</p>
<figure class="ipw vlsm" data-vlsm tabindex="0" aria-label="Subnetting with VLSM, step by step. Use the buttons or the arrow keys.">
  <div class="v-barwrap"><div class="v-bar" data-bar></div><div class="v-ticks mono" data-ticks></div></div>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-v="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-v="prev" aria-label="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-v="play"><span data-vplay>Play</span></button>
    <button class="icon-btn" type="button" data-v="next" aria-label="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <span class="ns-count mono" data-vcount></span>
  </div>
  <figcaption class="ns-caption" data-vcap aria-live="polite"></figcaption>
  <div class="v-tablewrap"><table class="ns-table v-table" data-vtable>
    <thead><tr><th>subnet</th><th>hosts</th><th>block</th><th>network</th><th>usable hosts</th><th>broadcast</th></tr></thead>
    <tbody></tbody>
  </table></div>
  <script type="application/json">{"block":"172.16.0.0/24","needs":[{"hosts":25,"name":"Library"},{"hosts":60,"name":"Gaming lab"},{"hosts":5,"name":"Printers"},{"hosts":12,"name":"Staff"},{"hosts":2,"name":"Link A"},{"hosts":2,"name":"Link B"}]}</script>
</figure>
<script src="/js/ipcalc.c693c6a3d6b5c9e6ba2ba07ebd4fc0bbd7d43044d1d2e6e9c8ebb8749a59ba83.js" integrity="sha256-xpPGo9a1yea6K6B&#43;vU/Au9fUMETR0ubpyOu4dJpZuoM=" defer></script>
<table>
  <thead>
      <tr>
          <th>Group</th>
          <th>Prefix</th>
          <th>Network</th>
          <th>Usable hosts</th>
          <th>Broadcast</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Gaming lab</td>
          <td>/26</td>
          <td><code>172.16.0.0</code></td>
          <td><code>.1</code> – <code>.62</code></td>
          <td><code>172.16.0.63</code></td>
      </tr>
      <tr>
          <td>Library</td>
          <td>/27</td>
          <td><code>172.16.0.64</code></td>
          <td><code>.65</code> – <code>.94</code></td>
          <td><code>172.16.0.95</code></td>
      </tr>
      <tr>
          <td>Staff</td>
          <td>/28</td>
          <td><code>172.16.0.96</code></td>
          <td><code>.97</code> – <code>.110</code></td>
          <td><code>172.16.0.111</code></td>
      </tr>
      <tr>
          <td>Printers</td>
          <td>/29</td>
          <td><code>172.16.0.112</code></td>
          <td><code>.113</code> – <code>.118</code></td>
          <td><code>172.16.0.119</code></td>
      </tr>
      <tr>
          <td>Link A</td>
          <td>/30</td>
          <td><code>172.16.0.120</code></td>
          <td><code>.121</code> – <code>.122</code></td>
          <td><code>172.16.0.123</code></td>
      </tr>
      <tr>
          <td>Link B</td>
          <td>/30</td>
          <td><code>172.16.0.124</code></td>
          <td><code>.125</code> – <code>.126</code></td>
          <td><code>172.16.0.127</code></td>
      </tr>
  </tbody>
</table>
<p><strong>128 addresses are left over</strong>: <code>172.16.0.128</code> to <code>172.16.0.255</code>, a whole /25, ready for whatever the club needs next.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>CIDR: what the /24 means</title><link>https://networkdoodles.com/lessons/networking-101/task-3-2/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-3-2/</guid><description> 1 explainWhere the street ends and the house number starts How long is the street name? Picture a long road with two different signs. On one road, the street is called Oak and the houses are numbered 1 to 250. On another, the street is called Oak Avenue North and there are only 6 houses. The longer the street’s name, the fewer houses fit on it.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Where the street ends and the house number starts</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="how-long-is-the-street-name">How long is the street name?</h3>
<p>Picture a long road with two different signs. On one road, the street is called <em>Oak</em> and the houses are
numbered 1 to 250. On another, the street is called <em>Oak Avenue North</em> and there are only 6 houses. The longer
the street&rsquo;s name, the fewer houses fit on it.</p>
<p>In <a href="/lessons/networking-101/task-3-1/">lesson 3.1</a> you saw that an IP address is a <strong>network part</strong> (the street) and
a <strong>host part</strong> (the house number). But <code>192.168.1.10</code> on its own doesn&rsquo;t say where one ends and the other
starts. That&rsquo;s what the number after a slash is for:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">192.168.1.10/24
</span></span></code></pre></div><p>The <strong>/24</strong> is the <strong>prefix length</strong>. It means <em>the first 24 bits are the network part</em>. An address has 32 bits,
so the other 32 − 24 = <strong>8 bits</strong> are the host part.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The number after the slash says how many bits, from the left, are the network part.</p>
<h3 id="cidr-just-the-slash">CIDR: just the slash</h3>
<p>Writing networks as an address, a slash and a number is called <strong>CIDR</strong> (say <em>cider</em>). It stands for
<em>Classless Inter-Domain Routing</em>. That&rsquo;s a long name for a simple idea: <em>say exactly how long the network part
is, with a slash</em>. (Long ago, networks only came in three fixed sizes called <em>classes</em>, which wasted lots of
addresses. <em>Classless</em> means <em>any size you like</em>.)</p>
<p class="lab-recap"><span class="mono">in one sentence</span> CIDR is the way of writing a network with a slash, like <code>192.168.1.0/24</code>.</p>
<h3 id="the-subnet-mask">The subnet mask</h3>
<p>There&rsquo;s a second way of writing the same thing, which you&rsquo;ll see on computers and phones: the <strong>subnet mask</strong>.
Think of a stencil laid over the address: the holes show the network part, and the solid bits cover the host
part.</p>
<p>To make it, write a 1 for every network bit and a 0 for every host bit, then turn each group of 8 into a number,
like the light switches in lesson 3.1:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">/24  =  11111111.11111111.11111111.00000000  =  255.255.255.0
</span></span></code></pre></div><p>So <code>192.168.1.10/24</code> and <code>192.168.1.10</code> with mask <code>255.255.255.0</code> mean exactly the same thing.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The subnet mask, like <code>255.255.255.0</code>, says the same thing as the slash, written as four numbers.</p>
<h3 id="two-addresses-nobody-can-have">Two addresses nobody can have</h3>
<p>Every network keeps two of its addresses for special jobs:</p>
<ul>
<li>the <strong>network address</strong>: the very first one, with every host bit 0. It&rsquo;s the name of the whole network, like
the name of the street, for example <code>192.168.1.0</code>.</li>
<li>the <strong>broadcast address</strong>: the very last one, with every host bit 1. Send a packet to it and <em>everyone</em> on the
network gets it (the broadcast from lesson 2.2), for example <code>192.168.1.255</code>.</li>
</ul>
<p>So the hosts get everything in between.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The first address names the network and the last one means everyone, so hosts get the ones in between.</p>
<h3 id="how-many-hosts-fit">How many hosts fit?</h3>
<p>Every extra host bit <strong>doubles</strong> the number of addresses: 1 bit gives 2, 2 bits give 4, 3 bits give 8, and so on.
Mathematicians write that as 2 to the power of the number of bits: 2⁸ = 256. Take away the two special
addresses, and you&rsquo;ve got the number of hosts:</p>
<table>
  <thead>
      <tr>
          <th>Prefix</th>
          <th>Mask</th>
          <th>Host bits</th>
          <th>Addresses</th>
          <th>Hosts</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>/8</td>
          <td>255.0.0.0</td>
          <td>24</td>
          <td>16,777,216</td>
          <td>16,777,214</td>
      </tr>
      <tr>
          <td>/16</td>
          <td>255.255.0.0</td>
          <td>16</td>
          <td>65,536</td>
          <td>65,534</td>
      </tr>
      <tr>
          <td>/24</td>
          <td>255.255.255.0</td>
          <td>8</td>
          <td>256</td>
          <td>254</td>
      </tr>
      <tr>
          <td>/25</td>
          <td>255.255.255.128</td>
          <td>7</td>
          <td>128</td>
          <td>126</td>
      </tr>
      <tr>
          <td>/26</td>
          <td>255.255.255.192</td>
          <td>6</td>
          <td>64</td>
          <td>62</td>
      </tr>
      <tr>
          <td>/27</td>
          <td>255.255.255.224</td>
          <td>5</td>
          <td>32</td>
          <td>30</td>
      </tr>
      <tr>
          <td>/28</td>
          <td>255.255.255.240</td>
          <td>4</td>
          <td>16</td>
          <td>14</td>
      </tr>
      <tr>
          <td>/29</td>
          <td>255.255.255.248</td>
          <td>3</td>
          <td>8</td>
          <td>6</td>
      </tr>
      <tr>
          <td>/30</td>
          <td>255.255.255.252</td>
          <td>2</td>
          <td>4</td>
          <td>2</td>
      </tr>
  </tbody>
</table>
<p>Notice: every time the prefix goes up by one, the network is cut <strong>in half</strong>. Longer street name, fewer houses.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Hosts = 2 to the power of the host bits, minus 2; each step bigger in the prefix halves the network.</p>
<h3 id="why-a-host-cares">Why a host cares</h3>
<p>Before sending anything, a host asks itself: <em>is this address on my network?</em> It compares the network part of
its own address with the network part of the address it&rsquo;s sending to. Same street? Send it straight there.
Different street? Send it to the <strong>default gateway</strong> (the router, the way out, from lesson 2.1).</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Same network part: send it straight there; different: send it to the gateway.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>Slide the prefix</h2>
  </header>
  <div class="lab-stage-body">
    <p>Here&rsquo;s <code>192.168.1.10</code>. Slide the prefix and watch the line between <strong>network bits</strong> (blue) and <strong>host bits</strong>
(amber) move, and everything else change with it. You can type a different address too.</p>
<figure class="ipw cidr" data-cidr>
  <div class="ipw-in">
    <label><span class="mono">IP address</span><input data-ip type="text" inputmode="decimal" autocomplete="off" spellcheck="false" value="192.168.1.10"></label>
    <label class="ipw-slide"><span class="mono">prefix <b data-prefix-out></b></span><input data-prefix type="range" min="8" max="32" value="24" aria-label="Prefix length"></label>
  </div>
  <p class="ipw-err" data-err hidden>That isn't an IPv4 address yet: four numbers from 0 to 255, with dots between, like <code>10.0.0.1</code>.</p>
  <div class="ipw-rows">
    <span class="ipw-rl mono">address</span><div class="ip-row" data-bits></div>
    <span class="ipw-rl mono">mask</span><div class="ip-row" data-maskbits></div>
  </div>
  <p class="ipw-legend mono"><i class="n"></i> network bits <i class="h"></i> host bits</p>
  <p class="ipw-say" data-say aria-live="polite"></p>
  <div class="ipw-out" data-out></div>
</figure>
<script src="/js/ipcalc.c693c6a3d6b5c9e6ba2ba07ebd4fc0bbd7d43044d1d2e6e9c8ebb8749a59ba83.js" integrity="sha256-xpPGo9a1yea6K6B&#43;vU/Au9fUMETR0ubpyOu4dJpZuoM=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> Slide the prefix right and the network part grows, the host part shrinks, and fewer hosts fit.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Explore it together</h2>
  </header>
  <div class="lab-stage-body">
    <p>Use the slider above for each of these. Say what you think will happen first, then check.</p>
<ol>
<li><strong>Start at /24.</strong> The network is <code>192.168.1.0/24</code>, the broadcast is <code>192.168.1.255</code>, and there are
<strong>254</strong> hosts: <code>192.168.1.1</code> to <code>192.168.1.254</code>.</li>
<li><strong>Slide to /25.</strong> One more network bit, so the network is cut in half: 128 addresses, <strong>126</strong> hosts. Our
address <code>.10</code> is in the first half, <code>192.168.1.0</code> to <code>192.168.1.127</code>. The mask is now <code>255.255.255.128</code>.</li>
<li><strong>Change the address to <code>192.168.1.200</code>, still /25.</strong> Now it&rsquo;s in the <em>second</em> half: network
<code>192.168.1.128/25</code>, broadcast <code>192.168.1.255</code>. So with /25, <code>.10</code> and <code>.200</code> are on <strong>different networks</strong>.</li>
<li><strong>Slide to /30.</strong> Only 2 host bits: 4 addresses, <strong>2</strong> hosts. That&rsquo;s exactly enough for a cable between two
routers, which is what /30 networks are often used for.</li>
<li><strong>Slide to /16.</strong> 16 host bits: <strong>65,534</strong> hosts. The network part is just <code>192.168</code>.</li>
</ol>
<p>Now watch a host make the <em>is it on my network?</em> decision for real:</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A laptop at 192.168.1.10/24 sends to a printer at 192.168.1.20, which is on its network, so it goes straight there; then to 203.0.113.80, which isn&#39;t, so it goes to the default gateway. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A laptop at 192.168.1.10/24 sends to a printer at 192.168.1.20, which is on its network, so it goes straight there; then to 203.0.113.80, which isn&#39;t, so it goes to the default gateway"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":310,"links":[["pc","sw"],["sw","prn"],["sw","rtr"],["rtr","net"]],"narrow":{"at":{"net":[180,520],"pc":[95,85],"prn":[285,85],"rtr":[180,360],"sw":[180,215]},"h":600,"w":360,"zones":{"mine":[5,12,350,420]}},"nodes":{"net":{"kind":"cloud","label":"The internet","sub":"203.0.113.80 is out here","x":660,"y":135},"pc":{"kind":"laptop","label":"Your laptop","sub":"192.168.1.10/24","x":95,"y":135},"prn":{"kind":"printer","label":"Printer","sub":"192.168.1.20","x":290,"y":245},"rtr":{"kind":"router","label":"Gateway","sub":"192.168.1.1","x":470,"y":135},"sw":{"kind":"switch","label":"Switch","x":290,"y":135}},"steps":[{"hot":["pc","prn"],"say":{"pc":"192.168.1 = 192.168.1\nSame network!"},"text":"The laptop compares the first **24 bits**. `192.168.1`.10 and `192.168.1`.20: the same. So the printer is on its own network.","title":"Print something: is the printer on my network?"},{"hot":["pc","prn"],"links":[["pc","sw"],["sw","prn"]],"packets":[{"c":"green","label":"to .20","path":["pc","sw","prn"]}],"text":"No router needed. The frame goes through the switch, straight to the printer.","title":"Same network: send it straight there."},{"hot":["pc","net"],"say":{"pc":"203.0.113 ≠ 192.168.1\nNot my network."},"text":"`203.0.113`.80 against `192.168.1`: different. The web server is somewhere else.","title":"Load a website: is it on my network?"},{"hot":["pc","rtr"],"links":[["pc","sw"],["sw","rtr"],["rtr","net"]],"packets":[{"c":"amber","label":"to 203.0.113.80","path":["pc","sw","rtr","net"]}],"text":"The laptop sends it to its **default gateway**, `192.168.1.1`, and the router takes it from there.","title":"Different network: send it to the gateway."}],"w":760,"zones":[{"always":true,"h":285,"id":"mine","label":"my network: 192.168.1.0/24","w":525,"x":15,"y":15}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> A host compares network parts: the same means send it straight there, different means send it to the gateway.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Work out a /27</h2>
  </header>
  <div class="lab-stage-body">
    <p>A host has the address <code>10.0.0.77/27</code>. Without the slider (then check with it), work out:</p>
<ol>
<li>how many host bits, how many addresses and how many usable hosts;</li>
<li>the <strong>network address</strong>;</li>
<li>the <strong>broadcast address</strong>;</li>
<li>the <strong>first</strong> and <strong>last</strong> usable host;</li>
<li>the subnet mask.</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>32 − 27 = 5 host bits, so every /27 network is 2⁵ = 32 addresses long.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>/27 networks start at multiples of 32 in the last octet: 0, 32, 64, 96, 128&hellip; Which one is 77 in?</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>77 is between 64 and 95. The network starts at 64 and the broadcast is the last one, 95.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <ol>
<li><strong>5</strong> host bits, <strong>32</strong> addresses, <strong>30</strong> usable hosts.</li>
<li>Network: <strong><code>10.0.0.64/27</code></strong>.</li>
<li>Broadcast: <strong><code>10.0.0.95</code></strong>.</li>
<li>First host <strong><code>10.0.0.65</code></strong>, last host <strong><code>10.0.0.94</code></strong>.</li>
<li>Mask: <strong><code>255.255.255.224</code></strong> (27 ones: the last octet is <code>11100000</code> = 128 + 64 + 32 = 224).</li>
</ol>
<p>Check it: type <code>10.0.0.77</code> in the box above and slide to /27.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>What's an IP address?</title><link>https://networkdoodles.com/lessons/networking-101/task-3-1/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-3-1/</guid><description> 1 explainA name and an address Your name and where you live You have a name, and it goes wherever you go. You also have a home address, and that changes when you move house. If a friend in another country wants to post you a letter, your name alone isn’t enough: the post office needs the address, with the country, town and street, to know where to take it.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>A name and an address</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="your-name-and-where-you-live">Your name and where you live</h3>
<p>You have a <strong>name</strong>, and it goes wherever you go. You also have a <strong>home address</strong>, and that changes when you
move house. If a friend in another country wants to post you a letter, your name alone isn&rsquo;t enough: the post
office needs the address, with the country, town and street, to know where to take it.</p>
<p>Every host already has a <strong>MAC address</strong> (from <a href="/lessons/networking-101/task-1-1/">lesson 1.1</a>): that&rsquo;s its
<strong>name</strong>. It never changes, and it&rsquo;s only used to get a frame to the next stop on the same network (layer 2).</p>
<p>So hosts get a second address, an <strong>IP address</strong>: that&rsquo;s their <strong>home address</strong>. It depends on which network
they&rsquo;re plugged into, and it&rsquo;s used to get a packet across the world, through lots of networks and routers
(layer 3). <em>IP</em> stands for <em>Internet Protocol</em>: the agreed rules (a <em>protocol</em>) for addressing and delivering
packets across the internet.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A MAC address is a host&rsquo;s name; an IP address is where it lives right now.</p>
<h3 id="what-one-looks-like">What one looks like</h3>
<p>The IP addresses in this course are <strong>IPv4</strong> addresses (<em>Internet Protocol version 4</em>). They look like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">192.168.1.10
</span></span></code></pre></div><p>Four numbers with dots between them. Each number can be anything from <strong>0 to 255</strong>, so <code>192.168.1.300</code> isn&rsquo;t a
real address. Each of the four numbers is called an <strong>octet</strong> (<em>oct</em> means eight, like an octopus&rsquo;s eight arms),
because inside the computer each one is made of <strong>8 bits</strong>. Four octets make <strong>32 bits</strong> in all.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> An IPv4 address is four numbers from 0 to 255 with dots between, like <code>192.168.1.10</code>.</p>
<h3 id="numbers-as-light-switches">Numbers as light switches</h3>
<p>Remember that a <strong>bit</strong> is a 1 or a 0, like a light switch that&rsquo;s on or off. Imagine a row of 8 light switches,
and each switch is worth a different amount: 128, 64, 32, 16, 8, 4, 2 and 1. To make a number, switch on the
ones that add up to it. That&rsquo;s called <strong>binary</strong>: counting with only 1s and 0s.</p>
<table>
  <thead>
      <tr>
          <th>switch worth</th>
          <th>128</th>
          <th>64</th>
          <th>32</th>
          <th>16</th>
          <th>8</th>
          <th>4</th>
          <th>2</th>
          <th>1</th>
          <th>add up the 1s</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>192</td>
          <td>1</td>
          <td>1</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>128 + 64 = <strong>192</strong></td>
      </tr>
      <tr>
          <td>168</td>
          <td>1</td>
          <td>0</td>
          <td>1</td>
          <td>0</td>
          <td>1</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>128 + 32 + 8 = <strong>168</strong></td>
      </tr>
      <tr>
          <td>10</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>0</td>
          <td>1</td>
          <td>0</td>
          <td>1</td>
          <td>0</td>
          <td>8 + 2 = <strong>10</strong></td>
      </tr>
      <tr>
          <td>255</td>
          <td>1</td>
          <td>1</td>
          <td>1</td>
          <td>1</td>
          <td>1</td>
          <td>1</td>
          <td>1</td>
          <td>1</td>
          <td>all on = <strong>255</strong></td>
      </tr>
  </tbody>
</table>
<p>That&rsquo;s why 255 is the biggest: it&rsquo;s all eight switches on.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Each octet is 8 bits, and binary turns them into a number by adding up the switches that are on.</p>
<h3 id="the-street-and-the-house-number">The street and the house number</h3>
<p>A home address has a <strong>street</strong> (shared by everyone who lives on it) and a <strong>house number</strong> (different for
each house). An IP address is split the same way:</p>
<ul>
<li>the <strong>network part</strong> is the street: every host on the same network has the same one.</li>
<li>the <strong>host part</strong> is the house number: different for every host on that network.</li>
</ul>
<p>For <code>192.168.1.10</code> on a home network, <code>192.168.1</code> is the network (every device at home starts with it) and <code>10</code>
is this host. Exactly where the line between the two goes is the next lesson.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The front of an IP address says which network, the end says which host on it.</p>
<h3 id="private-and-public-addresses">Private and public addresses</h3>
<p>Think of a hotel. Inside, the rooms have numbers, like <em>room 214</em>, and every hotel in the world has a room 214.
But to post a letter to the hotel, you use its <strong>street address</strong>, which is unique. The front desk takes the
letter and brings it up to the right room.</p>
<p>IP addresses work the same way. Some are kept for use <strong>inside</strong> homes, schools and companies, and are never
used out on the internet. They&rsquo;re called <strong>private</strong> addresses (the room numbers):</p>
<table>
  <thead>
      <tr>
          <th>Private addresses</th>
          <th>Start with</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>10.0.0.0</code> to <code>10.255.255.255</code></td>
          <td><code>10.</code></td>
      </tr>
      <tr>
          <td><code>172.16.0.0</code> to <code>172.31.255.255</code></td>
          <td><code>172.16.</code> up to <code>172.31.</code></td>
      </tr>
      <tr>
          <td><code>192.168.0.0</code> to <code>192.168.255.255</code></td>
          <td><code>192.168.</code></td>
      </tr>
  </tbody>
</table>
<p>Every other address is <strong>public</strong>: a real, unique address out on the internet (the street address). Millions of
homes all use <code>192.168.1.something</code> inside, and that&rsquo;s fine, because the home router acts like the front desk:
it swaps the private address for the home&rsquo;s one public address on the way out, and back again on the way in.
That swap is called <strong>NAT</strong>, <em>network address translation</em> (<em>translation</em> means changing one thing into
another).</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Private addresses are used inside a home or school; public addresses are unique on the internet; the router swaps between them.</p>
<h3 id="and-ipv6">And IPv6?</h3>
<p>There are only about 4 billion IPv4 addresses, and that isn&rsquo;t enough for every phone, laptop and smart light
bulb on Earth. So there&rsquo;s a newer version, <strong>IPv6</strong> (<em>Internet Protocol version 6</em>), with much longer addresses
that look like <code>2001:db8::10</code>. They work the same way, with far more addresses. This course sticks to IPv4,
because it&rsquo;s still what you&rsquo;ll see first.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> IPv6 is the newer version with far more addresses; the ideas are the same.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>Same name, new address</h2>
  </header>
  <div class="lab-stage-body">
    <p>Your laptop at home, then at school. Watch what changes and what doesn&rsquo;t.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A laptop at home has IP address 192.168.1.10. Taken to school, it gets 10.20.5.33 from the school&#39;s network, but its MAC address stays AA:AA:AA:11:11:11. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A laptop at home has IP address 192.168.1.10. Taken to school, it gets 10.20.5.33 from the school&#39;s network, but its MAC address stays AA:AA:AA:11:11:11"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":330,"links":[["hp","hr",{"wifi":true}],["sp","sr",{"wifi":true}]],"narrow":{"at":{"hp":[180,190],"hr":[180,75],"sp":[180,470],"sr":[180,355]},"h":610,"w":360,"zones":{"home":[5,12,350,260],"school":[5,290,350,312]}},"nodes":{"hp":{"kind":"laptop","label":"Your laptop","sub":"IP 192.168.1.10","sub2":"MAC AA:AA:AA:11:11:11","x":190,"y":225},"hr":{"kind":"wifi","label":"Home router","sub":"network 192.168.1.0/24","x":190,"y":90},"sp":{"kind":"laptop","label":"Your laptop","sub":"IP: none yet","sub2":"MAC AA:AA:AA:11:11:11","x":570,"y":225},"sr":{"kind":"wifi","label":"School router","sub":"network 10.20.0.0/16","x":570,"y":90}},"steps":[{"dim":["sp"],"hot":["hp"],"text":"On the home network, the laptop is `192.168.1.10`. The home router gave it that address with DHCP (you'll watch that in lesson 4.1).","title":"At home.","zones":["home"]},{"dim":["hp"],"hot":["sp"],"say":{"sp":"I'm still AA:AA:AA:11:11:11,\nbut where am I?"},"sayAt":{"sp":{"narrow":"below"}},"text":"Same laptop, same network card, so the **same MAC address**. But `192.168.1.10` means nothing here: the school's network is a different street.","title":"You take it to school.","zones":["school"]},{"dim":["hp"],"hot":["sp","sr"],"packets":[{"c":"amber","label":"address?","path":["sp","sr"]},{"at":1.3,"c":"green","label":"10.20.5.33","path":["sr","sp"]}],"set":{"sp":"IP 10.20.5.33"},"text":"The laptop asks the school network for an address and gets `10.20.5.33`. New street, new address.","title":"A new address for a new network."},{"hot":["hp","sp"],"text":"The **MAC address** is who the laptop *is*: it never changed. The **IP address** is where the laptop *is*: it changed when it moved.","title":"Name and address."}],"w":760,"zones":[{"always":true,"h":300,"id":"home","label":"home network","w":350,"x":15,"y":15},{"always":true,"c":"green","h":300,"id":"school","label":"school network","w":350,"x":395,"y":15}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> When a laptop moves to a new network it keeps its MAC address but gets a new IP address.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>IP addresses go the whole way, MAC addresses go one hop</h2>
  </header>
  <div class="lab-stage-body">
    <p>Here&rsquo;s why a host needs both. You load a web page from a server far away. The packet crosses your home router
and your internet provider&rsquo;s router. (Your <strong>ISP</strong>, <em>internet service provider</em>, is the company that brings the
internet to your home.) Each trip from one box to the next is called a <strong>hop</strong>. Step through and watch the
frame box: what changes at each hop, and what stays the same?</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A packet from a laptop to a web server crosses two routers. At every hop the MAC addresses in the frame change, but the source and destination IP addresses stay the same. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A packet from a laptop to a web server crosses two routers. At every hop the MAC addresses in the frame change, but the source and destination IP addresses stay the same"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":230,"links":[["pc","hr",{"label":"hop 1"}],["hr","isp",{"label":"hop 2"}],["isp","srv",{"label":"hop 3"}]],"narrow":{"at":{"hr":[270,75],"isp":[85,290],"pc":[85,75],"srv":[270,290]},"h":400,"w":360},"nodes":{"hr":{"kind":"wifi","label":"Home router","sub":"MAC H1 | H2","x":285,"y":110},"isp":{"kind":"router","label":"ISP router","sub":"MAC P1 | P2","x":480,"y":110},"pc":{"kind":"laptop","label":"Your laptop","sub":"192.168.1.10","sub2":"MAC AA","x":80,"y":110},"srv":{"kind":"server","label":"Web server","sub":"203.0.113.80","sub2":"MAC SS","x":680,"y":110}},"steps":[{"frame":{"layers":[{"fields":[["dst MAC","H1 (home router)",true],["src MAC","AA (laptop)",true]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.10"],["dst IP","203.0.113.80"]],"l":3,"name":"IP"}],"title":"The frame on **hop 1**"},"hot":["pc","hr"],"links":[["pc","hr"]],"packets":[{"c":"amber","end":"stay","label":"packet","path":["pc","hr"]}],"text":"The **IP** destination is the web server, far away. But the **MAC** destination is just the next stop: the home router.","title":"Hop 1: laptop to home router."},{"frame":{"layers":[{"fields":[["dst MAC","P1 (ISP router)",true],["src MAC","H2 (home router)",true]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.10"],["dst IP","203.0.113.80"]],"l":3,"name":"IP"}],"title":"The frame on **hop 2**"},"hot":["hr","isp"],"links":[["hr","isp"]],"packets":[{"c":"amber","end":"stay","label":"packet","path":["hr","isp"]}],"text":"The home router takes the old frame off, reads the IP address, and builds a **new frame** for the next hop. New MAC addresses. Same IP addresses. (Really, the home router also swaps the private source IP for the home's public one, with NAT. We'll keep it simple here.)","title":"Hop 2: home router to ISP router."},{"frame":{"layers":[{"fields":[["dst MAC","SS (web server)",true],["src MAC","P2 (ISP router)",true]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.10"],["dst IP","203.0.113.80"]],"l":3,"name":"IP"}],"title":"The frame on **hop 3**"},"hot":["isp","srv"],"links":[["isp","srv"]],"packets":[{"c":"green","label":"packet","path":["isp","srv"]}],"text":"And again: a new frame with new MAC addresses, to the server. The IP addresses have been the same the whole way.","title":"Hop 3: ISP router to the web server."},{"frame":null,"hot":["pc","srv"],"packets":[{"c":"green","label":"packet","path":["pc","hr","isp","srv"]}],"text":"**IP addresses**: the start and the end of the whole journey, never change. **MAC addresses**: just this hop, change at every router.","title":"The whole trip."}],"w":760}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<h3 id="see-the-bits">See the bits</h3>
<p>Type any IPv4 address in the box: try your own, or <code>10.0.0.1</code>, or <code>255.255.255.255</code>. Under each number you&rsquo;ll
see its 8 bits. The blue bits are the <strong>network part</strong> and the amber bits are the <strong>host part</strong>; leave the slider
on <strong>/24</strong> for now. Moving it is the next lesson.</p>
<figure class="ipw cidr" data-cidr>
  <div class="ipw-in">
    <label><span class="mono">IP address</span><input data-ip type="text" inputmode="decimal" autocomplete="off" spellcheck="false" value="192.168.1.10"></label>
    <label class="ipw-slide"><span class="mono">prefix <b data-prefix-out></b></span><input data-prefix type="range" min="8" max="32" value="24" aria-label="Prefix length"></label>
  </div>
  <p class="ipw-err" data-err hidden>That isn't an IPv4 address yet: four numbers from 0 to 255, with dots between, like <code>10.0.0.1</code>.</p>
  <div class="ipw-rows">
    <span class="ipw-rl mono">address</span><div class="ip-row" data-bits></div>
    <span class="ipw-rl mono">mask</span><div class="ip-row" data-maskbits></div>
  </div>
  <p class="ipw-legend mono"><i class="n"></i> network bits <i class="h"></i> host bits</p>
  <p class="ipw-say" data-say aria-live="polite"></p>
  <div class="ipw-out" data-out></div>
</figure>
<script src="/js/ipcalc.c693c6a3d6b5c9e6ba2ba07ebd4fc0bbd7d43044d1d2e6e9c8ebb8749a59ba83.js" integrity="sha256-xpPGo9a1yea6K6B&#43;vU/Au9fUMETR0ubpyOu4dJpZuoM=" defer></script>
<h3 id="try-it-on-your-own-computer-optional">Try it on your own computer (optional)</h3>
<ul>
<li><strong>Windows</strong>: in <em>Command Prompt</em>, <code>ipconfig</code>. Look for <strong>IPv4 Address</strong>.</li>
<li><strong>Mac</strong>: <em>System Settings → Wi-Fi → Details… → TCP/IP</em>, or in <em>Terminal</em>: <code>ipconfig getifaddr en0</code>.</li>
</ul>
<p>Is yours private? (Almost certainly: check the table at the top.) Then visit a <em>what&rsquo;s my IP</em> website: it shows
your home&rsquo;s <strong>public</strong> address, the one your router uses on the internet.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> IP addresses stay the same from start to finish; MAC addresses change at every router.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Valid, private or public?</h2>
  </header>
  <div class="lab-stage-body">
    <p>For each one: is it a <strong>valid</strong> IPv4 address? If it is, is it <strong>private</strong> or <strong>public</strong>?</p>
<ol>
<li><code>192.168.0.1</code></li>
<li><code>10.300.2.1</code></li>
<li><code>8.8.4.4</code></li>
<li><code>172.20.10.5</code></li>
<li><code>172.40.10.5</code></li>
<li><code>192.168.1</code></li>
<li><code>10.0.0.255</code></li>
</ol>
<p>And a bonus: what&rsquo;s <code>10101010</code> in ordinary numbers?</p>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Valid means four numbers, each from 0 to 255.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Private is anything starting <code>10.</code>, <code>192.168.</code>, or <code>172.</code> followed by a number from 16 to 31.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>For the bonus, write the bit values over it: 128 64 32 16 8 4 2 1. Add up the ones under a 1.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <table>
  <thead>
      <tr>
          <th>Address</th>
          <th>Valid?</th>
          <th>Private or public</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>192.168.0.1</code></td>
          <td>✅</td>
          <td>private (starts <code>192.168.</code>)</td>
      </tr>
      <tr>
          <td><code>10.300.2.1</code></td>
          <td>❌</td>
          <td>300 is bigger than 255</td>
      </tr>
      <tr>
          <td><code>8.8.4.4</code></td>
          <td>✅</td>
          <td>public</td>
      </tr>
      <tr>
          <td><code>172.20.10.5</code></td>
          <td>✅</td>
          <td>private (20 is between 16 and 31)</td>
      </tr>
      <tr>
          <td><code>172.40.10.5</code></td>
          <td>✅</td>
          <td>public (40 is outside 16 to 31)</td>
      </tr>
      <tr>
          <td><code>192.168.1</code></td>
          <td>❌</td>
          <td>only three numbers</td>
      </tr>
      <tr>
          <td><code>10.0.0.255</code></td>
          <td>✅</td>
          <td>private (starts <code>10.</code>)</td>
      </tr>
  </tbody>
</table>
<p>Bonus: <code>10101010</code> = 128 + 32 + 8 + 2 = <strong>170</strong>.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>What's a data center?</title><link>https://networkdoodles.com/lessons/networking-101/task-2-3/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-2-3/</guid><description> 1 explainWhere the internet lives Servers need a home When you watch a video or open a website, your message goes to a server: a computer whose job is to answer other computers. A video server sends videos; a web server sends web pages. Servers never sleep: someone, somewhere, always wants a video.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Where the internet lives</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="servers-need-a-home">Servers need a home</h3>
<p>When you watch a video or open a website, your message goes to a <strong>server</strong>: a computer whose job is to answer
other computers. A video server sends videos; a web server sends web pages. Servers never sleep: someone,
somewhere, always wants a video.</p>
<p>Think of a giant hotel, but for computers instead of people. Every room is full of servers, the lights never go
off, and there&rsquo;s staff on duty day and night. That&rsquo;s a <strong>data center</strong>: a building (or a big room in one) full
of servers, with everything they need to keep running all the time.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A data center is a building full of servers, kept running day and night.</p>
<h3 id="whats-inside">What&rsquo;s inside</h3>
<ul>
<li><strong>Racks</strong>: tall metal cupboards, about two metres high, with servers stacked inside like books on shelves.
Rack space is measured in <strong>U</strong> (one <em>unit</em>, 4.45 cm); a normal rack holds 42U.</li>
<li><strong>Power</strong>: lots of it, from two separate supplies, plus big batteries and diesel generators, so the servers
keep running even if the electricity goes off.</li>
<li><strong>Cooling</strong>: servers get hot, like a laptop on your knees, times thousands. Rows of racks face each other so
cold air goes in at the front and hot air comes out of the back, where it&rsquo;s pulled away.</li>
<li><strong>Security</strong>: guards, cameras, locked cages and ID cards. You can&rsquo;t just walk in.</li>
<li><strong>The network</strong>: switches and routers (from lesson 2.1) joining every server to every other server, and to
the internet.</li>
</ul>
<p class="lab-recap"><span class="mono">in one sentence</span> Inside: racks of servers, lots of power, lots of cooling, tight security, and a network joining it all.</p>
<h3 id="two-of-everything">Two of everything</h3>
<p>What happens if a car gets a flat tyre? You use the spare. Data centers have a spare for everything: two power
supplies, two cables, two switches, two internet connections. Having a spare ready like this is called
<strong>redundancy</strong>. If one thing breaks, the other takes over and nobody notices.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Redundancy means a spare for everything, so one broken part doesn&rsquo;t stop anything.</p>
<h3 id="leaf-and-spine">Leaf and spine</h3>
<p>Think of a school with long corridors of classrooms, and two main staircases. Every corridor joins <strong>both</strong>
staircases. To get from any classroom to any other, you walk along your corridor, up or down a staircase, and
along the other corridor: always the same short trip. And if one staircase is closed, you use the other.</p>
<p>Most data center networks are built just like that, and it&rsquo;s called <strong>leaf-spine</strong>:</p>
<ul>
<li>a <strong>leaf</strong> switch sits at the top of each rack, and that rack&rsquo;s servers plug into it (people also call it a
<strong>top-of-rack</strong> switch). The leaves are the corridors.</li>
<li>the <strong>spine</strong> switches sit in the middle. They&rsquo;re the staircases.</li>
<li><strong>Every leaf connects to every spine.</strong> So any server reaches any other by going leaf → spine → leaf.</li>
</ul>
<p class="lab-recap"><span class="mono">in one sentence</span> In leaf-spine, every leaf connects to every spine, so any two servers are always leaf → spine → leaf apart.</p>
<h3 id="the-door-and-the-guard">The door and the guard</h3>
<p>Where the internet comes into the building, there&rsquo;s a router (the post office from lesson 2.1) called the
<strong>edge router</strong>, because it sits at the edge. Next to it is a <strong>firewall</strong>: a security guard for messages. It
checks every message coming in and only lets through the kinds that are allowed, like <em>requests for a video</em>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The edge router brings the internet in, and the firewall checks every message at the door.</p>
<h3 id="north-south-and-east-west">North-south and east-west</h3>
<p>Draw the data center like a map, with the internet at the top:</p>
<ul>
<li>messages going <strong>in and out</strong>, between the internet and the servers, travel up and down the map. They&rsquo;re
called <strong>north-south</strong> traffic.</li>
<li>messages between servers <strong>inside</strong> the data center, like a web server asking a database (a server that
stores information, like a giant filing cabinet) for something, travel across the map. That&rsquo;s <strong>east-west</strong>
traffic.</li>
</ul>
<p>And <strong>the cloud</strong>? It&rsquo;s just someone else&rsquo;s data center. When a company <em>uses the cloud</em>, it rents servers in a
data center that a cloud company runs.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> North-south is traffic in and out of the data center; east-west is servers talking to each other inside it.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>Inside a small data center</h2>
  </header>
  <div class="lab-stage-body">
    <p>From the top: the internet comes in through an <strong>edge router</strong> and a <strong>firewall</strong> (a guard that only lets
allowed messages in). Below them are two <strong>spine</strong> switches, three <strong>leaf</strong> switches, and a rack under each
leaf: web servers, the servers that run the app (the program behind the website), and databases.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Internet → edge router → firewall → spines → leaves → racks of servers.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Follow a request into the data center</h2>
  </header>
  <div class="lab-stage-body">
    <p>You tap <em>play</em> on a video. Step through and watch which way each message goes.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A phone&#39;s request goes through the internet, an edge router and a firewall to a spine switch, a leaf switch and a web server. The web server fetches the video from a database in another rack, the video goes back, and when a spine switch breaks traffic uses the other spine. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A phone&#39;s request goes through the internet, an edge router and a firewall to a spine switch, a leaf switch and a web server. The web server fetches the video from a database in another rack, the video goes back, and when a spine switch breaks traffic uses the other spine"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":530,"links":[["ph","net",{"wifi":true}],["net","rtr"],["rtr","fw"],["fw","s1"],["fw","s2"],["s1","l1"],["s1","l2"],["s1","l3"],["s2","l1"],["s2","l2"],["s2","l3"],["l1","k1"],["l2","k2"],["l3","k3"]],"narrow":{"at":{"fw":[260,155],"k1":[55,465],"k2":[180,465],"k3":[305,465],"l1":[55,360],"l2":[180,360],"l3":[305,360],"net":[220,45],"ph":[60,50],"rtr":[100,155],"s1":[100,260],"s2":[260,260]},"h":560,"w":360,"zones":{"dc":[3,102,354,450]}},"nodes":{"fw":{"c":"red","kind":"firewall","label":"Firewall","x":470,"y":150},"k1":{"c":"green","kind":"rack","label":"Rack 1","sub":"web servers","x":130,"y":455},"k2":{"c":"green","kind":"rack","label":"Rack 2","sub":"app servers","x":380,"y":455},"k3":{"c":"green","kind":"rack","label":"Rack 3","sub":"databases","x":630,"y":455},"l1":{"kind":"switch","label":"Leaf 1","x":130,"y":355},"l2":{"kind":"switch","label":"Leaf 2","x":380,"y":355},"l3":{"kind":"switch","label":"Leaf 3","x":630,"y":355},"net":{"kind":"cloud","label":"The internet","x":380,"y":45},"ph":{"kind":"phone","label":"Your phone","x":110,"y":50},"rtr":{"kind":"router","label":"Edge router","x":290,"y":150},"s1":{"c":"violet","kind":"switch","label":"Spine 1","x":250,"y":255},"s2":{"c":"violet","kind":"switch","label":"Spine 2","x":510,"y":255}},"steps":[{"hot":["s1","s2","l1","l2","l3"],"text":"Everything inside the green box is one building. Notice there are **two** spines, and every leaf has a cable to **both** of them.","title":"A data center.","zones":["dc"]},{"hot":["ph","k1"],"links":[["ph","net"],["net","rtr"],["rtr","fw"],["fw","s1"],["s1","l1"],["l1","k1"]],"packets":[{"c":"amber","label":"play video","path":["ph","net","rtr","fw","s1","l1","k1"]}],"say":{"fw":"Allowed:\na video request"},"sayAt":{"fw":{"narrow":"below","wide":"right"}},"text":"Your phone's message crosses the internet, comes in through the edge router, gets checked by the firewall, and goes down a spine and a leaf to a **web server** in rack 1.","title":"North-south: your request comes in."},{"hot":["k1","k3"],"links":[["l1","s2"],["s2","l3"],["k1","l1"],["l3","k3"]],"packets":[{"c":"violet","label":"get video","path":["k1","l1","s2","l3","k3"]},{"at":4.3,"c":"green","label":"video file","path":["k3","l3","s2","l1","k1"]}],"text":"The web server doesn't keep the video itself. It asks a **database** in rack 3: leaf 1 → a spine → leaf 3. The database sends the video file back the same short way.","title":"East-west: servers talk to each other."},{"hot":["k1","ph"],"packets":[{"c":"green","label":"video","path":["k1","l1","s1","fw","rtr","net","ph"]},{"at":0.6,"c":"green","label":"video","path":["k1","l1","s1","fw","rtr","net","ph"]},{"at":1.2,"c":"green","label":"video","path":["k1","l1","s1","fw","rtr","net","ph"]}],"text":"The web server sends the video back up and out, in lots of packets, all the way to your phone.","title":"North-south: the video goes out."},{"cut":[["fw","s1"],["s1","l1"],["s1","l2"],["s1","l3"]],"down":["s1"],"say":{"s1":"Out of order"},"text":"A power supply fails and spine 1 goes dark. Its cables carry nothing. Is the video service down?","title":"Spine 1 breaks!"},{"cut":[["fw","s1"],["s1","l1"],["s1","l2"],["s1","l3"]],"down":["s1"],"hot":["s2","ph","k1"],"links":[["fw","s2"],["s2","l1"]],"packets":[{"c":"amber","label":"play video","path":["ph","net","rtr","fw","s2","l1","k1"]},{"at":6.3,"c":"green","label":"video","path":["k1","l1","s2","fw","rtr","net","ph"]}],"text":"Every leaf is also wired to spine 2, so traffic just goes that way instead. Your video keeps playing. That's **redundancy**: two of everything, so one broken box doesn't take the service down.","title":"No: everything goes through spine 2."}],"w":760,"zones":[{"always":true,"c":"green","h":420,"id":"dc","label":"the data center","w":720,"x":20,"y":100}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p>What to notice:</p>
<ul>
<li>Between any two racks, the trip is always <strong>leaf → spine → leaf</strong>. No server is far from any other.</li>
<li>The <strong>firewall</strong> sits where the internet comes in, so every north-south message gets checked.</li>
<li>When spine 1 broke, nothing else had to change. Engineers can fix it, or even unplug it for an upgrade,
while everything keeps running.</li>
</ul>
<h3 id="try-it-on-your-own-computer-optional">Try it on your own computer (optional)</h3>
<p>You can see the routers between you and a data center. This lists every router your message passes through
on its way to a website (it takes up to a minute):</p>
<ul>
<li><strong>Windows</strong>, in <em>Command Prompt</em>: <code>tracert networkdoodles.com</code></li>
<li><strong>Mac</strong>, in <em>Terminal</em>: <code>traceroute networkdoodles.com</code></li>
</ul>
<p>Each numbered line is one router, with how long the round trip took in milliseconds. The first is your home
router. The last few are usually inside, or at the door of, the data center that hosts the site. Lines with
<code>* * *</code> are routers that chose not to answer: that&rsquo;s normal.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Requests come in through the router and firewall, go leaf-spine-leaf between servers, and still get through when one spine breaks.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Plan the cables</h2>
  </header>
  <div class="lab-stage-body">
    <p>A data center is growing. It will have <strong>4 spine switches</strong> and <strong>10 leaf switches</strong>, wired leaf-spine.</p>
<ol>
<li>How many cables between the leaves and the spines?</li>
<li>A server in the rack under leaf 2 talks to a server under leaf 9. How many switches does each message go
through?</li>
<li>Two spines break at the same time. Can every leaf still reach every other leaf?</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Every leaf connects to every spine. So each leaf has one cable per spine.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Leaf to spine to leaf, whichever leaves they are.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <ol>
<li><strong>40 cables</strong>: each of the 10 leaves has one cable to each of the 4 spines, 10 × 4 = 40.</li>
<li><strong>Three switches</strong>: leaf 2, one spine, leaf 9. Always three, for any two leaves.</li>
<li><strong>Yes.</strong> Every leaf is still wired to the two spines that are left. The network has half as much room for
traffic until they&rsquo;re fixed, but nothing is cut off.</li>
</ol>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>Collision domains and broadcast domains</title><link>https://networkdoodles.com/lessons/networking-101/task-2-2/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-2-2/</guid><description>Collision domains and broadcast domains for beginners: draw them on any small network and see which box, a hub, a switch or a router, makes each boundary.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Who bumps into whom, and who hears the shouting</h2>
  </header>
  <div class="lab-stage-body">
    <p>In <a href="/lessons/networking-101/task-2-1/">lesson 2.1</a> you saw two things happen:</p>
<ol>
<li>On a <strong>hub</strong>, two PCs talking at the same time <strong>collided</strong>, and both messages were ruined.</li>
<li>A message to <strong>everyone</strong> went to every host, until it reached a <strong>router</strong>, which stopped it.</li>
</ol>
<p>This lesson gives each of those a name, so you can draw them on any network. First, one word: a <strong>domain</strong> is
the area something reaches, like a kingdom is the land a king rules.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A domain is the area something reaches; this lesson is about two of them.</p>
<h3 id="collisions-talking-at-the-same-time">Collisions: talking at the same time</h3>
<p>Think of a classroom with one rule: only one person can speak at a time. If two people start at once, nobody
understands either of them, so both stop, wait a moment and try again.</p>
<p>On a network, when two hosts send at the same moment on a shared line, their signals crash into each other.
That&rsquo;s a <strong>collision</strong>. A <strong>collision domain</strong> is the group of devices that can collide with each other: the
whole classroom.</p>
<ul>
<li>A <strong>hub</strong> shares one line between everything plugged into it, so the whole hub is <strong>one</strong> collision domain.</li>
<li>A <strong>switch</strong> gives each port its own private line, so <strong>every switch port is its own</strong> collision domain.
(Modern switch ports can even send and receive at the same moment, like a road with a lane each way. That&rsquo;s
called <strong>full duplex</strong>, and it means no collisions at all. The port is still where the boundary goes.)</li>
<li>A <strong>router</strong> port is a boundary too.</li>
</ul>
<p class="lab-recap"><span class="mono">in one sentence</span> A collision domain is everyone who has to take turns on one shared line: a whole hub, but just one port on a switch.</p>
<h3 id="broadcasts-an-announcement-to-everyone">Broadcasts: an announcement to everyone</h3>
<p>Think of the speakers in a school&rsquo;s corridors. An announcement reaches every classroom in the building, but
not the school down the road.</p>
<p>On a network, a message to <strong>everyone</strong> is called a <strong>broadcast</strong>. It has a special <em>to</em> address that means
<em>all of you</em>: the MAC address <code>FF:FF:FF:FF:FF:FF</code>. A <strong>broadcast domain</strong> is the group of hosts that all hear
each other&rsquo;s broadcasts: the whole school building.</p>
<ul>
<li>Hubs and switches pass broadcasts to everyone, so they <strong>don&rsquo;t</strong> split broadcast domains.</li>
<li>A <strong>router stops broadcasts</strong>, like the school gate. Every router port is the edge of a broadcast domain.</li>
</ul>
<p class="lab-recap"><span class="mono">in one sentence</span> A broadcast domain is everyone who hears a message sent to all; only a router stops it.</p>
<h3 id="the-whole-picture">The whole picture</h3>
<table>
  <thead>
      <tr>
          <th>Box</th>
          <th>Collision domains</th>
          <th>Broadcast domains</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Hub</td>
          <td>one for the whole hub</td>
          <td>doesn&rsquo;t split them</td>
      </tr>
      <tr>
          <td>Switch</td>
          <td>one <strong>per port</strong></td>
          <td>doesn&rsquo;t split them</td>
      </tr>
      <tr>
          <td>Router</td>
          <td>one per port</td>
          <td>one <strong>per port</strong></td>
      </tr>
  </tbody>
</table>
<p>Why care? Collisions slow a network down, because everyone waits. Broadcasts make <em>every</em> host stop and read
them, so a broadcast domain with thousands of hosts is like a school with announcements every few seconds.
Network engineers keep broadcast domains small on purpose.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Switches and routers split collision domains; only routers split broadcast domains.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>One network, both kinds of domain</h2>
  </header>
  <div class="lab-stage-body">
    <p>This network has a hub, two switches and a router. Step through: first the <strong>collision domains</strong> light up as
red boxes (CD is short for collision domain), then the <strong>broadcast domains</strong>, and the messages show why each
boundary is where it is.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A network with two PCs on a hub, the hub on a switch with two more PCs, the switch on a router, and the router on a second switch with two PCs. There are seven collision domains and two broadcast domains. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A network with two PCs on a hub, the hub on a switch with two more PCs, the switch on a router, and the router on a second switch with two PCs. There are seven collision domains and two broadcast domains"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":410,"links":[["p1","hub"],["p2","hub"],["hub","s1"],["s1","p3"],["s1","p4"],["s1","r"],["r","s2"],["s2","p5"],["s2","p6"]],"narrow":{"at":{"hub":[180,130],"p1":[60,60],"p2":[300,60],"p3":[60,255],"p4":[300,255],"p5":[60,580],"p6":[300,580],"r":[180,375],"s1":[180,255],"s2":[180,490]},"h":640,"w":360,"zones":{"bd1":[2,8,356,367],"bd2":[2,375,356,260],"cd1":[5,18,350,175],"cd2":[6,210,124,95],"cd3":[230,210,124,95],"cd4":[140,278,80,76],"cd5":[140,400,80,70],"cd6":[6,470,140,160],"cd7":[214,470,140,160]}},"nodes":{"hub":{"c":"amber","kind":"hub","label":"Hub","x":195,"y":205},"p1":{"kind":"pc","label":"PC 1","x":75,"y":105},"p2":{"kind":"pc","label":"PC 2","x":75,"y":300},"p3":{"kind":"pc","label":"PC 3","x":350,"y":70},"p4":{"kind":"pc","label":"PC 4","x":350,"y":330},"p5":{"kind":"pc","label":"PC 5","x":630,"y":70},"p6":{"kind":"pc","label":"PC 6","x":630,"y":330},"r":{"kind":"router","label":"Router","x":500,"y":205},"s1":{"kind":"switch","label":"Switch 1","x":350,"y":205},"s2":{"kind":"switch","label":"Switch 2","x":630,"y":205}},"steps":[{"hot":["hub","s1","r","s2"],"text":"Two PCs on a **hub**, the hub plugged into **switch 1** with two more PCs, then a **router**, then **switch 2** with two PCs. Where are the boundaries?","title":"The network."},{"packets":[{"c":"red","end":"collide","label":"hi","path":["p1","hub"]},{"c":"red","end":"collide","label":"yo","path":["p2","hub"]}],"say":{"hub":"CRASH!"},"text":"PC 1 and PC 2 both send at once, and their frames crash in the hub. Everything on the hub, including its cable to the switch, is **one collision domain**.","title":"Collision domain 1: the whole hub.","zones":["cd1"]},{"packets":[{"c":"green","label":"hi","path":["p3","s1","p4"]},{"c":"violet","label":"yo","path":["p4","s1","p3"]}],"text":"PC 3 and PC 4 send at the same moment. No crash: each has its own line to the switch. Every switch port is its own collision domain, including the one to the router.","title":"Collision domains 2, 3 and 4: one per switch port.","zones":["cd1","cd2","cd3","cd4"]},{"text":"Same on the other side: the router's port to switch 2, and each of switch 2's ports. Count them all: **7 collision domains**.","title":"Collision domains 5, 6 and 7.","zones":["cd1","cd2","cd3","cd4","cd5","cd6","cd7"]},{"packets":[{"c":"amber","end":"stay","label":"to ALL","path":["p1","hub"]},{"at":1,"c":"amber","label":"to ALL","path":["hub","p2"]},{"at":1,"c":"amber","end":"stay","label":"to ALL","path":["hub","s1"]},{"at":2,"c":"amber","label":"to ALL","path":["s1","p3"]},{"at":2,"c":"amber","label":"to ALL","path":["s1","p4"]},{"at":2,"c":"amber","end":"drop","label":"to ALL","path":["s1","r"]}],"say":{"r":"Stops here"},"text":"PC 1 shouts to everyone. The hub repeats it, switch 1 floods it, and every host on the left hears it. At the router, it stops.","title":"Broadcast domain 1.","zones":["bd1"]},{"packets":[{"c":"violet","end":"stay","label":"to ALL","path":["p5","s2"]},{"at":1,"c":"violet","label":"to ALL","path":["s2","p6"]},{"at":1,"c":"violet","end":"drop","label":"to ALL","path":["s2","r"]}],"say":{"r":"Stops here too"},"text":"PC 5 shouts. Switch 2 floods it to PC 6 and the router, and the router stops it. The left side never hears it.","title":"Broadcast domain 2.","zones":["bd2"]},{"text":"The **router** is the only thing that split the broadcast domains: one per router port. Hubs, switches and routers all mark collision boundaries, except the hub, which just makes one big one.","title":"7 collision domains, 2 broadcast domains.","zones":["bd1","bd2"]}],"w":760,"zones":[{"c":"red","h":350,"id":"cd1","label":"CD 1","w":262,"x":18,"y":38},{"c":"red","h":160,"id":"cd2","label":"CD 2","w":90,"x":305,"y":22},{"c":"red","h":165,"id":"cd3","label":"CD 3","w":90,"x":305,"y":228},{"c":"red","h":50,"id":"cd4","label":"CD 4","w":78,"x":392,"y":180},{"c":"red","h":50,"id":"cd5","label":"CD 5","w":72,"x":530,"y":180},{"c":"red","h":160,"id":"cd6","label":"CD 6","w":90,"x":585,"y":22},{"c":"red","h":165,"id":"cd7","label":"CD 7","w":90,"x":585,"y":228},{"c":"amber","h":394,"id":"bd1","label":"broadcast domain 1","w":490,"x":10,"y":8},{"c":"violet","h":394,"id":"bd2","label":"broadcast domain 2","w":250,"x":500,"y":8}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> This network has 7 collision domains (red boxes) and 2 broadcast domains, split by the router.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Count them with a rule</h2>
  </header>
  <div class="lab-stage-body">
    <p>You don&rsquo;t have to light things up to count domains. Two rules do it:</p>
<ol>
<li><strong>Collision domains</strong>: count every <strong>cable</strong>, but skip the cables plugged into a hub. Then add <strong>one for
each hub</strong>.</li>
<li><strong>Broadcast domains</strong>: count the <strong>router ports</strong> in use. With no router at all, the whole network is one
broadcast domain.</li>
</ol>
<p>Let&rsquo;s try it on the network above, together.</p>
<p><strong>Collision domains.</strong> The cables are: PC 1 to the hub, PC 2 to the hub, the hub to switch 1, switch 1 to
PC 3, switch 1 to PC 4, switch 1 to the router, the router to switch 2, switch 2 to PC 5 and switch 2 to PC 6.
That&rsquo;s 9.</p>
<ul>
<li>Skip the three cables plugged into the hub: 9 − 3 = <strong>6</strong>.</li>
<li>Add one for the hub: 6 + 1 = <strong>7 collision domains</strong>. ✓</li>
</ul>
<p><strong>Broadcast domains.</strong> The router uses 2 ports: <strong>2 broadcast domains</strong>. ✓</p>
<p>Now step back to step 4 and step 7 of the animation and check each one matches.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Count the cables (skipping hub cables) and add one per hub for collision domains; count router ports for broadcast domains.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Count the domains</h2>
  </header>
  <div class="lab-stage-body">
    <p>A router has three ports in use:</p>
<ul>
<li>port 1 goes to a <strong>switch</strong> with <strong>four PCs</strong>;</li>
<li>port 2 goes to a <strong>hub</strong> with <strong>three PCs</strong>;</li>
<li>port 3 goes straight to a <strong>server</strong>, no switch in between.</li>
</ul>
<p>How many <strong>collision domains</strong>, and how many <strong>broadcast domains</strong>?</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="Challenge: a router with a switch of four PCs on one port, a hub of three PCs on another, and a server on the third. Use the buttons, or the left and right arrow keys, to step through it." data-autoplay="false">
  <svg class="ns-svg" role="img" aria-label="Challenge: a router with a switch of four PCs on one port, a hub of three PCs on another, and a server on the third"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":400,"links":[["a","sw"],["b","sw"],["c","sw"],["d","sw"],["sw","r",{"b":"port 1","bf":0.2}],["r","hub",{"a":"port 2","af":0.2}],["r","srv",{"a":"port 3","af":0.32}],["hub","e"],["hub","f"],["hub","g"]],"narrow":{"at":{"a":[45,55],"b":[135,55],"c":[225,55],"d":[315,55],"e":[60,520],"f":[300,520],"g":[180,545],"hub":[180,420],"r":[180,290],"srv":[310,290],"sw":[180,170]},"h":600,"links":{"5":{"af":0.48}},"w":360},"nodes":{"a":{"kind":"pc","label":"PC","x":75,"y":55},"b":{"kind":"pc","label":"PC","x":75,"y":150},"c":{"kind":"pc","label":"PC","x":75,"y":245},"d":{"kind":"pc","label":"PC","x":75,"y":340},"e":{"kind":"pc","label":"PC","x":700,"y":90},"f":{"kind":"pc","label":"PC","x":700,"y":305},"g":{"kind":"pc","label":"PC","x":560,"y":330},"hub":{"kind":"hub","label":"Hub","x":560,"y":200},"r":{"c":"amber","kind":"router","label":"Router","x":390,"y":200},"srv":{"kind":"server","label":"Server","x":390,"y":60},"sw":{"kind":"switch","label":"Switch","x":230,"y":200}},"steps":[{"text":"Count the **collision domains** and the **broadcast domains**. Use the two rules above, then open the hints or the answer.","title":"Your turn."}],"w":760}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>List every cable first. There are 10.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Four of those cables are plugged into the hub (three PCs and the router). Skip them, then add one for the hub.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>For broadcast domains, count the router ports in use.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <p><strong>7 collision domains and 3 broadcast domains.</strong></p>
<ul>
<li>Cables: 4 from the PCs to the switch, the switch to the router, the router to the hub, 3 from the hub to its
PCs, and the router to the server. That&rsquo;s <strong>10</strong>.</li>
<li>Skip the 4 plugged into the hub: 10 − 4 = 6. Add one for the hub: <strong>7</strong>.</li>
<li>Router ports in use: <strong>3</strong>, so <strong>3 broadcast domains</strong>.</li>
</ul>
<figure class="netsim" data-netsim tabindex="0" aria-label="The answer: seven collision domains, then three broadcast domains. Use the buttons, or the left and right arrow keys, to step through it." data-autoplay="false">
  <svg class="ns-svg" role="img" aria-label="The answer: seven collision domains, then three broadcast domains"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":400,"links":[["a","sw"],["b","sw"],["c","sw"],["d","sw"],["sw","r"],["r","hub"],["r","srv"],["hub","e"],["hub","f"],["hub","g"]],"narrow":{"at":{"a":[45,55],"b":[135,55],"c":[225,55],"d":[315,55],"e":[60,520],"f":[300,520],"g":[180,545],"hub":[180,420],"r":[180,290],"srv":[310,290],"sw":[180,170]},"h":600,"w":360,"zones":{"b1":[2,8,356,260],"b2":[2,340,356,255],"b3":[258,240,100,104],"c1":[6,18,78,80],"c2":[96,18,78,80],"c3":[186,18,78,80],"c4":[276,18,78,80],"c5":[145,195,70,65],"c6":[5,345,350,245],"c7":[262,245,95,95]}},"nodes":{"a":{"kind":"pc","label":"PC","x":75,"y":55},"b":{"kind":"pc","label":"PC","x":75,"y":150},"c":{"kind":"pc","label":"PC","x":75,"y":245},"d":{"kind":"pc","label":"PC","x":75,"y":340},"e":{"kind":"pc","label":"PC","x":700,"y":90},"f":{"kind":"pc","label":"PC","x":700,"y":305},"g":{"kind":"pc","label":"PC","x":560,"y":330},"hub":{"kind":"hub","label":"Hub","x":560,"y":200},"r":{"c":"amber","kind":"router","label":"Router","x":390,"y":200},"srv":{"kind":"server","label":"Server","x":390,"y":60},"sw":{"kind":"switch","label":"Switch","x":230,"y":200}},"steps":[{"text":"Four for the PCs on the switch, one for the switch-to-router cable, one for the whole hub, one for the server's cable.","title":"Collision domains: 7.","zones":["c1","c2","c3","c4","c5","c6","c7"]},{"text":"One for each router port in use.","title":"Broadcast domains: 3.","zones":["b1","b2","b3"]}],"w":760,"zones":[{"c":"red","h":82,"id":"c1","label":"1","w":100,"x":25,"y":20},{"c":"red","h":82,"id":"c2","label":"2","w":100,"x":25,"y":115},{"c":"red","h":82,"id":"c3","label":"3","w":100,"x":25,"y":210},{"c":"red","h":82,"id":"c4","label":"4","w":100,"x":25,"y":305},{"c":"red","h":44,"id":"c5","label":"5","w":95,"x":265,"y":178},{"c":"red","h":350,"id":"c6","label":"6","w":325,"x":425,"y":40},{"c":"red","h":160,"id":"c7","label":"7","w":90,"x":345,"y":14},{"c":"amber","h":388,"id":"b1","label":"broadcast domain 1","w":350,"x":12,"y":8},{"c":"violet","h":366,"id":"b2","label":"broadcast domain 2","w":335,"x":420,"y":30},{"c":"green","h":168,"id":"b3","label":"BD 3","w":100,"x":340,"y":8}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>Hubs, switches and routers</title><link>https://networkdoodles.com/lessons/networking-101/task-2-1/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-2-1/</guid><description>Watch the same messages pass through a hub, a switch and a router: what each one reads (nothing, MAC addresses, IP addresses) and where it sends them.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Three ways to pass messages on</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="the-apartment-buildings-mail-room">The apartment building&rsquo;s mail room</h3>
<p>Two computers can share one cable. But plug in three, or thirty, and you need a box in the middle that
everyone&rsquo;s cable plugs into, to pass messages between them.</p>
<p>Think of a big apartment building, and three different ways the post could get from flat to flat:</p>
<ul>
<li><strong>The loudspeaker.</strong> Whoever has a letter reads it out over a loudspeaker in every flat. Everyone hears
everything, and only one person can use the loudspeaker at a time.</li>
<li><strong>The mail room clerk.</strong> A clerk who knows which flat everyone lives in takes each letter straight to the
right door.</li>
<li><strong>The post office.</strong> For a letter to <em>another town</em>, the clerk hands it to the post office, which knows the
way to every town.</li>
</ul>
<p>Those are the three boxes in this lesson: the <strong>hub</strong>, the <strong>switch</strong> and the <strong>router</strong>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A hub shouts everything to everyone, a switch delivers to the right door, and a router sends things to other networks.</p>
<h3 id="ports">Ports</h3>
<p>A <strong>port</strong> on one of these boxes is a socket where a cable plugs in, like the numbered mail slots in a mail room.
Ports are numbered: port 1, port 2, and so on. (This is a different thing from the <em>port numbers</em> in lesson 1.2:
same word, different meaning. Networking does that sometimes, sorry.)</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A port is a numbered socket on a box, where a cable plugs in.</p>
<h3 id="the-hub-the-loudspeaker">The hub: the loudspeaker</h3>
<p>A <strong>hub</strong> doesn&rsquo;t read anything. Whatever signal comes in on one port, it repeats straight out of every other
port. That makes it a <strong>layer 1</strong> box: it only deals with the signal itself.</p>
<p>Because everyone shares, only one host can talk at a time. If two talk at once, their signals crash into each
other and both are ruined. That&rsquo;s called a <strong>collision</strong>, and both have to try again.</p>
<p>Hubs are very old: you&rsquo;d only find one in a museum now. But they&rsquo;re the easiest way to see why switches were
invented.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A hub repeats every message to everyone, so only one host can talk at a time.</p>
<h3 id="the-switch-the-mail-room-clerk">The switch: the mail room clerk</h3>
<p>A <strong>switch</strong> reads the <strong>MAC address</strong> on every frame (remember from lesson 1.2: a <em>frame</em> is a message in its
layer 2 envelope, with a <em>to</em> and <em>from</em> MAC address on it). That makes it a <strong>layer 2</strong> box.</p>
<p>It keeps a list called the <strong>MAC address table</strong>: which MAC address lives on which port. Nobody types it in;
the switch fills it in by itself. Every frame says who it&rsquo;s <em>from</em>, so when one arrives, the switch notes <em>that
MAC address is on this port</em>.</p>
<p>Then it sends each frame <strong>only</strong> out of the port where the <em>to</em> address lives. Sending a message on like this
is called <strong>forwarding</strong> it. If the switch doesn&rsquo;t know where the <em>to</em> address is yet, it sends a copy out of
every port, just this once. That&rsquo;s called <strong>flooding</strong>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A switch learns which MAC address is on which port, and sends each frame only where it needs to go.</p>
<h3 id="the-router-the-post-office">The router: the post office</h3>
<p>A switch joins hosts on <strong>one</strong> network. To reach a host on a <strong>different</strong> network, like your home reaching a
website, you need a <strong>router</strong>.</p>
<p>A router reads a different address: the <strong>IP address</strong>. You&rsquo;ll learn all about IP addresses in
<a href="/lessons/networking-101/task-3-1/">lesson 3.1</a>; for now, think of it as a <em>postal address</em> with a town in it. The
first part of an IP address says which network (which town) a host is in. That makes the router a <strong>layer 3</strong>
box.</p>
<p>A router has a foot in each network it joins, and keeps a <strong>routing table</strong>: a list of networks and which way
to send messages for each one, like the post office knowing which van goes to which town.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A router joins different networks, and reads the IP address to pick the way to the right one.</p>
<p>To keep the pictures readable, the MAC addresses below are shortened to one letter: PC A&rsquo;s MAC is just <code>A</code>.
(A <strong>PC</strong>, <em>personal computer</em>, is any laptop or desktop computer.)</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>The hub: everyone hears everything</h2>
  </header>
  <div class="lab-stage-body">
    <p>Four PCs on a hub. Watch what happens when A sends a frame to C, and then when two PCs talk at once.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="Four PCs on a hub. A frame from A to C is repeated to every PC; B and D throw it away. Then B and D send at the same moment and their frames collide in the hub. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="Four PCs on a hub. A frame from A to C is repeated to every PC; B and D throw it away. Then B and D send at the same moment and their frames collide in the hub"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":340,"links":[["a","hub",{"b":"1"}],["b","hub",{"b":"2"}],["c","hub",{"b":"3"}],["d","hub",{"b":"4"}]],"narrow":{"at":{"a":[65,75],"b":[65,330],"c":[295,75],"d":[295,330],"hub":[180,205]},"h":420,"w":360},"nodes":{"a":{"kind":"pc","label":"PC A","sub":"MAC A","x":110,"y":75},"b":{"kind":"pc","label":"PC B","sub":"MAC B","x":110,"y":260},"c":{"kind":"pc","label":"PC C","sub":"MAC C","x":650,"y":75},"d":{"kind":"pc","label":"PC D","sub":"MAC D","x":650,"y":260},"hub":{"c":"amber","kind":"hub","label":"Hub","x":380,"y":170}},"steps":[{"hot":["hub"],"say":{"hub":"I repeat everything\nto everyone"},"sayAt":{"hub":{"narrow":"right"}},"text":"Four PCs, each on its own port. The hub doesn't read anything: it just repeats.","title":"A hub."},{"hot":["a"],"links":[["a","hub"]],"packets":[{"c":"amber","end":"stay","label":"to C","path":["a","hub"]}],"text":"The frame says **to: C, from: A**. It goes down A's cable into the hub.","title":"A sends a frame to C."},{"hot":["c"],"links":[["hub","b"],["hub","c"],["hub","d"]],"packets":[{"c":"amber","end":"drop","label":"to C","path":["hub","b"]},{"c":"amber","label":"to C","path":["hub","c"]},{"c":"amber","end":"drop","label":"to C","path":["hub","d"]}],"say":{"b":"Not for me","c":"For me!","d":"Not for me"},"text":"B, C and D all get a copy. B and D look at the **to** address, see it isn't theirs, and throw it away. Only C keeps it. Wasted work for B and D.","title":"The hub repeats it out of every other port."},{"hot":["b","d"],"links":[["b","hub"],["d","hub"]],"packets":[{"c":"red","end":"collide","label":"to A","path":["b","hub"]},{"c":"red","end":"collide","label":"to C","path":["d","hub"]}],"say":{"hub":"CRASH!"},"sayAt":{"hub":{"narrow":"right"}},"text":"In a hub, everyone shares one conversation. B and D both start sending at the same moment, and their signals crash into each other: a **collision**. Both frames are ruined.","title":"B and D talk at the same time."},{"hot":["b","a"],"packets":[{"c":"amber","end":"stay","label":"to A","path":["b","hub"]},{"at":1,"c":"amber","label":"to A","path":["hub","a"]},{"at":1,"c":"amber","end":"drop","label":"to A","path":["hub","c"]},{"at":1,"c":"amber","end":"drop","label":"to A","path":["hub","d"]}],"say":{"d":"My turn next..."},"text":"Both stop, each waits a different, random little time, and tries again. B goes first. Everyone has to wait while B talks, and the hub still copies B's frame to everyone.","title":"Wait, then try again."},{"hot":["d","c"],"packets":[{"c":"amber","end":"stay","label":"to C","path":["d","hub"]},{"at":1,"c":"amber","label":"to C","path":["hub","c"]},{"at":1,"c":"amber","end":"drop","label":"to C","path":["hub","a"]},{"at":1,"c":"amber","end":"drop","label":"to C","path":["hub","b"]}],"text":"Only when B has finished can D send. With a hub, **only one host can talk at a time**, and the more hosts you add, the more they wait and collide.","title":"Then D."}],"w":760}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> A hub sends every frame to everyone, and when two hosts talk at once their frames collide.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>The switch: it learns</h2>
  </header>
  <div class="lab-stage-body">
    <p>Same four PCs, but now with a switch. Watch the <strong>MAC address table</strong> under the picture fill in.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="Four PCs on a switch. The switch learns each PC&#39;s MAC address from the frames it sends, floods a frame for an unknown address, then sends frames only to the right port, and carries two conversations at once. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="Four PCs on a switch. The switch learns each PC&#39;s MAC address from the frames it sends, floods a frame for an unknown address, then sends frames only to the right port, and carries two conversations at once"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":340,"links":[["a","sw",{"b":"1"}],["b","sw",{"b":"2"}],["c","sw",{"b":"3"}],["d","sw",{"b":"4"}]],"narrow":{"at":{"a":[65,75],"b":[65,330],"c":[295,75],"d":[295,330],"sw":[180,205]},"h":420,"w":360},"nodes":{"a":{"kind":"pc","label":"PC A","sub":"MAC A","x":110,"y":75},"b":{"kind":"pc","label":"PC B","sub":"MAC B","x":110,"y":260},"c":{"kind":"pc","label":"PC C","sub":"MAC C","x":650,"y":75},"d":{"kind":"pc","label":"PC D","sub":"MAC D","x":650,"y":260},"sw":{"kind":"switch","label":"Switch","x":380,"y":170}},"steps":[{"hot":["sw"],"table":{"cols":["port","MAC"],"empty":"empty","rows":[],"title":"Switch's MAC address table"},"text":"Its MAC address table is empty: it doesn't know who's where yet.","title":"A switch, just switched on."},{"hot":["a","sw"],"packets":[{"c":"amber","end":"stay","label":"to C","path":["a","sw"]},{"at":1,"c":"amber","end":"drop","label":"to C","path":["sw","b"]},{"at":1,"c":"amber","label":"to C","path":["sw","c"]},{"at":1,"c":"amber","end":"drop","label":"to C","path":["sw","d"]}],"table":{"cols":["port","MAC"],"hl":0,"rows":[["1","A"]],"title":"Switch's MAC address table"},"text":"The frame comes in on port 1 **from A**, so the switch writes down *A is on port 1*. It doesn't know where C is yet, so this once it **floods** the frame out of every other port, like a hub.","title":"A sends to C. Learn, then flood."},{"hot":["c","a"],"links":[["c","sw"],["sw","a"]],"packets":[{"c":"green","label":"to A","path":["c","sw","a"]}],"table":{"cols":["port","MAC"],"hl":1,"rows":[["1","A"],["3","C"]],"title":"Switch's MAC address table"},"text":"The answer comes in on port 3 **from C**: the switch writes *C is on port 3*. It's **to A**, and the switch knows A is on port 1, so it sends it **only** there. B and D don't see a thing.","title":"C answers A."},{"hot":["a","c"],"links":[["a","sw"],["sw","c"]],"packets":[{"c":"green","label":"to C","path":["a","sw","c"]}],"text":"Now the switch knows both. Straight from port 1 to port 3, nobody else bothered.","title":"A sends to C again."},{"hot":["b","a","d","c"],"packets":[{"c":"green","label":"to A","path":["b","sw","a"]},{"c":"violet","label":"to C","path":["d","sw","c"]}],"table":{"cols":["port","MAC"],"hl":[1,3],"rows":[["1","A"],["2","B"],["3","C"],["4","D"]],"title":"Switch's MAC address table"},"text":"B sends to A while D sends to C, at the same moment. No collision! Every port has its own private line to the switch. The switch learns B and D on the way.","title":"Two conversations at once."},{"hot":["a"],"packets":[{"c":"amber","end":"stay","label":"to ALL","path":["a","sw"]},{"at":1,"c":"amber","label":"to ALL","path":["sw","b"]},{"at":1,"c":"amber","label":"to ALL","path":["sw","c"]},{"at":1,"c":"amber","label":"to ALL","path":["sw","d"]}],"text":"If A sends to **everyone** (the broadcast address `FF:FF:FF:FF:FF:FF`), the switch floods it out of every port, on purpose. Remember that for the next lesson.","title":"But a broadcast still goes everywhere."}],"w":760}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p>What to notice:</p>
<ul>
<li>The switch learns from the <strong>source</strong> MAC and decides from the <strong>destination</strong> MAC.</li>
<li>An unknown destination gets <strong>flooded</strong> once. After the host answers, never again.</li>
<li>Lots of conversations can happen at once, and they never collide.</li>
</ul>
<h3 id="the-router-joining-two-networks">The router: joining two networks</h3>
<p>Switches are for hosts on <strong>the same</strong> network. To reach a host on a <strong>different</strong> network you need a router.
Here are two networks, each with its own switch, and a router joining them. The router has an IP address on
each side.</p>
<p>One new word: every host knows the router as its <strong>default gateway</strong>. A gateway is a way out, like the front
door of a building: <em>anything that isn&rsquo;t for someone on my network, send it to the gateway</em>.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="Two networks, 192.168.1.0/24 and 192.168.2.0/24, joined by a router. A packet from PC A to PC C goes to the router, which reads the IP address, picks the other side and builds a new frame. A broadcast stops at the router. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="Two networks, 192.168.1.0/24 and 192.168.2.0/24, joined by a router. A packet from PC A to PC C goes to the router, which reads the IP address, picks the other side and builds a new frame. A broadcast stops at the router"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":380,"links":[["a","s1"],["b","s1"],["s1","r"],["r","s2"],["s2","c"],["s2","d"]],"narrow":{"at":{"a":[80,70],"b":[280,70],"c":[80,555],"d":[280,555],"r":[180,320],"s1":[180,185],"s2":[180,455]},"h":640,"w":360,"zones":{"n1":[5,12,350,222],"n2":[5,405,350,225]}},"nodes":{"a":{"kind":"pc","label":"PC A","sub":"192.168.1.10","x":90,"y":95},"b":{"kind":"pc","label":"PC B","sub":"192.168.1.11","x":90,"y":285},"c":{"kind":"pc","label":"PC C","sub":"192.168.2.20","x":670,"y":95},"d":{"kind":"pc","label":"PC D","sub":"192.168.2.21","x":670,"y":285},"r":{"c":"amber","kind":"router","label":"Router","x":380,"y":190},"s1":{"kind":"switch","label":"Switch 1","x":245,"y":190},"s2":{"kind":"switch","label":"Switch 2","x":515,"y":190}},"steps":[{"hot":["r"],"table":{"cols":["network","send it out of"],"rows":[["192.168.1.0/24","left side"],["192.168.2.0/24","right side"]],"title":"Router's routing table"},"text":"On the left, every address starts `192.168.1.`; on the right, `192.168.2.`. The router has a foot in each: it's `192.168.1.1` on the left and `192.168.2.1` on the right. Every PC knows the router as its **default gateway**: *where to send anything that isn't on my network*.","title":"Two networks.","zones":["n1","n2"]},{"frame":{"layers":[{"fields":[["dst MAC","router left (R1)",true],["src MAC","A",true]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.10"],["dst IP","192.168.2.20",true]],"l":3,"name":"IP"}],"title":"The frame on the **left** network"},"hot":["a"],"links":[["a","s1"],["s1","r"]],"packets":[{"c":"amber","end":"stay","label":"to C","path":["a","s1","r"]}],"say":{"a":"Not my network.\nTo the gateway!"},"text":"C is `192.168.2.20`: not on A's network. So A sends the packet to its **gateway**. Look at the frame: the **IP** destination is C, but the **MAC** destination is the router's left side.","title":"A wants to send to C."},{"hot":["r"],"say":{"r":"192.168.2.20?\nOut my right side"},"table":{"cols":["network","send it out of"],"hl":1,"rows":[["192.168.1.0/24","left side"],["192.168.2.0/24","right side"]],"title":"Router's routing table"},"text":"It takes off the layer 2 frame and reads the **destination IP**: `192.168.2.20`. Its routing table says `192.168.2.0/24` is out of the right side.","title":"The router reads layer 3."},{"frame":{"layers":[{"fields":[["dst MAC","C",true],["src MAC","router right (R2)",true]],"l":2,"name":"Ethernet"},{"fields":[["src IP","192.168.1.10"],["dst IP","192.168.2.20"]],"l":3,"name":"IP"}],"title":"The frame on the **right** network"},"hot":["r","c"],"links":[["r","s2"],["s2","c"]],"packets":[{"c":"green","label":"to C","path":["r","s2","c"]}],"text":"The router wraps the packet in a **new** frame: from its right side's MAC, to C's MAC. The **IP addresses don't change** the whole way. The MAC addresses change at every router.","title":"A brand-new frame for the next network."},{"frame":null,"hot":["a"],"packets":[{"c":"amber","end":"stay","label":"to ALL","path":["a","s1"]},{"at":1,"c":"amber","label":"to ALL","path":["s1","b"]},{"at":1,"c":"amber","end":"drop","label":"to ALL","path":["s1","r"]}],"say":{"r":"Broadcast?\nIt stops here."},"text":"A shouts to everyone. Switch 1 floods it to B and to the router, but the router **doesn't pass broadcasts on**. The right-hand network never hears it. That's the subject of the next lesson.","title":"A broadcast stops at the router.","zones":["n1"]}],"w":760,"zones":[{"always":true,"h":350,"id":"n1","label":"network 192.168.1.0/24","w":300,"x":15,"y":15},{"always":true,"c":"green","h":350,"id":"n2","label":"network 192.168.2.0/24","w":300,"x":445,"y":15}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p>The big idea: <strong>MAC addresses get you to the next box; IP addresses get you all the way there.</strong> A switch
reads the MAC. A router reads the IP, and writes a new frame for the next network.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A switch learns where everyone is and delivers on the same network; a router reads the IP address and passes messages to a different network.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Be the switch</h2>
  </header>
  <div class="lab-stage-body">
    <p>A switch has five ports. Its MAC address table looks like this:</p>
<table>
  <thead>
      <tr>
          <th>port</th>
          <th>MAC</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>1</td>
          <td>A</td>
      </tr>
      <tr>
          <td>2</td>
          <td>B</td>
      </tr>
  </tbody>
</table>
<p>PC C is on port 3, PC D on port 4 and PC E on port 5, but they haven&rsquo;t sent anything yet. These frames
arrive, in this order. For each one, which ports does the switch send it out of, and what does it add to its
table?</p>
<ol>
<li>From <strong>C</strong> to <strong>A</strong></li>
<li>From <strong>A</strong> to <strong>D</strong></li>
<li>From <strong>D</strong> to <strong>A</strong></li>
<li>From <strong>E</strong> to <strong>everyone</strong> (<code>FF:FF:FF:FF:FF:FF</code>)</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Do two things for every frame, in this order: <strong>learn</strong> (write down the source MAC and the port it came in on),
then <strong>forward</strong> (look up the destination).</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>If the destination is in the table, send it to that one port. If it isn&rsquo;t, or it&rsquo;s a broadcast, flood it out of
every port except the one it came in on.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <table>
  <thead>
      <tr>
          <th>Frame</th>
          <th>Learns</th>
          <th>Sends it out of</th>
          <th>Why</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>C → A</td>
          <td>C is on port 3</td>
          <td>port 1</td>
          <td>A is in the table</td>
      </tr>
      <tr>
          <td>A → D</td>
          <td>(already knows A)</td>
          <td>ports 2, 3, 4, 5</td>
          <td>D isn&rsquo;t in the table yet: flood</td>
      </tr>
      <tr>
          <td>D → A</td>
          <td>D is on port 4</td>
          <td>port 1</td>
          <td>A is in the table</td>
      </tr>
      <tr>
          <td>E → everyone</td>
          <td>E is on port 5</td>
          <td>ports 1, 2, 3, 4</td>
          <td>broadcasts always flood</td>
      </tr>
  </tbody>
</table>
<p>The table at the end:</p>
<table>
  <thead>
      <tr>
          <th>port</th>
          <th>MAC</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>1</td>
          <td>A</td>
      </tr>
      <tr>
          <td>2</td>
          <td>B</td>
      </tr>
      <tr>
          <td>3</td>
          <td>C</td>
      </tr>
      <tr>
          <td>4</td>
          <td>D</td>
      </tr>
      <tr>
          <td>5</td>
          <td>E</td>
      </tr>
  </tbody>
</table>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>The OSI model: seven layers</title><link>https://networkdoodles.com/lessons/networking-101/task-1-2/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-1-2/</guid><description> 1 explainLots of jobs, one at a time Sending a birthday present Think about posting a birthday present to a friend in another town. Lots of people help, and each does one job:
You choose the present and write the card. You wrap it, so nobody can peek. You write part 1 of 2 on the box, because there’s a second parcel coming. You write for Sam and ask for recorded delivery, so you’ll know it arrived. You write the full street address: town, street, house number. The post office puts a label on it for the local van: next stop, the sorting office. The van drives it down the road. Nobody needs to know how the others do their job. The van driver doesn’t care what the present is; you don’t care which road the van takes.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Lots of jobs, one at a time</h2>
  </header>
  <div class="lab-stage-body">
    <h3 id="sending-a-birthday-present">Sending a birthday present</h3>
<p>Think about posting a birthday present to a friend in another town. Lots of people help, and each does <strong>one
job</strong>:</p>
<ol>
<li>You choose the present and write the card.</li>
<li>You wrap it, so nobody can peek.</li>
<li>You write <em>part 1 of 2</em> on the box, because there&rsquo;s a second parcel coming.</li>
<li>You write <em>for Sam</em> and ask for <em>recorded delivery</em>, so you&rsquo;ll know it arrived.</li>
<li>You write the full street address: town, street, house number.</li>
<li>The post office puts a label on it for the local van: <em>next stop, the sorting office</em>.</li>
<li>The van drives it down the road.</li>
</ol>
<p>Nobody needs to know how the others do their job. The van driver doesn&rsquo;t care what the present is; you don&rsquo;t
care which road the van takes.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Sending something is lots of small jobs, and each helper only does their own.</p>
<h3 id="layers">Layers</h3>
<p>Networks work the same way. Sending one message takes lots of jobs, so they&rsquo;re split into <strong>layers</strong>. A layer is
one job in a stack of jobs, like one floor of a building. Each layer only talks to the floor just above it and
the floor just below it.</p>
<p>The most famous way of splitting the jobs is called the <strong>OSI model</strong>. A <strong>model</strong> is a simple picture of how
something works, the way a map is a simple picture of a town. <em>OSI</em> stands for <em>Open Systems Interconnection</em>,
which means <em>a shared plan so computers made by different companies can connect</em>. It has <strong>seven layers</strong>, and
network engineers use the numbers all the time: &ldquo;it&rsquo;s a layer 1 problem&rdquo; means <em>check the cable</em>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The OSI model splits networking into seven layers, each with one job.</p>
<h3 id="the-seven-layers">The seven layers</h3>
<p>Here they are, matched to the birthday present. Some words in the last column are new; each one gets its own
lesson later, so just notice where it sits for now.</p>
<table>
  <thead>
      <tr>
          <th>#</th>
          <th>Layer</th>
          <th>Its job, in plain words</th>
          <th>The birthday present</th>
          <th>Examples you&rsquo;ll meet later</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>7</td>
          <td><strong>Application</strong></td>
          <td>what the program wants to say</td>
          <td>the present and the card</td>
          <td>web pages, games, DHCP (lesson 4.1)</td>
      </tr>
      <tr>
          <td>6</td>
          <td><strong>Presentation</strong></td>
          <td>get it in the right format, and scramble it so only the right person can read it</td>
          <td>the wrapping paper</td>
          <td>the padlock in your web browser</td>
      </tr>
      <tr>
          <td>5</td>
          <td><strong>Session</strong></td>
          <td>keep track of a conversation that&rsquo;s going on</td>
          <td><em>part 1 of 2</em></td>
          <td>staying logged in to a website</td>
      </tr>
      <tr>
          <td>4</td>
          <td><strong>Transport</strong></td>
          <td>which program it&rsquo;s for, and make sure nothing&rsquo;s lost</td>
          <td><em>for Sam</em>, recorded delivery</td>
          <td><strong>port numbers</strong></td>
      </tr>
      <tr>
          <td>3</td>
          <td><strong>Network</strong></td>
          <td>the address anywhere in the world, and the way to get there</td>
          <td>the full street address</td>
          <td><strong>IP addresses</strong> (lesson 3.1), routers</td>
      </tr>
      <tr>
          <td>2</td>
          <td><strong>Data link</strong></td>
          <td>get it to the next stop on <em>this</em> network</td>
          <td>the label for the local van</td>
          <td><strong>MAC addresses</strong> (lesson 1.1), switches</td>
      </tr>
      <tr>
          <td>1</td>
          <td><strong>Physical</strong></td>
          <td>the actual signal</td>
          <td>the road and the van&rsquo;s wheels</td>
          <td>cables, Wi-Fi radio waves</td>
      </tr>
  </tbody>
</table>
<p>A <strong>port number</strong> is a number that says which program on a computer a message is for, like the name of the
person in a house who should open the parcel. <a href="/lessons/networking-101/task-5-1/">Lesson 5.1</a> covers ports,
and the common numbers, in full.</p>
<p>Remember the layers from the bottom up with <strong>P</strong>lease <strong>D</strong>o <strong>N</strong>ot <strong>T</strong>hrow <strong>S</strong>ausage <strong>P</strong>izza <strong>A</strong>way:
Physical, Data link, Network, Transport, Session, Presentation, Application.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> From the bottom: Physical, Data link, Network, Transport, Session, Presentation, Application.</p>
<h3 id="wrapping-and-unwrapping">Wrapping and unwrapping</h3>
<p>On the way <em>out</em> of a computer, a message starts at the top, layer 7, and goes <em>down</em>. Each layer sticks a
small label on the front, called a <strong>header</strong>, with the information that layer needs, like the address label on
a parcel. Putting a message inside another layer&rsquo;s wrapping like this is called <strong>encapsulation</strong> (it means
<em>putting into a capsule</em>).</p>
<p>At the bottom, layer 1 sends it as <strong>bits</strong>. A <strong>bit</strong> is the smallest piece of computer data there is: a 1 or a
0, like a light switch that&rsquo;s on or off. Down a cable, bits are pulses of electricity.</p>
<p>On the way <em>in</em> to the other computer, it goes <em>up</em> the layers, and each layer reads its own label and takes it
off, until layer 7 has the original message.</p>
<p>The message has a different name depending on where it is: <strong>segment</strong> at layer 4, <strong>packet</strong> at layer 3,
<strong>frame</strong> at layer 2 (a frame is a packet in its local-delivery envelope), and <strong>bits</strong> at layer 1. They&rsquo;re all
the same message, just wrapped differently.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Going down, every layer adds a label; going up the other side, every layer takes its label off.</p>
<h3 id="one-honest-note">One honest note</h3>
<p>The internet doesn&rsquo;t really use all seven layers separately. It uses a simpler plan called <strong>TCP/IP</strong> (named
after two of its rules: <em>Transmission Control Protocol</em> and <em>Internet Protocol</em>; a <strong>protocol</strong> is just an
agreed set of rules, like everyone agreeing to write the address on the front of an envelope). TCP/IP squashes
layers 5, 6 and 7 into one. People still use the OSI <em>numbers</em> when they talk, so learn them; just don&rsquo;t be
surprised when, in the DHCP lesson, layer 7 comes straight after layer 4.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> The real internet squashes layers 5 to 7 together, but everyone still talks in OSI layer numbers.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>The two stacks</h2>
  </header>
  <div class="lab-stage-body">
    <p>Every host has all seven layers. Here&rsquo;s your laptop on the left and a <strong>web server</strong> on the right (a <strong>server</strong>
is a computer whose job is to answer other computers; a web server sends out web pages), with a cable between
their layer 1s. Messages can only cross over at the bottom: everything has to go down one side and up
the other.</p>
<p>The colours stay the same through the whole course: <strong>layer 1</strong> grey, <strong>layer 2</strong> blue, <strong>layer 3</strong>
amber, <strong>layer 4</strong> green, <strong>layers 5 to 7</strong> purple. You&rsquo;ll see them in every <em>inside the frame</em> box.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Both computers have the same seven layers, and messages can only cross between them at layer 1.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Watch a message go down, across and up</h2>
  </header>
  <div class="lab-stage-body">
    <p>You click a link to a page of cat pictures. Step through and watch the box under the picture: each layer adds
its header on the way down (highlighted), and takes it off on the way up.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A web request travels down the seven OSI layers of a laptop, gaining a header at each layer, crosses the cable as bits, and goes up the seven layers of a web server, losing a header at each. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A web request travels down the seven OSI layers of a laptop, gaining a header at each layer, crosses the cable as bits, and goes up the seven layers of a web server, losing a header at each"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":420,"links":[["l1","r1",{"label":"cable"}]],"narrow":{"at":{"l1":[90,384,160],"l2":[90,332,160],"l3":[90,280,160],"l4":[90,228,160],"l5":[90,176,160],"l6":[90,124,160],"l7":[90,72,160],"r1":[270,384,160],"r2":[270,332,160],"r3":[270,280,160],"r4":[270,228,160],"r5":[270,176,160],"r6":[270,124,160],"r7":[270,72,160]},"h":420,"links":{"0":{"label":""}},"w":360,"zones":{"left":[4,22,172,385],"right":[184,22,172,385]}},"nodes":{"l1":{"kind":"layer","label":"1 Physical","sub":"bits","subNarrow":"","w":220,"x":150,"y":384},"l2":{"kind":"layer","label":"2 Data link","sub":"MAC","subNarrow":"","w":220,"x":150,"y":332},"l3":{"c":"amber","kind":"layer","label":"3 Network","sub":"IP","subNarrow":"","w":220,"x":150,"y":280},"l4":{"c":"green","kind":"layer","label":"4 Transport","sub":"ports","subNarrow":"","w":220,"x":150,"y":228},"l5":{"c":"violet","kind":"layer","label":"5 Session","sub":"conversation","subNarrow":"","w":220,"x":150,"y":176},"l6":{"c":"violet","kind":"layer","label":"6 Presentation","sub":"encrypt","subNarrow":"","w":220,"x":150,"y":124},"l7":{"c":"violet","kind":"layer","label":"7 Application","sub":"web, DHCP","subNarrow":"","w":220,"x":150,"y":72},"r1":{"kind":"layer","label":"1 Physical","sub":"bits","subNarrow":"","w":220,"x":610,"y":384},"r2":{"kind":"layer","label":"2 Data link","sub":"MAC","subNarrow":"","w":220,"x":610,"y":332},"r3":{"c":"amber","kind":"layer","label":"3 Network","sub":"IP","subNarrow":"","w":220,"x":610,"y":280},"r4":{"c":"green","kind":"layer","label":"4 Transport","sub":"ports","subNarrow":"","w":220,"x":610,"y":228},"r5":{"c":"violet","kind":"layer","label":"5 Session","sub":"conversation","subNarrow":"","w":220,"x":610,"y":176},"r6":{"c":"violet","kind":"layer","label":"6 Presentation","sub":"decrypt","subNarrow":"","w":220,"x":610,"y":124},"r7":{"c":"violet","kind":"layer","label":"7 Application","sub":"web","subNarrow":"","w":220,"x":610,"y":72}},"steps":[{"frame":{"layers":[{"fields":[["request","GET /cats",true]],"l":7,"name":"application"}],"title":"The message so far"},"hot":["l7"],"packets":[{"c":"violet","end":"stay","label":"GET /cats","path":["l7"]}],"text":"You click a link. The web browser writes the message: *please send me the page `/cats`*. That's the **data**.","title":"Layer 7, application."},{"frame":{"layers":[{"fields":[["encrypted","x8#f!2q9...",true]],"l":6,"name":"presentation"},{"fields":[["request","GET /cats (hidden inside)"]],"l":7,"name":"application"}],"title":"The message so far"},"hot":["l6"],"packets":[{"c":"violet","end":"stay","label":"x8#f!2","path":["l7","l6"]}],"text":"The message gets **encrypted**: scrambled so only the web server can read it. That's what the padlock in your browser means.","title":"Layer 6, presentation."},{"hot":["l5"],"packets":[{"c":"violet","end":"stay","label":"x8#f!2","path":["l6","l5"]}],"text":"This belongs to a conversation that's already going: you're on the same website as a minute ago. Layer 5 keeps track of that.","title":"Layer 5, session."},{"frame":{"layers":[{"fields":[["src port","51000"],["dst port","443 (secure web)",true],["piece number","1"]],"l":4,"name":"TCP header"},{"fields":[["encrypted","x8#f!2q9..."]],"l":7,"name":"data"}],"title":"The **segment**"},"hot":["l4"],"packets":[{"c":"green","end":"stay","label":"TCP|data","path":["l5","l4"]}],"text":"Layer 4 adds the first real header: **port numbers**. Port **443** means *the secure web server program*. It also numbers the pieces so none get lost. Now it's called a **segment**.","title":"Layer 4, transport: a segment."},{"frame":{"layers":[{"fields":[["src IP","192.168.1.10",true],["dst IP","203.0.113.80",true]],"l":3,"name":"IP header"},{"fields":[["src port","51000"],["dst port","443"]],"l":4,"name":"TCP header"},{"fields":[["encrypted","x8#f!2q9..."]],"l":7,"name":"data"}],"title":"The **packet**"},"hot":["l3"],"packets":[{"c":"amber","end":"stay","label":"IP|TCP|data","path":["l4","l3"]}],"text":"Layer 3 adds the **IP addresses**: from the laptop, to the web server, anywhere in the world. Now it's a **packet**.","title":"Layer 3, network: a packet."},{"frame":{"layers":[{"fields":[["dst MAC","CC:CC:CC:33:33:33",true],["src MAC","AA:AA:AA:11:11:11",true]],"l":2,"name":"Ethernet header"},{"fields":[["src IP","192.168.1.10"],["dst IP","203.0.113.80"]],"l":3,"name":"IP header"},{"fields":[["src port","51000"],["dst port","443"]],"l":4,"name":"TCP header"},{"fields":[["encrypted","x8#f!2q9..."]],"l":7,"name":"data"},{"fields":[["check number","0x6B1F04A2",true]],"l":2,"name":"Ethernet trailer"}],"title":"The **frame**"},"hot":["l2"],"packets":[{"c":"cyan","end":"stay","label":"frame","path":["l3","l2"]}],"text":"Layer 2 adds **MAC addresses**: who's the next stop on *this* network. It also adds a check number on the end, so the next box can tell if anything got damaged. Now it's a **frame**.","title":"Layer 2, data link: a frame."},{"frame":{"layers":[{"fields":[["signal","01101001 11001100 00110101 ...",true]],"l":1,"name":"bits"}],"title":"What's on the wire"},"hot":["l1"],"packets":[{"c":"cyan","end":"stay","label":"0110 1001","path":["l2","l1"]}],"text":"Layer 1 doesn't care what any of it means. It turns the whole frame into **bits**, ones and zeros, as electrical pulses on the copper (or radio waves for Wi-Fi, or flashes of light in fibre).","title":"Layer 1, physical: bits."},{"hot":["l1","r1"],"links":[["l1","r1"]],"packets":[{"c":"cyan","end":"stay","label":"0110 1001","path":["l1","r1"]}],"text":"This is the only place the message actually leaves the laptop. Everything above layer 1 was just the laptop getting it ready.","title":"Across the cable."},{"frame":{"layers":[{"fields":[["src port","51000"],["dst port","443",true]],"l":4,"name":"TCP header"},{"fields":[["encrypted","x8#f!2q9..."]],"l":7,"name":"data"}],"title":"Left after layers 2 and 3"},"hot":["r2","r3"],"packets":[{"c":"amber","end":"stay","label":"IP|TCP|data","path":["r1","r2","r3"]}],"text":"Now it all happens backwards. Layer 1 turns the signal back into bits. Layer 2 checks the **MAC** is its own and the check number matches, and takes its header off. Layer 3 checks the **IP** is its own, and takes its header off.","title":"Up the server's stack: layers 1, 2, 3."},{"frame":{"layers":[{"fields":[["request","GET /cats",true]],"l":7,"name":"application"}],"title":"What the web server reads"},"hot":["r4","r6","r7"],"packets":[{"c":"violet","end":"stay","label":"GET /cats","path":["r3","r4","r5","r6","r7"]}],"text":"Layer 4 sees port **443** and hands the data to the web server program. Layer 6 decrypts it. Layer 7, the web server, finally reads it: *GET /cats*.","title":"Layers 4 to 7."},{"frame":null,"hot":["l7","r7"],"packets":[{"c":"green","label":"cats!","path":["r7","r6","r5","r4","r3","r2","r1","l1","l2","l3","l4","l5","l6","l7"]}],"text":"The cat pictures go down the server's layers (wrapped up), across the cable, and up the laptop's layers (unwrapped). Every message on every network does this.","title":"And the answer comes back the same way."}],"w":760,"zones":[{"always":true,"h":385,"id":"left","label":"your laptop","w":250,"x":25,"y":22},{"always":true,"c":"green","h":385,"id":"right","label":"web server","w":250,"x":485,"y":22}]}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p>What to notice:</p>
<ul>
<li>Going <strong>down</strong>, the message gets <strong>bigger</strong>: every layer adds a header. Going <strong>up</strong>, it gets smaller again.</li>
<li>Each layer only reads <strong>its own</strong> header. The switch in lesson 2.1 only ever reads the layer 2 header;
a router reads layer 3.</li>
<li>The message only touches the cable at <strong>layer 1</strong>.</li>
</ul>
<h3 id="which-layer-a-quick-practice">Which layer? A quick practice</h3>
<p>Cover the right-hand column and guess.</p>
<table>
  <thead>
      <tr>
          <th>Thing</th>
          <th>Layer</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>The Wi-Fi radio waves</td>
          <td>1, physical</td>
      </tr>
      <tr>
          <td><code>AA:AA:AA:11:11:11</code></td>
          <td>2, data link (a MAC address)</td>
      </tr>
      <tr>
          <td><code>192.168.1.10</code></td>
          <td>3, network (an IP address)</td>
      </tr>
      <tr>
          <td>Port 443</td>
          <td>4, transport</td>
      </tr>
      <tr>
          <td>The padlock: encryption</td>
          <td>6, presentation</td>
      </tr>
      <tr>
          <td>The web page itself</td>
          <td>7, application</td>
      </tr>
  </tbody>
</table>
<p class="lab-recap"><span class="mono">in one sentence</span> A message goes down one computer&rsquo;s layers getting wrapped, crosses the cable as bits, and goes up the other&rsquo;s getting unwrapped.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Which layer is broken?</h2>
  </header>
  <div class="lab-stage-body">
    <p>When something stops working, network engineers start at layer 1 and work up. For each problem, which layer
is it?</p>
<ol>
<li>The cat chewed through the Ethernet cable.</li>
<li>Your laptop has an IP address, but it&rsquo;s for the wrong network, so it can&rsquo;t reach anything outside the house.</li>
<li>The website loads, but shows <em>404 page not found</em>.</li>
<li>You&rsquo;re too far from the Wi-Fi router and the signal keeps dropping.</li>
<li>Two laptops on the same switch, and one has accidentally been given the other&rsquo;s MAC address. Frames for one keep going to the other.</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Anything you could touch or measure, like a cable or a signal, is layer 1.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>MAC addresses are layer 2, IP addresses are layer 3, and <em>page not found</em> is the web server program talking.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <ol>
<li><strong>Layer 1</strong>: the cable is physical.</li>
<li><strong>Layer 3</strong>: IP addresses and getting to other networks.</li>
<li><strong>Layer 7</strong>: the network delivered everything perfectly; the web server says the page doesn&rsquo;t exist.</li>
<li><strong>Layer 1</strong>: radio signal strength is physical.</li>
<li><strong>Layer 2</strong>: MAC addresses and switches.</li>
</ol>
<p>If layer 1 is broken, nothing above it works either. That&rsquo;s why <em>is it plugged in?</em> is the first question
every network engineer asks.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item><item><title>What's a host?</title><link>https://networkdoodles.com/lessons/networking-101/task-1-1/</link><pubDate>Wed, 11 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/networking-101/task-1-1/</guid><description>What a host is, how to spot the hosts on a network, and how to find your computer's MAC address, the name its network card was born with. Beginner lesson.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<section class="lab-stage lab-stage-explain" id="explain">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">1</span>
    <span class="lab-stage-kind mono">explain</span><h2>Start here: passing notes</h2>
  </header>
  <div class="lab-stage-body">
    <p>This whole course starts from nothing. Every word gets explained before we use it, starting with the everyday
ones.</p>
<h3 id="passing-a-note-in-class">Passing a note in class</h3>
<p>Imagine you want to tell a friend on the other side of the classroom something. You write it on a scrap of
paper, fold it, write their name on the outside, and pass it along the row. Each person in between looks at the
name and passes it on, until your friend gets it, opens it and reads it.</p>
<p>That&rsquo;s everything a computer network does. The rest of this course is just the details.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Sending something over a network is like passing a named note across a classroom.</p>
<h3 id="data-and-messages">Data and messages</h3>
<p><strong>Data</strong> is any information a computer keeps or sends: words, photos, songs, videos, the moves in a game.
Inside the computer, all of it is stored as numbers.</p>
<p>A <strong>message</strong> is some data sent from one place to another, like your note.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Data is information; a message is some data on its way somewhere.</p>
<h3 id="whats-a-network">What&rsquo;s a network?</h3>
<p>A <strong>network</strong> is a group of things joined together so they can send each other messages. The classroom is a
network: people who write notes, and a way of passing them along.</p>
<p>Computers join up in two ways:</p>
<ul>
<li>with a <strong>cable</strong>: a wire with a plug on each end. Electricity travels along it, carrying the message. The
usual network cable is called an <strong>Ethernet cable</strong>. <em>Ethernet</em> is just the name of the most common kind of
wired network; the plug looks like a chunky phone plug.</li>
<li>with <strong>Wi-Fi</strong>: the same idea, but using <strong>radio waves</strong>, invisible signals through the air, like a
walkie-talkie. No cable needed.</li>
</ul>
<p>Two laptops joined by one cable are a network. So is the whole <strong>internet</strong>: millions of networks all joined
together, all over the world.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A network is things joined by cables or Wi-Fi so they can send each other messages.</p>
<h3 id="hosts-the-ones-writing-and-reading">Hosts: the ones writing and reading</h3>
<p>In the classroom, some people <em>write and read</em> notes: you and your friend. Others just pass them along.</p>
<p>On a network, the things that send and receive their own messages are called <strong>hosts</strong>. Your laptop is a host.
So is a phone, a games console, a smart TV, a printer, and the big computers far away that send you videos and
web pages.</p>
<p>The boxes in between that only pass messages along are called <strong>network devices</strong>. You&rsquo;ll meet them in
<a href="/lessons/networking-101/task-2-1/">chapter 2</a>.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A host is anything that sends or receives its own messages, like a laptop or a phone.</p>
<h3 id="addresses-who-is-it-for">Addresses: who is it for?</h3>
<p>On the classroom note, you wrote your friend&rsquo;s name on the outside so everyone knew who it was for. On an
envelope you write an <strong>address</strong>. An address is just <em>the thing that says who, or where, a message is going to</em>.</p>
<p>Every host on a network needs one too, or nobody would know who a message is for.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> An address says who a message is for, like the name on the outside of a note.</p>
<h3 id="the-network-card-and-its-mac-address">The network card and its MAC address</h3>
<p>The part of a host that actually sends and receives messages is its <strong>network card</strong>. It&rsquo;s the bit the cable
plugs into, or the little radio that does Wi-Fi. (People also call it a <strong>NIC</strong>, short for <em>network interface
card</em>: <em>interface</em> means the place where two things meet, here the computer and the network.) A laptop
usually has two: one for Wi-Fi, one for a cable.</p>
<p>Every network card is given a name at the factory, and it keeps it for life. That name is its <strong>MAC address</strong>.
(<em>MAC</em> stands for <em>Media Access Control</em>, a technical way of saying <em>the card&rsquo;s own address on the network</em>.
It&rsquo;s nothing to do with Apple Mac computers: every network card has one.) It looks like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">AA:AA:AA:11:11:11
</span></span><span class="line"><span class="cl">3C:22:FB:9A:04:7E
</span></span></code></pre></div><p>Six pairs of characters, with colons between them. They use <strong>hexadecimal</strong> (<em>hex</em> for short), a way of
counting with sixteen digits instead of ten: <code>0</code> to <code>9</code>, then <code>A</code> to <code>F</code>, so <code>A</code> means ten and <code>F</code> means
fifteen. Don&rsquo;t worry about the maths: just know it&rsquo;s a name made of numbers and letters. The first half usually
says which company made the card; the second half is that card&rsquo;s own number.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Every network card has a MAC address: a name it got at the factory, like <code>AA:AA:AA:11:11:11</code>.</p>
<h3 id="packets-lots-of-small-notes">Packets: lots of small notes</h3>
<p>What if your note is really long, like a whole story? You might tear it into numbered postcards and send them
one at a time. Then other people can pass their notes in between, and if one postcard gets lost, you only
rewrite that one.</p>
<p>Computers do exactly this. They chop a big message into small pieces called <strong>packets</strong>. Every packet has a
<em>to</em> address and a <em>from</em> address written on it, like an envelope.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> Big messages are chopped into small packets, and each packet carries a to and a from address.</p>

  </div>
</section>


<section class="lab-stage lab-stage-show" id="show">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">2</span>
    <span class="lab-stage-kind mono">show</span><h2>Spot the hosts</h2>
  </header>
  <div class="lab-stage-body">
    <p>Here&rsquo;s a home network, drawn as a picture. Each little drawing is a device, and the lines are how they&rsquo;re
joined: solid lines are cables, dotted lines are Wi-Fi. In the middle is a <strong>Wi-Fi router</strong>, the box most homes
have that does the Wi-Fi and joins the house to the internet.</p>
<p>Press <strong>Play</strong> (or the → button) and each step lights something up and says what it is.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A home network: a laptop, a phone, a games console, a smart TV and a printer joined by a Wi-Fi router to the internet, where a video server lives. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A home network: a laptop, a phone, a games console, a smart TV and a printer joined by a Wi-Fi router to the internet, where a video server lives"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":420,"links":[["pc","rtr",{"wifi":true}],["ph","rtr",{"wifi":true}],["gm","rtr",{"wifi":true}],["tv","rtr",{"wifi":true}],["prn","rtr"],["rtr","net"],["net","srv"]],"narrow":{"at":{"gm":[180,450],"net":[120,60],"pc":[60,175],"ph":[60,360],"prn":[300,175],"rtr":[180,255],"srv":[275,60],"tv":[300,365]},"h":540,"w":360},"nodes":{"gm":{"kind":"console","label":"Games console","x":380,"y":360},"net":{"kind":"cloud","label":"The internet","x":380,"y":70},"pc":{"kind":"laptop","label":"Laptop","x":115,"y":130},"ph":{"kind":"phone","label":"Phone","x":115,"y":320},"prn":{"kind":"printer","label":"Printer","x":645,"y":205},"rtr":{"kind":"wifi","label":"Wi-Fi router","x":380,"y":225},"srv":{"kind":"server","label":"Video server","x":625,"y":70},"tv":{"kind":"tv","label":"Smart TV","x":645,"y":330}},"steps":[{"hot":["pc","ph","gm","tv","prn","srv","rtr","net"],"text":"Everything here is joined up, so any of them can send a message to any other. Solid lines are cables, dotted lines are Wi-Fi.","title":"A network."},{"hot":["pc"],"links":[["pc","rtr"]],"say":{"pc":"I'm a host"},"text":"It sends messages (*show me this web page*) and receives them (*here's the page*). It talks to the router over Wi-Fi.","title":"The laptop is a host."},{"hot":["ph"],"links":[["ph","rtr"]],"say":{"ph":"Me too"},"text":"Same job, smaller screen. A phone's Wi-Fi card has a MAC address just like the laptop's.","title":"So is the phone."},{"hot":["gm","tv"],"links":[["gm","rtr"],["tv","rtr"]],"text":"Online games and streaming are messages too, lots of them, very fast.","title":"The games console and the TV are hosts."},{"hot":["prn"],"links":[["prn","rtr"]],"text":"It mostly *receives* (things to print), but it sends too: *out of paper!* This one uses a cable instead of Wi-Fi.","title":"The printer is a host."},{"hot":["srv"],"say":{"srv":"I'm a host,\na big one"},"text":"A **server** is a computer whose job is to answer other hosts: this one sends out videos. It lives in a data center, which you'll visit in lesson 2.3.","title":"Far away, a server is a host."},{"hot":["rtr","net"],"say":{"rtr":"I just pass\nthings along"},"text":"It doesn't start conversations or read them. It passes messages along, between the hosts at home and the internet. That makes it a **network device**.","title":"The router is not a host here."},{"hot":["ph","srv"],"packets":[{"c":"amber","label":"play video?","path":["ph","rtr","net","srv"]},{"at":3.3,"c":"green","label":"video","path":["srv","net","rtr","ph"]},{"at":3.8,"c":"green","label":"video","path":["srv","net","rtr","ph"]},{"at":4.3,"c":"green","label":"video","path":["srv","net","rtr","ph"]}],"text":"Press play on a video: your phone (a host) sends a message to the video server (another host), and the video comes back in lots of packets. The router and the internet are just the road in between.","title":"Host to host."}],"w":760}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<p class="lab-recap"><span class="mono">in one sentence</span> Laptops, phones, consoles, TVs, printers and far-away servers are all hosts; the router in the middle just passes messages along.</p>

  </div>
</section>


<section class="lab-stage lab-stage-follow" id="follow">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">3</span>
    <span class="lab-stage-kind mono">follow along</span><h2>Send something to the printer</h2>
  </header>
  <div class="lab-stage-body">
    <p>Now let&rsquo;s watch one host send a message to another, up close. Two hosts, one cable, each with its MAC address.
Step through it and watch the <strong>envelope</strong> box under the picture: that&rsquo;s what&rsquo;s written on each packet.</p>
<figure class="netsim" data-netsim tabindex="0" aria-label="A laptop sends a three-page document to a printer over a cable, as three packets, each addressed from the laptop&#39;s MAC address to the printer&#39;s. Use the buttons, or the left and right arrow keys, to step through it.">
  <svg class="ns-svg" role="img" aria-label="A laptop sends a three-page document to a printer over a cable, as three packets, each addressed from the laptop&#39;s MAC address to the printer&#39;s"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":250,"links":[["pc","prn",{"label":"cable"}]],"narrow":{"at":{"pc":[180,95],"prn":[180,330]},"h":420,"w":360},"nodes":{"pc":{"kind":"laptop","label":"Laptop","sub":"MAC AA:AA:AA:11:11:11","x":140,"y":140},"prn":{"kind":"printer","label":"Printer","sub":"MAC BB:BB:BB:22:22:22","x":620,"y":140}},"steps":[{"hot":["pc"],"say":{"pc":"Print my homework\n(3 pages)"},"text":"The laptop has three pages of homework to send to the printer. Both hosts have a MAC address; that's how they'll know who a packet is for.","title":"You press Print."},{"frame":{"layers":[{"fields":[["to","BB:BB:BB:22:22:22 (printer)",true],["from","AA:AA:AA:11:11:11 (laptop)",true]],"l":"a","name":"the envelope"},{"fields":[["data","page 1 of 3, page 2 of 3, page 3 of 3"]],"l":"d","name":"inside"}],"title":"What's written on each packet"},"hot":["pc"],"text":"The laptop splits the document into three packets. On each one it writes **to** (the printer's MAC) and **from** (its own MAC), like an envelope.","title":"Chopped into packets."},{"hot":["pc","prn"],"links":[["pc","prn"]],"packets":[{"c":"amber","label":"page 1","path":["pc","prn"]},{"at":0.55,"c":"amber","label":"page 2","path":["pc","prn"]},{"at":1.1,"c":"amber","label":"page 3","path":["pc","prn"]}],"text":"One after another, down the cable. They travel as electrical signals: ones and zeros.","title":"Off they go."},{"hot":["prn"],"say":{"prn":"To BB:BB:BB:22:22:22?\nThat's me! 3 of 3."},"text":"Each packet says **to: BB:BB:BB:22:22:22**. That's the printer's own MAC address, so it keeps them, and puts the pages back in order.","title":"The printer checks the envelope."},{"frame":{"layers":[{"fields":[["to","AA:AA:AA:11:11:11 (laptop)",true],["from","BB:BB:BB:22:22:22 (printer)",true]],"l":"a","name":"the envelope"},{"fields":[["data","printed, all 3 pages"]],"l":"d","name":"inside"}],"title":"What's written on the answer"},"hot":["prn","pc"],"links":[["pc","prn"]],"packets":[{"c":"green","label":"done!","path":["prn","pc"]}],"text":"Hosts talk both ways. The printer sends a packet back: **to** the laptop's MAC, **from** its own. Now the *to* and *from* have swapped.","title":"And it answers."}],"w":760}</script>
</figure>
<script src="/js/netsim.74bc7704c2408c64f77c5a6eee07e263ba086f6c65ddf7c15b7aea0ced4f973d.js" integrity="sha256-dLx3BMJAjGT3fFpu7gfiY7oIb2xl3ffBW3rqDO1Plz0=" defer></script>
<h3 id="try-it-on-your-own-computer-optional">Try it on your own computer (optional)</h3>
<p>Find your own MAC address. You&rsquo;ll see a different one for Wi-Fi and for Ethernet: they&rsquo;re different cards.</p>
<ul>
<li><strong>Windows</strong>: open <em>Command Prompt</em> (press the Windows key, type <code>cmd</code>, press <kbd>Enter</kbd>) and type
<code>getmac /v</code>. The <strong>Physical Address</strong> column is the MAC address, with dashes instead of colons.</li>
<li><strong>Mac</strong>: open <em>System Settings → Wi-Fi</em>, click <strong>Details…</strong> next to your network, and look for
<strong>MAC address</strong>. Or in <em>Terminal</em>: <code>ifconfig en0 | grep ether</code>.</li>
<li><strong>iPhone or Android</strong>: look in <em>Settings</em> for <strong>Wi-Fi address</strong> (iPhone: tap the ⓘ next to your Wi-Fi network).</li>
</ul>
<p>Phones often use a <strong>private Wi-Fi address</strong>: a made-up MAC address, different for every Wi-Fi network, so
shops and cafés can&rsquo;t follow the phone around by its real one. Clever.</p>
<p class="lab-recap"><span class="mono">in one sentence</span> A host writes <strong>to</strong> and <strong>from</strong> MAC addresses on every packet, and the host the <strong>to</strong> address belongs to keeps it.</p>

  </div>
</section>


<section class="lab-stage lab-stage-challenge" id="challenge">
  <header class="lab-stage-head">
    <span class="lab-stage-n mono">4</span>
    <span class="lab-stage-kind mono">challenge</span><h2>Host or not?</h2>
  </header>
  <div class="lab-stage-body">
    <p>Sort these into <strong>hosts</strong> and <strong>not hosts</strong>. For each one, ask: <em>does it start or finish conversations of its
own, or does it just carry or pass along other people&rsquo;s messages?</em></p>
<ol>
<li>A school Chromebook</li>
<li>A network cable</li>
<li>A smart speaker that plays music when you ask it</li>
<li>A switch</li>
<li>The server that runs a game&rsquo;s online multiplayer</li>
<li>A Wi-Fi signal</li>
<li>A doorbell camera that sends video to your phone</li>
</ol>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>Things that carry messages, like cables and radio waves, are the road, not the people travelling on it.</p>
</div>
</details>
<details class="lab-hint">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>
 <span>hint</span></summary>
  <div class="lab-hint-body"><p>If it has its own conversations (<em>play this song</em>, <em>someone&rsquo;s at the door</em>), it&rsquo;s a host, however small it is.</p>
</div>
</details>
<details class="lab-solution">
  <summary class="mono"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
 <span>show the solution</span></summary>
  <div class="lab-solution-body">
    <table>
  <thead>
      <tr>
          <th></th>
          <th>Host?</th>
          <th>Why</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>School Chromebook</td>
          <td>✅ host</td>
          <td>sends and receives its own messages</td>
      </tr>
      <tr>
          <td>Network cable</td>
          <td>❌</td>
          <td>carries signals, has no conversations</td>
      </tr>
      <tr>
          <td>Smart speaker</td>
          <td>✅ host</td>
          <td>asks a server for the song, gets the music back</td>
      </tr>
      <tr>
          <td>Switch</td>
          <td>❌ network device</td>
          <td>passes frames between hosts (lesson 2.1)</td>
      </tr>
      <tr>
          <td>Game server</td>
          <td>✅ host</td>
          <td>a server is a host whose job is to answer</td>
      </tr>
      <tr>
          <td>Wi-Fi signal</td>
          <td>❌</td>
          <td>radio waves: the road, like the cable</td>
      </tr>
      <tr>
          <td>Doorbell camera</td>
          <td>✅ host</td>
          <td>sends its own video to your phone</td>
      </tr>
  </tbody>
</table>
<p>Anything you&rsquo;d call <em>smart</em> (speakers, bulbs, doorbells, fridges) is a host. People call them the
<strong>Internet of Things</strong>.</p>
  </div>
</details>

  </div>
</section>

]]></content:encoded></item></channel></rss>