Linux Labs

Networking / Stage 9 of 14

Why the address works and the name does not

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 5 min

The site answers by address, not by name

What you will learn

  • Check which address the system finds for a name and where it looks for it.
  • Ask a DNS server directly and read its answer.
  • Fix the DNS server choice in the settings instead of working around it in /etc/hosts.

So far in this track, sites were opened by address. A colleague set up an internal site and writes: "It opens at 127.0.0.10, but not as web.lab.test. Can you take a look?" Compare the two requests yourself.

Start on the card brings the site up on this machine. curl requests the page at a URL and prints the site's answer.

Exercise · look

The site by address and by name

A colleague gave you the address and the name of an internal site. Request the /health page by address first, then by name.

First, predict

The site answers by address. What will the request by the name web.lab.test print?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why did the site answer by address while by name curl printed Could not resolve host?

  • The request by name never reached the site: curl found no address and did not start connecting.

  • The site runs on this very machine and answered by address without the internet. A name can be found without the internet too — from a DNS server on your own network.

  • A port accepts connections to an address and never sees the name. The request by name never reached the port.

Could not resolve host means curl got no address for web.lab.test and never reached the site.

Ubuntu 24.04
Loading…