Lesson 01 beginner

Introduction to Computer Networks

What a network is, the parts every network has, how data travels as packets, the PAN, LAN, MAN and WAN scales, how the internet is stitched together, and the first commands to see your own network.

A computer network is two or more devices connected so they can exchange data. Your laptop and the Wi-Fi router form one. A data center with fifty thousand servers is one. The internet is a network of networks: tens of thousands of independently run networks that agree to carry each other’s traffic.

Everything you do online, from loading this page to pushing code, is the same thing underneath: one program sends bytes, the network carries them, another program receives them.

The parts every network has

PartWhat it isExamples
NodesAnything that sends, receives or forwards dataLaptops, phones, servers, printers, routers
LinksThe path between two nodesCopper cable, fiber, radio (Wi-Fi, 5G)
ProtocolsThe agreed rules for talkingEthernet, IP, TCP, DNS, HTTP
AddressesHow nodes find each otherMAC addresses, IP addresses, port numbers

A node that only sends and receives for itself is a host (or end system). A node that passes traffic along for others is an intermediate device: a switch, a router, a firewall.

Data travels in packets

The network never sends a 2 GB file as one block. The data is cut into small pieces, usually up to about 1,500 bytes each on Ethernet, and every piece carries a header with the destination address. This is packet switching, and it has three big advantages:

  • Sharing. Packets from thousands of conversations take turns on the same link, so nobody holds a cable for themselves.
  • Resilience. If a link fails, routers send the next packets another way.
  • Efficiency. A silent conversation uses no capacity at all.

The old telephone network did the opposite, circuit switching: a dedicated path was reserved end to end for the whole call, used or not. Lesson 6 compares the two in more detail.

Network sizes

TypeCoversTypical example
PAN (personal area)A few meters around one personPhone to earbuds over Bluetooth
LAN (local area)A home, office floor or buildingOffice Ethernet and Wi-Fi
CAN (campus area)Several buildings of one ownerUniversity or factory site
MAN (metropolitan area)A cityA city fiber ring linking offices
WAN (wide area)Countries and continentsA company network linking branches, the internet

Two more terms you will meet: a WLAN is a wireless LAN, and an SD-WAN is a WAN whose paths (fiber, broadband, 5G) are chosen by software policy instead of fixed configuration.

Who talks to whom

  • Client-server. Clients ask, a server answers. Your browser and a web server, your mail app and a mail server. Easy to secure and manage centrally.
  • Peer-to-peer. Every node is both client and server. BitTorrent, some video call paths and blockchain networks work this way. No central point of failure, but harder to control.

Most real systems mix both: a video call uses a server to set up the call and then tries to send the media directly between peers.

How the internet is put together

Your home router connects to an ISP (internet service provider). Your ISP connects to bigger providers and to internet exchange points (IXPs), buildings where hundreds of networks plug into shared switches to swap traffic cheaply. Each independently run network is an autonomous system (AS) with its own number, and they announce to each other which addresses they can reach using BGP (lesson 12).

$ whois -h whois.radb.net 1.1.1.1 | grep -E '^(route|origin)'
route:          1.1.1.0/24
origin:         AS13335

That output says the block 1.1.1.0/24 is announced by autonomous system 13335, which belongs to Cloudflare.

Measuring a network

MeasureMeaningUnit
BandwidthMaximum capacity of a linkbits per second (Mbit/s, Gbit/s)
ThroughputWhat you actually get end to endbits per second
LatencyTime for one packet to arrivemilliseconds
Round-trip time (RTT)There and back againmilliseconds
JitterHow much latency variesmilliseconds
Packet lossShare of packets that never arrivepercent

Bits, not bytes. Network speeds are quoted in bits per second. A “1 Gbit/s” link moves at most 125 megabytes per second, and less in practice because every packet also carries headers.

See your own network

Three commands show you where you are. On Linux:

$ ip -brief address
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp3s0           UP             192.168.1.42/24 fe80::3a2c:4aff:fe1b:9c10/64
$ ip route show default
default via 192.168.1.1 dev enp3s0 proto dhcp metric 100
$ ping -c 3 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=57 time=11.8 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=57 time=12.1 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=57 time=11.6 ms

--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 11.6/11.8/12.1/0.2 ms

Read it like this: the interface enp3s0 has the address 192.168.1.42, traffic for anywhere else goes to the router at 192.168.1.1, and a public server answers in about 12 ms with no loss.

On Windows, the same information comes from:

PS> ipconfig
PS> Get-NetRoute -DestinationPrefix 0.0.0.0/0
PS> Test-Connection 1.1.1.1 -Count 3

Quick reference

TaskLinuxWindows
Show addressesip -brief addressipconfig
Show the default gatewayip route show defaultGet-NetRoute -DestinationPrefix 0.0.0.0/0
Test reachabilityping -c 3 <host>Test-Connection <host> -Count 3
Your public IPcurl -s https://ifconfig.mecurl.exe -s https://ifconfig.me
Who owns an addresswhois <ip>(web whois)

Exercise

A company links its offices in Lisbon, São Paulo and Toronto over leased lines. What kind of network is that?

  1. LAN
  2. PAN
  3. WAN
  4. CAN
Show answer

Answer: C. Offices on different continents are connected by a wide area network. A LAN stays inside one building or site.

Exercise

Your provider sells you a “500 Mbit/s” plan. What is the best download rate you can expect in megabytes per second?

  1. About 60 MB/s, since 500 bits divided by 8 is 62.5 and headers take a little more
  2. 500 MB/s
  3. 4,000 MB/s
  4. 50 MB/s, because one byte is ten bits
Show answer

Answer: A. A byte is 8 bits, so 500 Mbit/s is at most 62.5 MB/s. Protocol headers use a few percent, so real downloads land just under 60 MB/s.

Exercise

Why does the internet use packet switching instead of reserving a circuit for every conversation?

  1. Packets are always faster than circuits
  2. Circuits cannot carry digital data
  3. Packet switching guarantees no packet is ever lost
  4. Links are shared between many conversations and traffic can reroute around failures
Show answer

Answer: D. Packet switching shares capacity and survives broken links. It does not promise delivery; protocols like TCP add that on top.

Key takeaways

  • A network is nodes, links, protocols and addresses.
  • Data is cut into packets, each with its own header, and packets share links.
  • PAN, LAN, MAN and WAN describe scale; the internet is a network of autonomous systems.
  • Bandwidth is capacity, throughput is what you get, latency is delay.
  • ip address, ip route and ping are your first three tools.

FAQ

Is the internet the same as the web?

No. The internet is the global network that carries packets. The web is one application that runs on top of it, using HTTP. Email, SSH, video calls and DNS use the internet too, without being the web.

What is the difference between bandwidth and speed?

Bandwidth is how much data a link can carry per second, like the width of a pipe. What people feel as “speed” is a mix of throughput and latency. A link with huge bandwidth but 300 ms of latency still feels slow for interactive work.

Why does my ping show ttl=57?

TTL (time to live) starts at a value set by the sender, often 64, and every router on the path subtracts one. Seeing 57 means the reply crossed about seven routers. Lesson 7 covers the TTL field.

Do I need Linux to follow this course?

No, but it helps. Every lesson shows Linux commands, and Windows equivalents where they differ. A free Linux virtual machine, WSL on Windows or a cheap cloud server works fine.

↑ ↓ navigate Enter open Esc close