Back to Networking Examples
Networking Basics · Guide 1

Networking Introduction

You use a network every minute of the day. This page explains what is actually happening. It covers what a network is, how a message gets chopped into packets, the two kinds of address every device has, what switches and routers do, and how a web page reaches your screen. You don't need to buy anything. Every step has a command to run on the laptop you're reading this on, so you can see each idea for yourself. By the end, the words in every other guide in this section will mean something.

The finish line — you'll be able to read this and say what every line means
C:\> tracert -d bozcode.com 1 2 ms 1 ms 1 ms 192.168.1.1 ← your router 2 11 ms 10 ms 12 ms 100.64.0.1 ← your ISP ... 8 24 ms 23 ms 24 ms (bozcode.com) ← arrived
Time needed ~40 min · hardware none
This guide has 💡 Explain it simply prompts at the ideas that everything else is built on. When you reach one, answer it out loud in plain words before you reveal the answer. If you can explain packets, the two kinds of address, and what a router is for, you already know more than most people who use networks every day.
STEP 01

What a network is.

A network is two or more devices that can send each other messages. That's the whole definition. Two laptops joined by one cable are a network. So are your phone, TV and printer sharing the Wi-Fi at home. The Internet is a network too, just a very large one.

Networks come in sizes, and you'll see three words for them everywhere:

  • LAN (local area network) means the devices in one place: your house, an office floor, a classroom. They're usually joined by one box, or a few boxes in the same building.
  • WAN (wide area network) means a network that spans distance, joining LANs in different buildings or cities. The line from your house to your Internet provider is your WAN connection.
  • The Internet is a network of networks: millions of LANs and WANs, run by different people, that have agreed to pass each other's messages along. Nobody owns it. It works because every piece follows the same rules.

Those shared rules are called protocols. A protocol is an agreement about how to talk, just as English grammar is an agreement that lets two strangers understand each other. You'll meet a handful by name on this page: IP, TCP, DNS, DHCP. Each one solves one problem, and they stack together to deliver a web page.

Your home network, right now

The box your Internet provider gave you is almost certainly four devices in one case: a modem (talks to the provider's line), a router (joins your home network to the Internet), a switch (the Ethernet ports on the back) and a Wi-Fi access point. Step 04 pulls them apart. For now, just know that one box is doing several jobs.

STEP 02

Messages travel as packets.

When you load a photo, it doesn't travel as one big lump. Your device chops it into small pieces called packets, usually about 1,500 bytes each. A single photo can be a thousand of them. Each packet is sent separately, and the receiving device puts them back together in the right order.

Every packet is built like a letter in an envelope:

A photo is cut into a grid of numbered pieces. One piece is shown large as a packet. Its header holds the from address 192.168.1.23, the to address 198.51.100.20, port 443 for the web browser, and the label piece 412 of 1,030. Below the header is the payload, about 1,400 bytes of the photo itself. Network equipment reads only the header.
One photo becomes about a thousand packets. The header is the envelope that network gear reads; the payload is the data inside.
  • The header is the outside of the envelope: who it's from, who it's to, and enough bookkeeping to reassemble the pieces. Network equipment reads only the header.
  • The payload is the letter inside, the actual data. Routers and switches never need to look at it.

Why go to the trouble? There are two reasons, and both matter for everything that follows:

  • Sharing. If your photo went as one lump, nobody else on your Wi-Fi could send anything until it finished. With packets, everyone's pieces take turns, so a video call and a download can share the same connection.
  • Resending. Packets do get lost: a burst of Wi-Fi interference, or a busy router that drops some. When that happens, only the missing pieces are sent again, not the whole photo.

See it: ping

ping sends one tiny packet to an address and times how long the reply takes. It's the simplest network test there is, and it works the same on every operating system. Open PowerShell (Windows: right-click Start → Terminal) or Terminal (Mac or Linux) and type:

PowerShell / Terminal
ping 1.1.1.1
Pinging 1.1.1.1 with 32 bytes of data: Reply from 1.1.1.1: bytes=32 time=14ms TTL=57 Reply from 1.1.1.1: bytes=32 time=13ms TTL=57 ... Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)

Each line is one packet that went out and came back. time=14ms is the round trip: 14 thousandths of a second to reach a server and return. Lost = 0 means none went missing. (Mac and Linux keep pinging until you press Ctrl+C.) 1.1.1.1 is a public server run by Cloudflare that always answers, which is why guides use it.

💡 Explain it simply

A friend asks why the Internet doesn't just send a whole file in one go. Explain packets using the post office.

Reveal a plain-language answer

Imagine mailing a 1,000-page book through a post office that only takes postcards. You number each page, write the address on every one, and drop them in. They travel mixed in with everyone else's mail, so the post office never gets blocked by one giant parcel, and your friend puts the pages back in order using the numbers. If page 412 gets lost, they ask for page 412 again, not the whole book. Packets are those postcards. The header is the address and page number, and the payload is the writing on the back.

STEP 03

Every device has two addresses.

This is the idea that confuses beginners most, so it gets its own step. Every network connection has two different addresses, and they do different jobs.

Two streets joined by a router. The left street is the network 192.168.1 with a laptop at house 23, a printer at 40 and a phone at 57. The right street is 192.168.2 with houses 5, 9 and 14. The router has one address on each street, 192.168.1.1 and 192.168.2.1. The laptop and printer talk directly because they share a street; reaching house 9 on the other street goes through the router. Below, 192.168.1.23 is split into the street part 192.168.1 and the house part 23, and a name tag shows the laptop's MAC address 3C-22-FB-8A-11-C4, which is built in and never changes.
The IP address is where a device is: street, then house. The MAC address is who it is, like a name tag. Crossing to another street always goes through a router.
MAC addressIP address
Looks like3C-22-FB-8A-11-C4192.168.1.23
Set bythe factory, built into the network hardwarethe network you join (usually handed out automatically)
Changes when you move?No. Same at home, at work, in a café.Yes. A new network gives you a new one.
Used forthe next hop, on this cable or Wi-Fithe whole trip, end to end, across networks
Everyday analogyyour nameyour street address

An IP address is four numbers from 0 to 255 separated by dots. Think of it as a street and a house number. In 192.168.1.23, the first three numbers (192.168.1) are the street, meaning the network, and the last one (23) is the house, meaning your device. Devices on the same street can talk directly. Reaching another street needs a router, which is Step 04.

The subnet mask says where the street part ends. 255.255.255.0 means “the first three numbers are the street.” It is also written /24, and it's by far the most common mask on home and small office networks.

The default gateway is the address of your router, the house at the end of the street that knows the way to everywhere else.

See yours

Windows — PowerShell
ipconfig /all
Wireless LAN adapter Wi-Fi: Physical Address. . . . . . . . . : 3C-22-FB-8A-11-C4 ← MAC DHCP Enabled. . . . . . . . . . . : Yes IPv4 Address. . . . . . . . . . . : 192.168.1.23 ← IP Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 ← router DNS Servers . . . . . . . . . . . : 192.168.1.1
Mac — Terminal
ifconfig en0 | grep -E "ether|inet "
route -n get default | grep gateway
Linux — terminal
ip addr
ip route | grep default

Write down four things: your IP address, subnet mask, default gateway and MAC address. Your numbers will be different from the example; 192.168.0.x, 192.168.1.x and 10.0.0.x are all common. You'll use them again in Steps 07 and 08.

You didn't type any of that

DHCP Enabled: Yes means your laptop asked the network for an address when it joined, and your router handed one out along with the mask, gateway and DNS server. That protocol is DHCP, and it's why you can join any Wi-Fi without configuring anything. The Cisco 1921 First Network guide has you build a DHCP server yourself.

💡 Explain it simply

You take your laptop from home to a coffee shop. Which of its two addresses changes, which stays the same, and why does a device need both?

Reveal a plain-language answer

The MAC address stays the same, because it's built into the Wi-Fi hardware, like your name. The IP address changes, because it describes where you are, like a street address, and you've moved to a different street. You need both because they answer different questions. The IP address gets a packet across the world to the right street and house. The MAC address is how the last device on your street hands it to the right machine. The postal system uses the address to get a letter to your building, and then someone reads the name to put it in your hands.

STEP 04

The boxes: switches, routers and friends.

Networking equipment looks alike (grey or black boxes covered in ports), but each kind does one specific job. The easiest place to see all of them is the box your Internet provider gave you, opened up:

The box from an Internet provider opened up into four devices in a row. The provider's line comes in from the Internet to a modem, then a router, then a switch, which also feeds a Wi-Fi access point. The switch's Ethernet ports connect a desktop PC and a printer by cable; the access point connects a laptop and a phone by Wi-Fi.
Your home Internet box is four devices in one case. In an office they are usually separate boxes, but they do the same four jobs.
  • Network interface (NIC) is the part of each device that connects to the network: the Ethernet port on a desktop, or the Wi-Fi chip in a phone. The MAC address belongs to the NIC.
  • Switch connects many devices on the same network. It learns which MAC address is on which port and sends each packet out of only the port it needs. It never looks at IP addresses. A switch makes one street longer; it doesn't connect you to other streets.
  • Router connects different networks. It has a foot on each street and reads the IP address in every packet to decide which way to send it. Your home router has one foot on your home network and one on your provider's. The Internet is routers passing packets to each other.
  • Access point is a switch port without the cable. It lets Wi-Fi devices join the same network as the wired ones.
  • Modem translates between Ethernet and whatever the provider's line is (cable, fibre, DSL, cellular). It doesn't make any decisions; it's a translator.
  • Firewall decides which packets are allowed through at all, by rules. On a home network it's a feature of the router, not a separate box.

A switch connects devices. A router connects networks. Almost every networking question starts with which of the two you're dealing with.

💡 Explain it simply

An office has run out of Ethernet ports. Someone suggests buying a router; someone else says a switch. Who's right, and how would you explain the difference?

Reveal a plain-language answer

The switch. The office needs more sockets on the same network, and a switch is a power strip for network cables: plug it into a free port and you get eight or twenty-four more, all on the same street as everything else. A router is for joining two different streets, such as the office and the Internet. The office already has one of those. Adding a second router would create a new, separate street, and the new devices couldn't easily see the printer on the old one.

STEP 05

The layers: one problem each.

Delivering a web page means solving several separate problems: getting a signal onto the wire, finding the right network, reaching the right program, and agreeing on what the message means. Networking splits them into layers, and each layer solves one problem and relies on the layer below. That's why you can change from Wi-Fi to Ethernet without your browser noticing. Only the bottom layer changed.

LayerProblem it solvesAddress it usesExamplesBox that works here
ApplicationWhat does the message mean?a name, like bozcode.comHTTP/HTTPS (web), DNS, SSH, email—
TransportWhich program on the device? Did every piece arrive?a port number, like 443TCP, UDPfirewall
InternetWhich network, and which device on it, anywhere in the world?IP addressIP, ICMP (ping)router
LinkHow to reach the next device on this cable or Wi-Fi?MAC addressEthernet, Wi-Fiswitch, access point
Four layers stacked top to bottom: Application (OSI 5 to 7, uses a name such as bozcode.com), Transport (OSI 4, uses a port such as 443), Internet (OSI 3, uses an IP address, where routers work) and Link (OSI 1 and 2, uses a MAC address, where switches work). On the right, a web request grows as it goes down: first just the data, then a TCP header with the port in front, then an IP header with the addresses, then a Wi-Fi header with the MAC addresses. The receiver unwraps it in reverse.
Going down the layers, each one adds its own header in front, like putting an envelope inside a bigger envelope. The receiver opens them in reverse.

This four-layer version is the TCP/IP model, which is how the Internet is actually built. You'll also hear about the OSI model, which splits the same job into seven layers. Its numbers are the ones people say out loud: a switch is a Layer 2 device, a router is Layer 3, and TCP and UDP are Layer 4. OSI Layers 1 and 2 are the Link row above (1 is the physical cable or radio signal), 3 is Internet, 4 is Transport, and 5–7 are all folded into Application.

Ports: which program gets the packet

An IP address gets a packet to the right device. But a computer runs many network programs at once, such as a browser, an email client and a chat app. The port number says which one the packet is for, like an apartment number after the street address. Some ports are standard, so everyone knows where to knock:

PortProtocolUsed for
443HTTPSsecure web pages (almost all of them now)
80HTTPunencrypted web pages
53DNSlooking up names (Step 06)
22SSHsecure remote command line, used to manage routers and servers
67 / 68DHCPhanding out IP addresses
3389RDPWindows Remote Desktop

The transport layer comes in two main kinds. TCP numbers every piece, confirms each arrived, and resends anything lost. Web pages, email and file downloads use it because every byte must arrive. UDP just sends and doesn't check. Video calls, games and DNS use it, because a late packet is useless and it's better to move on than wait for it to be resent.

STEP 06

Names into numbers: DNS.

Packets need IP addresses, but people remember names. DNS (the Domain Name System) is the Internet's phone book: you ask it for a name and it answers with the address. Every time you type a website, your device asks a DNS server first, before it sends a single packet to the site. Try it:

PowerShell / Terminal — any system
nslookup bozcode.com
Server: UnKnown Address: 192.168.1.1 ← who you asked (your router, passing it on) Non-authoritative answer: Name: bozcode.com Address: (the site's IP address)

The first two lines are who you asked. That's the DNS server from your ipconfig /all in Step 03, usually your own router, which forwards the question to your provider's DNS servers. The last lines are the answer. Non-authoritative just means the answer came from a server that had it saved, not from the server that owns the name, which is normal and fast.

“The Internet is down” — or is it DNS?

A very common fault: websites won't load, but ping 1.1.1.1 works fine. The network is up; only name lookups are failing. Now you can tell the two apart in ten seconds. If pinging a number works and nslookup of a name doesn't, the problem is DNS.

STEP 07

Follow one web request, start to finish.

Everything so far comes together here. When you type bozcode.com and press Enter, this happens in well under a second:

A left-to-right path with seven numbered steps: 1, the laptop at 192.168.1.23 already has an address from DHCP; 2, it asks a DNS server for bozcode.com; 3, the address is on a different street so the packet goes to the gateway; 4, ARP finds the router's MAC address; 5, the home router does NAT; 6, routers at the provider and across the Internet pass it hop by hop; 7, at the web server TCP connects on port 443, encryption is agreed, and the page comes back the same way.
The numbers match the list below.
  1. You already have an address. When your laptop joined the Wi-Fi, DHCP gave it an IP address, a mask, a default gateway and a DNS server (Step 03).
  2. DNS. The browser asks the DNS server for bozcode.com and gets back an IP address (Step 06).
  3. Same street or not? Your laptop compares that address with its own using the subnet mask. It's on a different street, so the packet has to go to the default gateway, your router.
  4. ARP: finding the router's MAC. To hand the packet to the router over Wi-Fi, the laptop needs the router's MAC address. It asks the whole network, “who is 192.168.1.1?”, and the router answers. That protocol is ARP, and the answer is kept in a table you can see below.
  5. The router takes over. It swaps your private return address for its own public one (that's NAT, in Step 08) and sends the packet to your provider.
  6. Router to router. Each router along the way reads the destination IP and passes the packet one hop closer. There are usually 8 to 20 hops.
  7. TCP, then encryption, then the page. Your laptop and the server shake hands on port 443, agree an encryption key (the padlock in your browser), and then the browser asks for the page. The page comes back as packets over the same path in reverse, and the router passes each one back to your laptop.

See step 4: the ARP table

arp -a
Interface: 192.168.1.23 --- 0x12 Internet Address Physical Address Type 192.168.1.1 a4-2b-b0-5c-19-e2 dynamic ← your router 192.168.1.40 f0-9f-c2-11-7a-30 dynamic ← another device at home

This is your laptop's list of neighbours on the same street: each IP address and the MAC address it matched. Your default gateway will be in the list, because your laptop talks to it constantly. (Linux: ip neigh.)

See step 6: every hop

Windows: tracert · Mac / Linux: traceroute -n
tracert -d bozcode.com
Tracing route to bozcode.com over a maximum of 30 hops 1 2 ms 1 ms 1 ms 192.168.1.1 2 11 ms 10 ms 12 ms 100.64.0.1 3 12 ms 11 ms 11 ms (your provider) 4 * * * Request timed out. ... 8 24 ms 23 ms 24 ms (bozcode.com)

Each line is one router that handled your packet, with three timings to reach it. Hop 1 is always your default gateway, the address you wrote down in Step 03. Hop 2 is usually your provider. The timings grow as the packet travels further. A line of * means that router didn't answer this test, which many don't. The packet still went through. -d (or -n) skips looking up a name for every hop, which makes it much faster.

STEP 08

Private and public addresses, and NAT.

Here's a puzzle. Your laptop's IP address from Step 03 is something like 192.168.1.23. So is your neighbour's. So are millions of other laptops. How can they all have the same address?

Because those are private addresses. Three ranges are reserved for use inside homes and offices and are never used on the public Internet:

Private rangeTypically seen
10.0.0.0 – 10.255.255.255companies, some home routers
172.16.0.0 – 172.31.255.255companies, virtual machines
192.168.0.0 – 192.168.255.255almost every home network

Anyone can use them, and they only need to be unique within one network. To reach the Internet, your router does NAT (Network Address Translation): on the way out, it replaces your private return address with its one public address, the address your provider gave it. It keeps a note of which conversation belongs to which device, and swaps the address back when replies arrive. Every device in your house shares that one public address.

Inside a dashed box labelled your home, a laptop at 192.168.1.23, a TV at 192.168.1.40 and a phone at 192.168.1.57 all connect to the home router, which is 192.168.1.1 inside. Every packet leaving the router carries the same return address, 203.0.113.57, so a website sees only that one address. Below, the router's NAT notebook records which conversation belongs to which inside device so replies go back to the right one.
Inside, every device has its own private address. Outside, they all share one public address, and the router keeps notes so every reply goes back to the right device.

See both of your addresses

You already have your private address from ipconfig. Now open the site's IP Lookup page, which shows the address this web server saw your request come from:

ipconfig says: 192.168.1.23 ← private, inside your home IP Lookup says: 203.0.113.57 ← public, your router's address on the Internet

The two are different, and that difference is NAT. Every phone and laptop in your house would show the same public address on that page.

Starts with 100.64 or 10., or matches no address you know?

Some providers, especially mobile and satellite ones, put their own NAT in front of yours and share one public address between many customers. You saw a hint of that in the example traceroute: 100.64.0.1 at hop 2 is from a range reserved for exactly this. It's normal, and it's why some games and home servers struggle on those connections.

💡 Explain it simply

Your laptop says its address is 192.168.1.23, but a website says your address is 203.0.113.57. A friend thinks one of them is wrong. Explain why both are right.

Reveal a plain-language answer

Think of an office building with one street address and a mail room. Inside, everyone has a desk number: that's 192.168.1.23, and only people in the building use it. When you send a letter out, the mail room puts the building's street address on it as the return address: that's 203.0.113.57, the only one the outside world ever sees. When the reply comes back, the mail room remembers it was yours and walks it to your desk. The website only ever sees the building's address. Your laptop only knows its desk number. Both are true; they're just used on different sides of the mail room, and the mail room is your router doing NAT.

STEP 09

The words, in one place.

Every term from this page, for when you meet it again in another guide.

TermIn one line
NetworkTwo or more devices that can send each other messages.
LAN / WANA network in one place / a network that joins places.
ProtocolAn agreed set of rules for talking, like IP, TCP, DNS or DHCP.
PacketA small piece of a message, with a header (addresses) and a payload (data).
MAC addressThe hardware address built into a network interface. Used for the next hop.
IP addressThe logical address a network gives a device. Used end to end.
Subnet maskSays which part of an IP address is the network (255.255.255.0 = /24).
Default gatewayThe router a device sends anything that isn't on its own network.
DHCPHands out IP addresses, masks, gateways and DNS servers automatically.
ARPFinds the MAC address that belongs to an IP address on the same network.
SwitchConnects devices on one network, using MAC addresses. “Layer 2.”
RouterConnects different networks, using IP addresses. “Layer 3.”
PortA number that picks the program on a device (443 = HTTPS, 22 = SSH).
TCP / UDPChecked, resent delivery / fast, unchecked delivery.
DNSTurns names into IP addresses.
NATLets many private addresses share one public address.
ping / tracertIs it reachable? / Which routers are on the way?

Check yourself

  • You can find your IP address, subnet mask, default gateway and MAC address
  • You can say which of those changes when you move to another network
  • You know which box connects devices and which connects networks
  • ping 1.1.1.1 works, and you know what time= and Lost mean
  • You found your default gateway as hop 1 of tracert and in arp -a
  • You've seen your private address and your public address, and can say why they differ
STEP 10

Where to go next.

You now know what a network is made of and how a packet crosses the Internet. The next step is to stop just watching the network and start building one. That means a real router you configure yourself, where you set every address, mask, gateway, DHCP pool and NAT rule from this page by hand.

⬢

Cisco 1921 Router Guide

Hands-on with a used Cisco router that costs less than a textbook. Part 1 starts with the console cable; by Part 3 your laptop reaches the Internet through a router you set up yourself.

∞

IOS command reference

The commands you'll type on Cisco routers and switches, grouped by what they do.