The VikiD Truth

Knowledge base / Computing / Networking & the web

Quicklinks | Reading Lists | Computing | computingFreedom | Build | Picolisp | Picolisp Machine | Pil Sources | Linux | BASH | C-Programmming | Operating Systems | Javascipt | Emacs | vim | Pharo Smalltalk | Computer Security | Python | The Compiler | Identifiers | Literals | storage_linkage | Networking

Network Protocols and Technologies

It probably hasn’t escaped you attention that Computer Networks (Social and Otherwise) are possibly one of the most important technologies invented in the last century. But how do they work? I mean really work under the hood?

Well you have come to the right place.

What it is, in plain words

Here is the truth about networks: a network is just envelopes inside envelopes. Your browser writes a letter (an HTTP request). It goes into a TCP or QUIC envelope that numbers the pages, then into an IP envelope with the destination address, then into an Ethernet or Wi-Fi frame addressed to the next box down the hall. Each box along the way opens only the envelope meant for it, reads the address, and passes the rest on.

Those envelopes are the layers:

flowchart TB
  A["Application: HTTP, DNS, SSH, SMTP"] --> T["Transport: TCP, UDP, QUIC"]
  T --> I["Internet: IPv4, IPv6, ICMP"]
  I --> L["Link: Ethernet, Wi-Fi, ARP / NDP"]
  L --> P["Physical: copper, fibre, radio"]

The seven-layer OSI model in the diagram further down is the textbook version; the four- or five-layer TCP/IP model is what the internet actually runs.

Why it matters

An everyday analogy: international post

You write a letter in English (application). You put it in an envelope with the recipient’s address and a tracking number (transport and IP). The local postman only knows how to reach the sorting office (the link to your router). The sorting office reads the country and sends it on (routing). Nobody along the way reads your letter. And with TLS, the letter is in a locked box anyway.

A hands-on example: walk up the stack from a Vikix shell

ip -br link                     # link layer: interfaces and their state
ip -br addr                     # IP addresses (v4 and v6)
ip route                        # where packets go by default
ip neigh                        # ARP / neighbour table: IP to MAC

ping -c3 9.9.9.9                # IP reachability (ICMP)
tracepath -n thevikidtruth.com  # each router on the way

dig +short thevikidtruth.com    # DNS: name to address
dig +short AAAA thevikidtruth.com

ss -tulpn                       # transport: which programs listen on which ports
curl -sI --http2 https://thevikidtruth.com | head -3   # application: HTTP

Work top to bottom when something fails: if dig fails but ping 9.9.9.9 works, it is DNS. If ping fails but ip route shows no default route, it is your link or DHCP. On a laptop, nmtui fixes most Wi-Fi problems; on a minimal Void install dhcpcd and wpa_supplicant do the same job as runit services.

And from PicoLisp, the transport layer is two functions away:

(let S (connect "thevikidtruth.com" 80)   # TCP socket
   (out S (prinl "HEAD / HTTP/1.0^M") (prinl "Host: thevikidtruth.com^M") (prinl "^M"))
   (in S (line T)) )                       # first line of the reply

Common misconceptions

Connections

Network Technologies & Relay Systems

Addressing

Main Protocols

Secondary Protocols

Other Considerations

Request for Comments

Before you start anywhere you probably want to keep this diagram in your mind. I lifted & modified from RFC-1180. I spent a lot of time confused about these diagrams and what they meant. If you are too, then please read this first.

                          Module Diagram                      Protocol Layers (OSI &
                                                                             TCP/IP*)
                     ----------------------------             Layer-4*--------------
                     |    network applications  |             |Layer 7.Application |
                     |...   \\ | /  .. \\ | /  ...|             |Layer 6.Presentation|
                     |     -----      -----     |             |Layer 5. Session    |
                     |     |TCP|      |UDP|     |             |Layer 4. Transport  |
                     |     -----      -----     |             ----------------------
                     |         \\      /         |
                     |         --------         | roughly
                     |         |  IP  |         | translating  Layer 3 .Internetwork
                     |  -----  -*------         | to
                     |  |ARP|   |               |
                     |  -----   |               |
                     |      \\   |               |
                     |      ------              |
                     |      |ENET|              |               Layer 2. Link
                     |      ---@--              |
                     ----------|-----------------
                               |
         ----------------------o---------                       Layer 1. Physical
             Ethernet Cable

There are more that 2500 of this documents. An impossible task.

Below is a list of the most important ones to read.

Last edited · 13 revisions

Tags: #Computing