Linux Labs

Networking / Stage 5 of 14

Who is listening on a port

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 9 · on a machine · 4 min

The site answers only itself

What you will learn

  • Find the program, address and port of a listening socket in the output of ss.
  • Explain who can connect to a socket on 127.0.0.1, on an interface address and on 0.0.0.0.
  • Change the address a program listens on and check the result from the side that needs it.

A practice site was set up on the lab-server server on port 8080. The administrator checked on the server itself, and the page opens. From the lab-client client it does not. Compare the two requests.

curl requests a page at an address and prints it. Start on the card builds the client and the server.

Exercise · look

The same site from two sides

Request the site on the server itself at 127.0.0.1:8080, then from the client at the server's address, 192.0.2.10:8080.

First, predict

On the server the page opens. What will the client get at the server's address, 192.0.2.10:8080?

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 was the client refused while the page opened on the server?

  • The site is running: on the server curl http://127.0.0.1:8080/ still prints ports-lab-ok.

  • The server is visible on the network: sudo ip netns exec lab-client ping -c 1 192.0.2.10 gets a reply.

  • curl on the client runs under sudo, with the same rights as on the server.

The site opened its socket on 127.0.0.1:8080, and nobody listens on port 8080 at 192.0.2.10.

Ubuntu 24.04
Loading…