Common Linux Network Troubleshooting Commands

Applies to: RHEL-family Linux — RHEL 6–10 / Rocky Linux 8–10 / AlmaLinux 8–10 / CentOS 6–8 / CentOS Stream 8–10

Linux includes a small set of command-line tools that can quickly answer the most common network troubleshooting questions: Is the interface up? Is there a route? Is the remote host reachable? Is the port listening? Is DNS resolving correctly?

The original version of this article used tools such as netstat, arp, and telnet. Those commands are still useful in older environments, but current RHEL-family systems primarily use ip, ss, ip neigh, nmcli, and tools such as nc or curl.

In This Article

1. IP Address and Interface Status

Display interfaces and assigned IP addresses:

ip addr
ip link

On NetworkManager-based systems, this is also useful:

nmcli device status
nmcli device show

2. Routing

Display the routing table:

ip route

Check which route Linux would use for a specific destination:

ip route get 192.0.2.10

3. Reachability

Use ping for a basic ICMP reachability test:

ping -c 4 192.0.2.10
ping -c 4 example.com

A failed ping does not always mean the remote host is down. ICMP can be blocked by a firewall while the application service itself remains reachable.

To see the path toward a destination:

traceroute example.com

4. Listening Ports and Connections

Use ss instead of netstat on current systems:

ss -tuln
ss -tulnp

The second command also shows the process using each socket when you have sufficient permissions.

5. Test a Remote Port

Instead of using Telnet simply to test whether a TCP port is reachable, use nc:

nc -vz server.example.com 443

For HTTP and HTTPS services, curl provides a more useful application-level test:

curl -I https://server.example.com

6. DNS Lookups

Use dig for detailed DNS troubleshooting:

dig example.com
dig example.com MX
dig @192.0.2.53 example.com

nslookup is still available on many systems and is useful for quick interactive queries:

nslookup example.com

7. Neighbor Cache

Use ip neigh to view IPv4 ARP and IPv6 neighbor entries:

ip neigh

8. Hostname

Display the current hostname:

hostname
hostnamectl

On current RHEL-family systems, use hostnamectl or nmcli to change the persistent hostname instead of relying on the older hostname newname command:

hostnamectl set-hostname server01.example.com

9. Legacy Command Mapping

Legacy commandCurrent equivalent
ifconfigip addr / ip link
routeip route
arpip neigh
netstat -ntlss -ntl
netstat -ntlpss -ntlp
netstat -nulpss -nulp
telnet host portnc -vz host port

The older commands come mainly from the net-tools package. On current RHEL releases, net-tools is not installed by default, so learning the iproute2-based commands is the better long-term approach.

10. Key Takeaways

  • Use ip for interfaces, addresses, routes, and neighbor information.
  • Use ss for listening ports and active sockets.
  • Use nc or curl instead of Telnet for most connectivity tests.
  • Use dig for detailed DNS troubleshooting.
  • Keep legacy net-tools commands in mind when working with older Linux systems, but prefer the modern equivalents on current releases.

References

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.