Course contents

Unit 1: Networking BasicsLesson 1.1 (1 of 5 in this unit)1 of 104 in the Network Fundamentals course

What Is a Computer Network?

What a network is made of, how data moves through switches and routers, and how to see it on your own computer.

Beginner · 12 min read

You'll learn to name the four parts of a network, explain how a switch and a router forward data, and check your own IP address and default gateway.

Technical definition

A computer network is a group of two or more devices connected by wired or wireless links that follow shared rules (protocols) to exchange data and share resources.

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):

Diagram
The four parts of a network
The four parts of a network
PartWhat it doesReal examples
End devices (hosts)Create and use the dataLaptop, phone, printer, web server, smart TV
Network devicesForward data between end devicesSwitch, router, wireless access point, firewall
MediaCarry the signalCopper Ethernet cable (Cat 6), fibre, Wi-Fi radio
ProtocolsRules both sides followEthernet (IEEE 802.3), Wi-Fi (IEEE 802.11), IP, TCP, HTTPS
Read each row across: the left box names the item, the others describe it.

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.

Diagram
A small office network
A small office network
Send from the laptop to:
Gi1/0/2Gi1/0/3Gi1/0/24Gi0/0Gi0/1LaptopIP 192.168.1.20PrinterIP 192.168.1.30SwitchRouterIP 192.168.1.1Internetexample.comIP 198.51.100.10Frame–Packet–

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. 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. 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. 3. Delivered: the switch sends the frame out of Gi1/0/3 only. The router does not receive it.
The laptop already knows the printer's and the router's MAC addresses here. How it learns them (ARP) is covered in Unit 6.

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).

Diagram
Client-server: many clients use one server
Client-server: many clients use one server
LaptopclientPCclientPhoneclientSwitchFile serverIP 192.168.1.5

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. 1. Request: a client asks the file server for a file on TCP port 445.
  2. 2. Response: the server sends the file back.
  3. 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.

Diagram
Client-server and peer-to-peer
Client-server and peer-to-peer
Client-serverPeer-to-peer
Who provides the service?A serverEvery device
Control and backupsIn one placeSpread across devices
Real examplesWebsites (443), email, file servers (445)AirDrop, BitTorrent
Read each row across: the left box names the item, the others describe it.

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:

Diagram
A home network
A home network
LaptopPhoneHome routerIP 192.168.1.1Internet (ISP)

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. 1. Join: devices join over Wi-Fi and get an IP address from the router's DHCP server.
  2. 2. Out: the router forwards their traffic to the ISP.
Diagram
Home, office and enterprise networks
Home, office and enterprise networks
HomeSmall officeEnterprise
Devices5 to 5010 to 200Thousands
Network devicesOne home router from the ISPFirewall, a 24- or 48-port switch, ceiling access pointsMany switches in layers, routers, firewalls, wireless controllers, with backup links
Run byThe householdOne IT person or an IT companyA network team
Read each row across: the left box names the item, the others describe it.

Learn more: Types of Networks

Check your own network

On Windows, open Command Prompt and run ipconfig:

Example output from a Windows PC, written for this lesson
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
IPv4 Address is your device. Subnet Mask 255.255.255.0 means every 192.168.1.x address is on your network. Default Gateway is your router. On Linux, use 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):

Example output from a Windows PC, written for this lesson
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),
Four replies and 0% loss mean your device reaches the router, so your local network works. time is the round trip: typically 1 to 5 ms to a home router, and 10 to 50 ms or more to a website on the internet.
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:

Example output from a Windows PC, written for this lesson
C:\>ipconfig
Wireless LAN adapter Wi-Fi:

   Autoconfiguration IPv4 Address. . : 169.254.37.12
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :
Find the problem before you answer the first question below.

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.

Predict · scenario 1

In the ipconfig output above, what went wrong?

Predict · scenario 2

In the office above, printing works but no websites load. Which device should you check first?

Predict · scenario 3

A laptop at 192.168.1.20/24 sends a packet to 192.168.1.30. Where does it send the frame?

Predict · scenario 4

Your browser opens https://example.com. Which roles are they playing?

FAQ

Is the internet a network?
Yes. It is a network of networks: tens of thousands of provider and company networks, with hundreds of millions of home networks attached, all connected by routers. They can work together because they all use the same protocols, mainly IP.
Is Wi-Fi the same as the internet?
No. Wi-Fi (IEEE 802.11) is only the wireless link between your device and your local network. Your router then connects that network to the internet through your internet service provider (ISP).
Do I need a router to build a network?
Not for a single local network: a switch, or even one cable between two computers, is enough. You need a router when your network has to reach another network, such as the internet.