← Networking and Remote Servers from Zero
How the internet finds things: ip addr, ping, nslookup, dig and traceroute

Lesson 1 of 6

How the internet finds things: ip addr, ping, nslookup, dig and traceroute

Learn how IP addresses and DNS work, and use five commands to read your own address, test a connection, look up names and follow the route to a server.

The idea in plain words

An IP address is a street address: every device on a network has one. A domain name such as example.com is a name in a phone book, and DNS is the phone book itself, turning the name into the address.

A ping is a shout across the street asking whether anyone is there, and a reply tells you the line works. The route is the path a letter takes through sorting offices before it arrives, which is what traceroute shows you.

Commands in this lesson

ip addr
Show the network addresses of your own computer. On macOS use ifconfig, on Windows use ipconfig.
ping -c 3 example.com
Send three small messages to a server and report the reply times. On Windows use ping -n 3.
nslookup example.com
Ask DNS for the address behind a name. It also works on Windows.
dig +short example.com
Ask DNS and print only the answer. Add a record type such as MX to see where email goes.
traceroute example.com
List every hop a message takes to reach a server. On Windows use tracert.

Written notes from the video

Why this matters

When you type a web address, how does your computer know where to go? This is Networking and Remote Servers from zero, episode one: how the internet finds things. Five commands that show you your own address, test a connection, look up names, and follow the route.

Real-life analogies

Let us start with everyday versions. An IP address is a street address. Every device on a network has one. A domain name, like example.com, is a name in a phone book. DNS is the phone book. It turns the name into the address. A ping is a shout across the street: are you there? If someone answers, you know the line works. And the route is the path a letter takes, through sorting offices, before it arrives.

Command 1: ip addr

Command one: ip addr. It shows the network addresses of your own computer. Look for the line that starts with inet. That is your local address. Addresses starting with 192.168 are private. They only work inside your own network. On macOS use ifconfig, and on Windows use ipconfig.

Command 2: ping

Command two: ping. Ping sends a tiny message to another computer, and waits for a reply. Add -c 3 to send just three. Each line shows the reply, and the time in milliseconds. The summary tells you how many packets were lost. Zero percent means a healthy connection. No reply? The server might be down, or it might simply ignore ping. A missing reply does not always mean broken.

Command 3: nslookup

Command three: nslookup. It asks DNS for the address behind a name. The server line shows which DNS server answered. Here, it is your router. The answer is the address that example.com points to.

Command 4: dig

Command four: dig. It does the same job as nslookup, with more detail. Add +short to print only the answer. You can also ask for other record types, such as MX, which says where email goes.

Command 5: traceroute

Command five: traceroute. It shows every stop a message makes on its way to a server. Each line is a hop: a router passing your message along. The times show how long each hop took. A sudden jump tells you where the delay is. On Windows, the command is tracert.

Recap

Recap. ip addr shows your address. ping tests the connection. nslookup and dig turn names into addresses. And traceroute follows the route, hop by hop.

Next episode

Next episode: ports. You will learn how one computer runs many services at once, and how to see which ones are listening. Subscribe so you do not miss it, and find written notes for every lesson at changecv.com/skills.

Common questions

What is the difference between a public and a private IP address?

Private addresses, such as those starting with 192.168, 10 or 172.16 to 172.31, only work inside your own network. Your router has the public address that the rest of the internet sees, and it passes traffic to your devices.

Why does ping fail when the website opens in my browser?

Some servers and firewalls ignore ping, which uses a different kind of message from web pages. A missing ping reply does not always mean the server is down.

What does DNS do?

DNS is the system that turns a name such as example.com into an IP address. Your computer asks a DNS server, usually your router or your internet provider, and uses the answer to connect.

What is the difference between nslookup and dig?

Both ask DNS for an address. nslookup is available on Windows as well. dig gives more detail and cleaner output, and comes with most Linux and macOS systems.

Why do some lines in traceroute show asterisks?

A router on the way did not answer in time, often because it is set to ignore these messages. If the later hops still answer, the route is working.