Skip to content
Fundamentals

· 4 min read

A beginner's guide to networking

Networking looks like a wall of acronyms until you see that each one answers a single question: where is it, how do I get there, who is it for, and what does it say. This guide builds the picture from those four questions.

On this page

Four questions that explain most of it#

Every piece of networking answers one of four questions about a message. Learn which question each acronym answers and the rest sorts itself out.

  • Where is it going? An address. On the internet that is an IP address.
  • How does it get there? Routing: each router reads the address and passes the message toward its destination.
  • Which program is it for? A port number. One machine runs many services, and the port says which one.
  • What does it say? An application protocol, such as HTTP for web pages, or SMTP for email.

The layers#

Networks are built in layers, each relying on the one beneath it and knowing nothing about the ones above. The internet's version has four:

The four layers of the internet stack
LayerQuestion it answersExamples
ApplicationWhat is being said?HTTP, DNS, SMTP, TLS-encrypted versions of them
TransportWhich program, and how reliably?TCP (ordered, checked), UDP (fast, no guarantees), port numbers
InternetWhich machine, across which networks?IP addresses, routing, ICMP (used by ping)
LinkHow does it cross this one cable or radio link?Ethernet, Wi-Fi, hardware (MAC) addresses

RFC 1122 is the reference for how a host implements the bottom three.

Layering is why a page can load the same way over Wi-Fi, a cable or a mobile network, and why swapping HTTP for another protocol does not require new cables.

Four things that look like addresses#

Addresses at each layer
WhatExampleReachesAssigned by
MAC address3c:22:fb:0a:9e:41One network card, on the local network onlyThe manufacturer, though many devices now randomise it
IP address192.168.1.14, 2001:db8::42One connection, across networksYour router or ISP. See public vs private
Port443One program on a machineBy convention; the IANA port registry lists the standard ones
Hostnamewww.example.comA name that resolves to an IP addressWhoever registered the domain. See DNS

The MAC address is used only inside one network segment, to deliver a frame to the right card. It is replaced at every router, so it never reaches a website. Everything beyond the router uses IP addresses.

The boxes on your desk#

  • Modem. Converts the ISP's medium (cable, fibre, phone line, radio) into Ethernet your equipment can use.
  • Router. Forwards traffic between networks: yours and the ISP's. It is the device that decides where a packet goes next.
  • Switch. Connects devices on one network and forwards frames by MAC address.
  • Access point. Provides Wi-Fi.

The box the ISP gave you is usually all four in one, plus three more jobs: it runs DHCP, which gives each new device an address, a gateway and DNS servers; it does NAT, sharing one public address (how NAT works); and it runs a firewall. That is why "the router" is where you go to change almost everything.

What happens when you open a web page#

  1. The browser checks its caches for the page and for the address of the name.
  2. DNS finds the address. The name is looked up, following the steps in how a DNS lookup works.
  3. A connection is opened. The browser makes a TCP connection to that address on port 443, with a three-step handshake: a request to connect, an acknowledgement, and a confirmation.
  4. The connection is encrypted. TLS negotiates keys and the browser checks the server's certificate against the name it asked for.
  5. The request is sent. An HTTP request, such as GET /, is sent inside the encrypted connection, with headers describing the browser. See what yours sends in the HTTP header viewer.
  6. The server replies with the page, and its own headers.
  7. The browser renders, and repeats. The page names images, scripts and stylesheets, and each may need its own lookup and connection.

Commands that answer the four questions#

Diagnostic commands
CommandWhat it tells youQuestion
ipconfig or ip addrYour device's addresses, gateway and DNS serversWhere am I?
ping 1.1.1.1Whether an address answers, and how long the round trip takesCan I reach it?
traceroute example.com or tracert example.comEach router on the path and the delay to itHow does it get there?
nslookup or digWhat DNS says for a name. See the DNS lookupWhat address is it?
curl -I https://example.comThe HTTP status and headers a server returnsWhat does it say?
The most useful single test in troubleshooting
ping 1.1.1.1              # works?   The network path is fine.
ping example.com          # fails?   Then the problem is DNS, not the connection.

If pinging an address works but pinging a name fails, the connection is fine and DNS is the problem. That one comparison rules out half of all "the internet is down" reports.

Common questions#

What is the difference between a LAN and a WAN?

A LAN is the local network: your home or office, behind your router. A WAN is a network that connects LANs across a distance. Your ISP's network and the internet are WANs. The address your router shows on its "WAN" page is the public one.

What is bandwidth compared with latency?

Bandwidth is how much data can move per second. Latency is how long one packet takes to get there. A fast download and a slow video call can happen on the same line: one is bandwidth, the other latency.

Is HTTPS the same as a VPN?

No. HTTPS encrypts the conversation with one website, and your ISP can still see which site. A VPN wraps everything from the device. Neither hides your identity from the site you log in to.

Try it on your own connection

Sources and further reading

Keep reading

Published by My IP Address