Anime-Sanctuary

The words: IP, DNS, domain, port, firewall

IP, DNS, port, firewall: these words feel scary because you hear them without ever seeing them. Here, you see them: five simple pictures, seven commands, and none of these words will trip you up again.

Course
Tutorial 4 of 35
Time
20 min to read
Tested with
Debian 13.7 (trixie); iproute2 6.15.0, curl 8.14.1, dig 9.20.30
What you will be able to do
  • Explain in one sentence: IP address, domain, DNS, port, firewall.
  • Follow a web request from the domain to the server.
  • Display a machine's IP address, open ports and DNS answer.
  • Test whether a site answers, using curl.

Before you start: VPS or dedicated server: which one to pick?.

Contents
  1. The problem: a name typed, a page received
  2. Before you start
  3. 1. The IP address
  4. 2. The domain and the DNS
  5. 3. The port
  6. 4. The firewall
  7. 5. A request from start to finish
  8. The five words at a glance
  9. If it fails
  10. Sources
Close-up of blue, yellow, green and red Ethernet network cables plugged into a switch.

The problem: a name typed, a page received

When you type example.org into a browser, a page shows up within a second. Your browser sent a request, a polite "please send me this page" addressed to a server. Yet you didn't type a single number, even though machines on the Internet find each other by numbers. Five things work quietly between your keyboard and the server:

  • an IP address;
  • a domain name;
  • a DNS;
  • a port;
  • a firewall.

Three of these words already came up in the previous article, VPS or dedicated server: which one to pick? (IP address, port, firewall).

Let's reuse that article's picture: a VPS is a flat, a dedicated server is a house, and each has its own IP address. We'll follow the page's path one word at a time. Where does the machine live? How do we find it by name? Which door do we knock on? Who guards the entrance? Each word gets its picture and its command. But first, we need to set the stage.

Before you start

The commands in this article only read information, except for installing four small tools. A command is a line of text typed into a terminal, the window where you run a machine by typing. You can try them on any Debian computer, or on your rented server. Its remote console (the emergency screen your hosting provider shows on its website, available with both kinds of plan, depending on the provider) gives you a terminal. With no server yet, just read the outputs. Install Debian 13 on a VPS or a dedicated server will get you one.

The next command installs four packages, which are ready-to-install programs. It needs administrator rights. If you are root (the all-powerful user), type it as it is. Otherwise, put sudo in front: it's the command that lends you administrator rights. For the details, see Users, sudo and file permissions.

On the server, as root (or put sudo in front)
apt-get install -y iproute2 curl bind9-dnsutils ca-certificates

Each package has a job:

  • iproute2 brings the ip and ss commands;
  • curl knows how to talk to a website;
  • bind9-dnsutils brings dig, which queries the DNS;
  • ca-certificates lets curl check encrypted sites, the ones whose traffic is scrambled so that only the recipient can read it.

The tools are ready. Let's start with the first question: where does a machine live?

Row of six numbered mailboxes (14, 16, 18, 20, 28, 26) on a wooden stand, in front of plants.

1The IP address: a machine's postal address

An IP address is the number that identifies a machine on a network, the way a postal address identifies a home. It comes in two formats that live side by side.

  • IPv4: four numbers from 0 to 255 separated by dots, for example 203.0.113.10. This address is reserved for examples. It points to no real machine, and yours will be different.
  • IPv6: a longer format, with digits, letters and colons, created because IPv4 addresses are running out.

An address is also public or private:

  • A public address can be reached from the whole Internet. That is the address of your rented server.
  • A private address only works inside a local network, like the one behind your home router, the box your Internet provider gave you.

Private addresses most often start with 10. or 192.168..

To see the machine's addresses, type the next command. An option is a setting added after the command. Here, -br ("brief") gives one line per network connection.

On the server
ip -br addr
Expected output
lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP             203.0.113.10/24

Two lines. The first, lo, is the machine talking to itself: 127.0.0.1 means "me". The second, eth0, is the real connection, with the example address. That is the machine's number. But nobody wants to memorize a number, so we need to call the machine by name.

2The domain and the DNS: the name and the phone book

A domain name is a readable name, like example.org, that replaces the IP address in everyday life. It is the name on the shop sign: easier to remember than the street number. But machines only understand numbers. The DNS (domain name system) sits between the two: it's the phone book that turns a name into an IP address. On every visit, your browser asks it "what is the address of example.org?", and the DNS answers with a number.

Let's see what that looks like. Take example.org, the example domain we already used. The dig command queries the DNS, and the +short option prints only the answer.

On the server
dig +short example.org
Expected output
172.66.157.237
104.20.26.136

The DNS answered with two IPv4 addresses. One name can lead to several addresses, which is common for big sites, and their order changes from one try to the next. Your addresses may differ. If dig prints nothing, jump to the "If it fails" section. We can now find the right machine. But it runs several services, so we still have to pick the right door.

3The port: the doors of a home

An IP address points to a whole home, but that home holds several services. A port is a door number: each service listens behind its own door, and there are 65,535 of them per address. Don't confuse it with the connection speed (in Gbit/s) from VPS or dedicated server: which one to pick?. Here, "port" always means port number.

Three doors are worth knowing. The table sums them up.

PortService
22SSH: running the server remotely
80HTTP: the unencrypted web
443HTTPS: the encrypted web

To list the doors with someone listening behind them, use ss -tln. Its options ask for the services waiting for visitors, with their port numbers.

On the server
ss -tln
Expected output
State  Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*
LISTEN 0      128             [::]:22           [::]:*

Two lines, for the same service. SSH listens on port 22, first over IPv4 (0.0.0.0 means "all addresses"), then over IPv6 ([::]). On your machine, the list depends on what is running. If it is empty, nobody is listening yet. But a listening door is not necessarily open to everyone, because someone can guard it.

4The firewall: the guard at the entrance

A firewall is a guard posted in front of the home's doors. It lets traffic through or blocks it, based on the port number. When someone knocks on a blocked door, it can react in two ways:

  • it can reject the caller: an immediate "no";
  • it can ignore the caller: no answer, and the caller waits.

We won't install a firewall here. We'll just watch both reactions at a closed door. For that, curl plays the browser from the terminal, with three options.

OptionRole
-sTurns off the progress messages
-IAsks only for the header of the reply, its first lines of information
-m 5Gives up after five seconds

Every program also leaves a small number behind when it finishes: the exit code. It is 0 if all went well, and something else if not. The ; echo "code de sortie : $?" part prints it after curl (the French words mean "exit code").

Let's ask curl to knock on port 81 of your own machine, where nobody is listening.

On the server
curl -sI -m 5 http://localhost:81 ; echo "code de sortie : $?"
Expected output
code de sortie : 7

The answer is instant, with code 7: the connection is refused. That is the immediate "no". A firewall that rejects would give the same result. Now let's knock on door 81 of someone else's site, example.org.

On the server
curl -sI -m 5 https://example.org:81 ; echo "code de sortie : $?"
Expected output
code de sortie : 28

Silence for five seconds, then code 28, which means "timed out". You have seen both reactions: the immediate "no", and the silent wait, just like a firewall that ignores you. This test proves nothing about the firewall on the other side, or about yours.

Each word now has its place. Time to watch them work together, from the start to the end of one request.

5A request from start to finish

When you open a site, four steps put the five words to work. First comes the domain you type, then the DNS that gives the IP address, then the firewall that lets port 443 through, and finally the server that answers. The diagram below shows that trip to example.org.

The trip of a web request Four steps: you type example.org, the DNS gives the address 104.20.26.136, the firewall lets port 443 through, the server sends the page. 1. You type example.orgthe domain name 2. The DNS answers104.20.26.136, the IP address 3. The firewall checksport 443: allowed, it passes 4. The server answersit sends back the page you asked for
Text equivalent: you type example.org. The DNS turns that name into an IP address, for example 104.20.26.136 (read on November 4, 2026). Your request goes to that address, on port 443. Nothing blocks that door, as the 200 reply below shows. The server answers with the page.

Let's redo that trip by hand with curl and its -s and -I options, which you already know. The | sign sends the output of the first command into the second, here head -n 3, which keeps only the first three lines.

On the server
curl -sI https://example.org | head -n 3
Expected output
HTTP/2 200
date: Wed, 04 Nov 2026 22:53:40 GMT
content-type: text/html; charset=utf-8

The first line matters. HTTP is the language that browsers and sites use to talk, and code 200 means "all good". The DNS found the address, door 443 was open, and the server answered. The date changes on every try. Here is the whole picture in one table.

The five words at a glance

WordPictureCommand
IP addressThe home's postal addressip -br addr
DomainThe name on the shop signNone: it is the name you type
DNSThe phone book of addressesdig +short example.org
PortThe door numberss -tln
FirewallThe guard at the entrancecurl -sI -m 5 http://localhost:81 (instant refusal) and curl -sI -m 5 https://example.org:81 (silence)

If it fails

If one of these tests doesn't give the expected output, here are the three most common errors.

  • dig +short prints nothing and gives your prompt back. The name does not exist, or the DNS is not answering. Check the spelling: with an invented name like nexiste-pas.example.org, the reply is empty, with no error message.
  • curl prints curl: (6) Could not resolve host (without the -s option), or exit code 6 with it. curl couldn't find the address for that name, for the same reason as above. Code 28 means the address was found but nobody answers on that port.
  • dig: command not found: the bind9-dnsutils package is missing. Install it with the command from the "Before you start" section.

You now have the words to understand a connection. To run a server remotely, you need to know how to connect to it, and that is the subject of What is SSH?.