Skip to content

Inspecting local connectivity

Module
Basic Connectivity and Remote Access
Difficulty
Easy
Updated
Tested on
Ubuntu 24.04.5 LTS (two lab containers), GNU Bash 5.2.21
On this page

A connection fails, but you do not yet know whether Linux has an address, which route it would use, or whether the other machine answers. Changing settings before reading them makes the original problem harder to understand.

By the end, you can collect those observations without changing network configuration. You can also explain why a ping reply and a listening-service report answer different questions.

Finish Network vocabulary for Linux users. Work locally in ~/lab, from the B04 setup. The commands here are read-only.

The recording uses the prepared two-container lab: learner@rootvolt is local and learner@labserver is the server console. Its private Docker bridge connects two containers; it is not a home network. To reproduce the server commands, you need that prepared lab or a server you control with a known hostname and console access. Your VM does not automatically have a host called labserver.

Your IP and MAC addresses, interface names and indexes, routes, ports, and ping times will differ. Compare the fields and relationships rather than copying these values into settings.

Terminal window
ip address
ip route
Local interfaces and routes
learner@rootvolt:~/lab$ ip address1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0@if80: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 3e:4b:05:54:f3:21 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.19.0.3/16 brd 172.19.255.255 scope global eth0
       valid_lft forever preferred_lft foreverlearner@rootvolt:~/lab$ ip routedefault via 172.19.0.1 dev eth0 
172.19.0.0/16 dev eth0 proto kernel scope link src 172.19.0.3 learner@rootvolt:~/lab$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, GNU Bash 5.2.21. The local eth0 interface has an IPv4 address, a connected route, and a separate default route through the Docker gateway.
Steps (6)
  1. Type ip address
  2. Press Enter
  3. Output: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0@if80: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 3e:4b:05:54:f3:21 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.19.0.3/16 brd 172.19.255.255 scope global eth0 valid_lft forever preferred_lft forever
  4. Type ip route
  5. Press Enter
  6. Output: default via 172.19.0.1 dev eth0 172.19.0.0/16 dev eth0 proto kernel scope link src 172.19.0.3

Start with the interface headings. lo is loopback; its 127.0.0.1 address refers to this container. The other heading is eth0@if80 in this capture. eth0 is the local interface name, and the suffix describes its virtual peer relationship. You do not need to type the suffix as part of the interface name.

Look under eth0 for inet, which introduces an IPv4 address. inet6 introduces IPv6. The /16 after the captured IPv4 address is a network prefix length, describing the network portion of the address. It is not a port number. The link/ether line contains the MAC address, a separate link-layer identifier.

The UP and LOWER_UP flags describe the interface’s administrative and lower-layer state. They do not prove that a distant service works. Here, the non-loopback address and route using eth0 identify the interface relevant to the lab connection. On a VM with several adapters, inspect the route for your destination rather than assuming the first listed interface is the right one.

The default route begins with default. Its via field names the next-hop gateway; dev names the outgoing interface. The second line is a connected-network route. The server’s captured address falls in that network, so the more specific connected route applies instead of the default.

These key values repeat the wide output in a narrow form:

Field Captured value and role
Local IPv4 address 172.19.0.3/16 on eth0
Default route via 172.19.0.1 dev eth0
Connected network 172.19.0.0/16 dev eth0
Connected route source 172.19.0.3

You have inspected configuration, not tested delivery. A route can exist while a cable, gateway, firewall, or destination prevents communication. Do not add or delete routes for this exercise.

Terminal window
getent hosts labserver
ping -c 3 labserver
ss -ltn

getent hosts asks the configured host-name lookup system for the name. In this prepared lab, Docker DNS supplies the server address. ping sends ICMP echo requests, which are reachability probes rather than TCP connections. -c 3 limits the run to three requests instead of leaving it running.

Predict: if all three requests receive replies, does that establish that SSH accepts a login?

Run it, then compare with your guess
Resolve, probe, and inspect local listeners
learner@rootvolt:~/lab$ getent hosts labserver172.19.0.2      labserverlearner@rootvolt:~/lab$ ping -c 3 labserverPING labserver (172.19.0.2) 56(84) bytes of data.
64 bytes from labserver.rootvolt-lab (172.19.0.2): icmp_seq=1 ttl=64 time=0.709 ms
64 bytes from labserver.rootvolt-lab (172.19.0.2): icmp_seq=2 ttl=64 time=0.161 ms
64 bytes from labserver.rootvolt-lab (172.19.0.2): icmp_seq=3 ttl=64 time=0.061 ms

--- labserver ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2027ms
rtt min/avg/max/mdev = 0.061/0.310/0.709/0.284 mslearner@rootvolt:~/lab$ ss -ltnState   Recv-Q   Send-Q     Local Address:Port      Peer Address:Port  Process  
LISTEN  0        4096          127.0.0.11:34055          0.0.0.0:*              learner@rootvolt:~/lab$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, GNU Bash 5.2.21. The server resolves and answers three ICMP probes; the following ss command lists the local machine's TCP listeners.
Steps (9)
  1. Type getent hosts labserver
  2. Press Enter
  3. Output: 172.19.0.2 labserver
  4. Type ping -c 3 labserver
  5. Press Enter
  6. Output: PING labserver (172.19.0.2) 56(84) bytes of data. 64 bytes from labserver.rootvolt-lab (172.19.0.2): icmp_seq=1 ttl=64 time=0.709 ms 64 bytes from labserver.rootvolt-lab (172.19.0.2): icmp_seq=2 ttl=64 time=0.161 ms 64 bytes from labserver.rootvolt-lab (172.19.0.2): icmp_seq=3 ttl=64 time=0.061 ms --- labserver ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2027ms rtt min/avg/max/mdev = 0.061/0.310/0.709/0.284 ms
  7. Type ss -ltn
  8. Press Enter
  9. Output: State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 4096 127.0.0.11:34055 0.0.0.0:*

No. The capture records three transmitted packets, three received packets, and zero percent loss. It tests ICMP replies, not a TCP port, SSH host identity, or account authentication.

The destination resolves to 172.19.0.2 here. The reply times are measurements for this private-container run, not performance targets. A reply demonstrates that a request and response traveled successfully at that moment.

An unanswered ping alone does not prove a host is down. ICMP can be filtered or disabled while a service remains reachable. A missing reply can also have several other causes. This capture received replies; it does not contain a staged timeout or blocked-ICMP experiment.

Check listeners on the machine that owns them

Section titled “Check listeners on the machine that owns them”

ss reports socket information. The options in ss -ltn mean listening (-l), TCP (-t), and numeric addresses and ports (-n). Running it locally inspects local sockets. It does not query the server’s sockets through the network. In the recording, the local table has one row: 127.0.0.11 on a high port, Docker’s internal name resolver inside the lab container. Nothing on the local machine listens on port 22 or 80.

Use the server console, learner@labserver:~$, for the same command:

Terminal window
ss -ltn
Server console: TCP listeners
learner@labserver:~$ ss -ltnState   Recv-Q   Send-Q     Local Address:Port      Peer Address:Port  Process  
LISTEN  0        4096          127.0.0.11:45901          0.0.0.0:*              
LISTEN  0        128              0.0.0.0:22             0.0.0.0:*              
LISTEN  0        5                0.0.0.0:80             0.0.0.0:*              
LISTEN  0        128                 [::]:22                [::]:*              learner@labserver:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS (lab server console), GNU Bash 5.2.21. The server's own console shows TCP listeners on ports 22 and 80; this is server-side evidence, separate from the local ping.
Steps (3)
  1. Type ss -ltn
  2. Press Enter
  3. Output: State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 4096 127.0.0.11:45901 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 5 0.0.0.0:80 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:*
Server local endpoint Meaning in this capture
0.0.0.0:22 SSH listens on all IPv4 addresses
[::]:22 SSH also has an IPv6 listening socket
0.0.0.0:80 The lab web server listens on IPv4 port 80
127.0.0.11:45901 Docker’s internal resolver-related listener; its port varies

The wildcard peer * is not a connected client. These rows are listening sockets waiting for connections. Their presence does not prove that traffic from another machine can pass every firewall. A real client request is the next test; the following lesson retrieves a page from port 80.

Looking for the server’s port 22 in local ss output. Read the prompt first. Local and server socket tables belong to different machines, even though both use the account name learner.

Reading state UNKNOWN on loopback as a failed internet connection. Loopback has no ordinary physical carrier state. Read the relevant non-loopback interface and route instead.

Treating zero packet loss as a complete service test. It describes these ICMP requests. It says nothing about whether an SSH account can authenticate.

Goal: A server console shows a port-80 listener, but ping gets no answers. State what is established and choose the next useful test.

Solution

The server has a local TCP listener. The ping observation establishes no ICMP replies for that attempt. Neither proves the web service is reachable from the client. Try a web request from the client and inspect its result; do not conclude the server is down from ping alone.

The probe finished after three requests. No files, background commands, or network settings were changed. The recorded reset returns to the local starting directory:

Terminal window
cd ~/lab
pwd
Return to the unchanged local directory
learner@rootvolt:~/lab$ cd ~/lablearner@rootvolt:~/lab$ pwd/home/learner/lablearner@rootvolt:~/lab$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, GNU Bash 5.2.21. The read-only exercise ends in the original local practice directory with no network configuration changes.
Steps (5)
  1. Type cd ~/lab
  2. Press Enter
  3. Type pwd
  4. Press Enter
  5. Output: /home/learner/lab
  • Read the interface’s address separately from its MAC address and state.
  • The default route is a fallback; a connected route can be more specific.
  • Ping tests ICMP replies, and silence alone does not prove a host is down.
  • Run ss on the machine whose listeners you need to inspect.

Next, Retrieving content tests the lab web service and saves a response.