Every cloud service, container and website you will work with depends on a network. When a deployment fails with connection refused or timed out, you need to know where to look. Networking looks like a wall of strange letters at first, but the ideas are simple, and you can learn the useful part in a few lessons. This first one gives you the map: how data travels, what the layer models mean and what an IP address is.
Why do we need it?
Every cloud service, container and website talks over a network. When a deployment cannot connect, you need to know which layer to check. Without the basics, errors like timed out or connection refused are just noise.
A real-life example
Sending a letter has layers too. You write the letter (application), put it in an envelope with an address (network), the post office picks a truck (transport and link), and the road carries it (physical). If the letter is late, you check where it stopped. Network layers let you do the same with data.
What a network is
A network is a group of devices that can send data to each other. Your phone and laptop on home Wi-Fi are on a small network. The internet is a huge number of networks joined together. Data is cut into small pieces called packets. Each packet carries the address it is going to, the address it came from and a piece of the message. The network delivers packets, often by different routes, and the receiving device puts them back in order.
The OSI model: seven layers
To keep this manageable, network engineers describe the work in layers. Each layer does one job and relies on the layer below. The OSI model has seven layers. You do not need to memorise it for daily work, but interviewers like it, and it helps you to say where a problem is.
- Physical: cables, radio signals, the bits on the wire.
- Data link: moves data between devices on the same local network, using MAC addresses (the fixed hardware address of a network card). Switches work here.
- Network: moves packets between networks using IP addresses. Routers work here.
- Transport: manages the conversation between two programs: TCP (reliable) or UDP (fast). Ports live here.
- Session: keeps a conversation open.
- Presentation: formats and encrypts the data, for example TLS.
- Application: the protocols programs speak: HTTP, DNS, SSH, SMTP.
A useful way to remember the order is the phrase from the bottom: Please Do Not Throw Sausage Pizza Away. People like silly phrases, and any phrase that helps you is fine.
The TCP/IP model: four layers
The internet itself uses a simpler model with four layers. It is the one you will see in real life.
- Link: the local network (Wi-Fi, Ethernet).
- Internet: IP addresses and routing.
- Transport: TCP and UDP, with ports.
- Application: HTTP, HTTPS, DNS, SSH and so on.
OSI layers 5, 6 and 7 are all one Application layer in TCP/IP. In practice, when someone says layer 4 they mean transport, TCP and ports. When they say layer 7 they mean the application, for example HTTP. You will hear these terms when load balancers are described: a layer 4 load balancer looks only at addresses and ports, and a layer 7 load balancer can read the web request.
IP addresses
An IP address identifies a device on a network, like a house number in a street. There are two versions.
- IPv4 has four numbers from 0 to 255 separated by dots, for example
192.168.1.25. It has about 4.3 billion possible addresses, which are no longer enough for all devices. - IPv6 has much longer addresses written in hexadecimal with colons, for example
2001:db8::1. It has a gigantic number of addresses. Many networks run both at once.
Public and private IP addresses
A public IP address can be reached from the whole internet and is unique. Private addresses are for use inside a home, office or cloud network only. Many networks can reuse the same private addresses, because those addresses are never routed over the open internet. Three ranges are reserved for private use in IPv4.
10.0.0.0to10.255.255.255(written 10.0.0.0/8)172.16.0.0to172.31.255.255(written 172.16.0.0/12)192.168.0.0to192.168.255.255(written 192.168.0.0/16)
Your laptop probably has a private address such as 192.168.1.25. Your router has one public address, and translates between the two, using a technique called NAT that you will meet in a later lesson. Cloud networks use private ranges too, which is why you will choose ranges like 10.0.0.0/16 when you build a network in AWS.
What happens when you open a web page
- Your browser asks DNS for the IP address of the site name.
- It opens a TCP connection to that address on port 443 (HTTPS).
- TLS starts: the browser and the server agree on keys, and the browser checks the server’s certificate.
- The browser sends an HTTP request: GET this page.
- The server sends back the page, and the browser shows it.
Each of these steps can fail, and each failure looks different. A wrong name gives a DNS error. A closed port or a firewall gives connection refused or a timeout. A bad certificate gives a security warning. A broken application gives an error code such as 500. When you troubleshoot, work through the steps in order, and you will find the broken one.
Architecture diagram
Here is the idea as a simple picture. You can use the same diagram in your own notes.
flowchart TD
A[Application: HTTP, DNS, SSH] --> T[Transport: TCP or UDP and ports]
T --> I[Internet: IP address and routing]
I --> L[Link: Wi-Fi or Ethernet]
L --> P[Physical signal]
How to check it worked
- You can explain the difference between a public and a private IP.
- You can name what each of the four TCP/IP layers does.
- You can say which step failed if a page shows a certificate warning.
How companies use it
Engineers design cloud networks with private ranges, route traffic through gateways, and choose which ports are open. When an app cannot reach a database they walk through the layers: name, address, port, firewall, then application.
Common errors and how to fix them
- Connection timed out. Packets are being dropped, often by a firewall or a wrong route. Check security rules and routes.
- Connection refused. The machine is reachable but nothing listens on that port, or it listens only on 127.0.0.1.
- Name or service not known. DNS cannot resolve the name. Check spelling and the DNS server.
- Two networks cannot connect. Their private ranges overlap. Plan non-overlapping ranges before you build.
- Works by IP but not by name. This is a DNS problem, not a connection problem.
Best practices
- Plan private ranges before creating networks.
- Troubleshoot from the bottom up, one layer at a time.
- Document your address plan.
- Use private addresses for internal services.
- Learn the common ports by heart.
Interview questions with simple answers
- Name the layers of the TCP/IP model. Link, internet, transport and application.
- At which layer do routers work? The network layer, using IP addresses.
- What is an IP address? A number that identifies a device on a network.
- IPv4 vs IPv6? IPv4 has 32-bit addresses and is running out. IPv6 has 128-bit addresses and a huge space.
- What is a private IP address? An address for internal use, such as 10.x.x.x or 192.168.x.x, not routable on the internet.
- What is a MAC address? The hardware address of a network card, used inside a local network.
- What happens when you open a website? DNS lookup, TCP connection, TLS handshake, HTTP request, response.
- What is a packet? A small piece of data with source and destination addresses.
- Switch vs router? A switch joins devices in one network. A router joins different networks.
- What is a default gateway? The router a device uses to reach other networks.
Practical exercises
Try each one yourself before you look at the hint. Struggling for a few minutes is how the skill sticks.
- Find your private IP and say which private range it belongs to. Hint:
hostname -I. - Write the five steps of opening a web page and the layer of each. Hint: DNS, TCP, TLS, HTTP, response.
- Check which route your machine uses to reach the internet. Hint:
ip route. - Explain public vs private IP to a friend with a street example. Hint: House number inside an estate vs the estate address.
- List three problems that show up as timeouts. Hint: Firewall, route, host down.
Mini project: Home network map
Draw your home or office network: devices, private addresses, the router and the public address. Mark where NAT happens and which layer each device works at.
Knowledge test
Answer the ten questions in the quiz at the end of this lesson. You pass with 60 percent. If an answer is wrong, read the explanation, then reread the part of the lesson it points to.