Linux Basics: Inspecting Network Addresses and Ports
Inspect the network configuration before changing settings. Debian and Ubuntu provide ip and ss through the iproute2 package. These read-only commands normally work without sudo.
List interfaces and addresses
ip -brief address showThe brief view lists interface names, states, and addresses. Find the interface connected to your network; names vary across machines.
lo is the loopback interface, used for communication within the machine. An address such as 127.0.0.1 does not identify the machine to other devices on your network.
An interface being up does not prove that internet access works. Address assignment, routing, name resolution, and remote availability are separate parts of a connection.
Inspect routes
ip route show
ip -6 route showThe first command shows IPv4 routes; the second shows IPv6 routes. A route marked default is used when no more specific route matches the destination. It may name a gateway and an outgoing interface.
A missing default route can matter for reaching other networks, but it does not prevent every kind of local communication.
Find listening TCP ports
ss -ltn-l selects listening sockets, -t selects TCP, and -n keeps addresses and ports numeric. Inspect the local address and port to see where a service is listening.
A listener does not prove that a remote client can reach it. Firewall rules and routing still matter, and a loopback-only listener is local to the machine.
Inside a container, these commands describe its network namespace, which may differ from the host’s.
References
Debian ip manual and ss manual
Acknowledgements
This post was created with assistance from AI.
Linux Basics — lesson 19 of 25. Series index
Previous: Checking Services and Logs · Next: Managing Packages with apt