Why networks exist
A typical small office has 10 to 20 laptops, one shared printer, a file server and one internet connection. Without a network, every file would move on a USB stick and every desk would need its own printer and internet line.
A network connects these devices so they can exchange data directly. That gives two things every home, office and data centre needs: resource sharing (one printer, one file server, one internet connection for everyone) and communication (email, chat, video calls).
The four parts of a network
Two laptops joined by one cable are a network. So is your home Wi-Fi, and so is the internet. Whatever the size, networks are built from the same four parts (the smallest, two devices on one cable, needs no network device):
| Part | What it does | Real examples |
|---|---|---|
| End devices (hosts) | Create and use the data | Laptop, phone, printer, web server, smart TV |
| Network devices | Forward data between end devices | Switch, router, wireless access point, firewall |
| Media | Carry the signal | Copper Ethernet cable (Cat 6), fibre, Wi-Fi radio |
| Protocols | Rules both sides follow | Ethernet (IEEE 802.3), Wi-Fi (IEEE 802.11), IP, TCP, HTTPS |
Every end device connects through a NIC (network interface card): the Ethernet port or Wi-Fi chip inside it. Each NIC has a MAC address, and each device on the network gets an IP address. The next section shows how network devices use those two addresses.
How data moves: switches and routers
Data is sent in small units. A packet carries the source and destination IP address. On each cable or Wi-Fi link, the packet travels inside a frame, which carries the source and destination MAC address.
- A switch forwards frames inside one network. It looks up the destination MAC address in its MAC address table and sends the frame out of the one port where that device is connected.
- A router forwards packets between networks. It looks at the destination IP address and picks the next hop from its routing table.
Devices send anything for another network to their default gateway: the router's address on their own network. Pick a destination and watch where the laptop sends it. The panel under the diagram shows the frame's MAC addresses and the packet's IP addresses at each step.
Device key: example.com (server)
Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
MAC addresses identify link-layer interfaces or destination groups. They are not IP addresses or website URLs.
- Laptop: IP 192.168.1.20
- Printer: IP 192.168.1.30
- Router: IP 192.168.1.1
- example.com: IP 198.51.100.10
Tip: click or tap a device to see its details.
- 1. Decide: 192.168.1.30 is on the laptop's own network, 192.168.1.0/24, so it sends the frame straight to the printer.
- 2. Into the switch: the frame is addressed to the printer's MAC address. The switch looks it up in its MAC address table: port Gi1/0/3.
- 3. Delivered: the switch sends the frame out of Gi1/0/3 only. The router does not receive it.
What to notice:
- The print job never reaches the router. Traffic inside one network needs only the switch.
- Traffic to any other network goes to the default gateway first.
- The switch decides by MAC address; the router decides by IP address.
Learn more: SwitchesRoutersThe Default Gateway
Client-server and peer-to-peer
In client-server, a server runs a service and waits for requests on a known port number; clients connect to that port. Your browser is a client; a website is a server listening on port 443 (TCP, and UDP for HTTP/3).
Device key: PC (computer) · Phone (mobile device)
Lines show the example’s network connections. Dashed wireless links: radio connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- Laptop: client
- PC: client
- Phone: client
- File server: IP 192.168.1.5
Tip: click or tap a device to see its details.
- 1. Request: a client asks the file server for a file on TCP port 445.
- 2. Response: the server sends the file back.
- 3. Many clients: one server answers them all at the same time.
In peer-to-peer (P2P) there is no central server: each device both asks for and provides data. AirDrop and BitTorrent work this way.
| Client-server | Peer-to-peer | |
|---|---|---|
| Who provides the service? | A server | Every device |
| Control and backups | In one place | Spread across devices |
| Real examples | Websites (443), email, file servers (445) | AirDrop, BitTorrent |
A server is a role, not a special computer: any device that listens for requests and answers them is acting as a server.
Home, office and enterprise networks
The rules are the same at every size. What changes is the number of devices and how the jobs are split between them. At home, one box does almost everything:
Device key: Phone (mobile device) · Internet (ISP) (network / service)
Lines show the example’s network connections. Dashed wireless links: radio connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- Home router: IP 192.168.1.1
Tip: click or tap a device to see its details.
- 1. Join: devices join over Wi-Fi and get an IP address from the router's DHCP server.
- 2. Out: the router forwards their traffic to the ISP.
| Home | Small office | Enterprise | |
|---|---|---|---|
| Devices | 5 to 50 | 10 to 200 | Thousands |
| Network devices | One home router from the ISP | Firewall, a 24- or 48-port switch, ceiling access points | Many switches in layers, routers, firewalls, wireless controllers, with backup links |
| Run by | The household | One IT person or an IT company | A network team |
Learn more: Types of Networks
Check your own network
On Windows, open Command Prompt and run ipconfig:
C:\>ipconfig Wireless LAN adapter Wi-Fi: IPv4 Address. . . . . . . . . . . : 192.168.1.20 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1
ip addr for the address and ip route for the gateway; on macOS, ifconfig and netstat -rn.Now test the path to your router with ping (use your own gateway address):
C:\>ping 192.168.1.1 Pinging 192.168.1.1 with 32 bytes of data: Reply from 192.168.1.1: bytes=32 time=2ms TTL=64 Reply from 192.168.1.1: bytes=32 time=1ms TTL=64 Reply from 192.168.1.1: bytes=32 time=3ms TTL=64 Reply from 192.168.1.1: bytes=32 time=2ms TTL=64 Ping statistics for 192.168.1.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Advanced: why the MAC address changes and the IP address does not
A frame only travels one link. When a packet crosses a router, the router removes the old frame and builds a new one with new source and destination MAC addresses for the next link. The packet inside, with its IP addresses, normally stays the same from end to end.
The exception is NAT (Network Address Translation). In the diagram, the router replaced the laptop's private source address 192.168.1.20 with its own public address 203.0.113.2, because private addresses cannot be used on the internet.
Learn more: MAC AddressesHow NAT and PAT Work
Three common mix-ups
- Thinking Wi-Fi is the internet. Full Wi-Fi bars only mean your device reaches the access point. The internet link can still be down.
- Confusing a switch with a router. A switch forwards frames inside one network by MAC address; a router forwards packets between networks by IP address.
- Treating a server as a special kind of computer. Any device that listens for requests on a port and answers them is a server.
A laptop that can't print or browse
A laptop on the office Wi-Fi can't open any website or print. You run ipconfig:
C:\>ipconfig Wireless LAN adapter Wi-Fi: Autoconfiguration IPv4 Address. . : 169.254.37.12 Subnet Mask . . . . . . . . . . . : 255.255.0.0 Default Gateway . . . . . . . . . :
Draw your own network, then test it
Exercise: draw your home network. Mark the end devices, the network device(s), the media (cable or Wi-Fi) and two protocols you use every day. Then run ipconfig and ping to your default gateway, and write the IP address, gateway and ping time next to your device.
In the ipconfig output above, what went wrong?
In the office above, printing works but no websites load. Which device should you check first?
A laptop at 192.168.1.20/24 sends a packet to 192.168.1.30. Where does it send the frame?
Your browser opens https://example.com. Which roles are they playing?