How to Troubleshoot Server Network Problems on Linux
Normally, Linux network commands will try to answer only one problem at a time: Does the server have an IP address? Is there a route set up? Are the DNS services fine? Is the port open? Running these commands in this order usually narrows a "server is down" report to one layer within minutes.
Below you will find the most useful diagnostic commands in that same order, from the server's own interface out to the application. They work on Ubuntu and Debian; sometimes a tool needs to be installed first, and each section names the package.
Linux network commands at a glance
| Question | Command |
|---|---|
| Which addresses does the server have? | ip -br addr |
| Which way does traffic leave? | ip route |
| Does a name resolve, and to what? | dig example.com +short |
| Can I reach the host at all? | ping -c 4 example.com |
| Where on the path does it break or slow down? | mtr -rwc 50 example.com |
| Which ports are listening? | sudo ss -tulpn |
| Does the service answer? | curl -I https://example.com |
| How fast is the link? | iperf3 -c host |
Step 1: interfaces and addresses with the ip command
ip command supersedes ifconfig command and tells you all about interfaces, address, and routing table. The brief view is the quickest check:
ip -br addr
ip -br link
Look for the public interface in state UP with the expected address. DOWN or a missing address points to the server's network configuration, not the wider network. On Ubuntu Server, the configuration will be found in NetPlan files at /etc/netplan/; to make changes use sudo netplan apply.
Step 2: routes and the default gateway
ip route
ip route get 1.1.1.1
The ip route command will list the routes table, and the default via line is your gateway. If you need to find which interface and source IP your kernel would choose for a destination, the ip route get command shows it, which helps eliminate "wrong interface" problems on servers with many IPs.
Step 3: DNS resolution
resolvectl status
dig example.com +short
dig @1.1.1.1 example.com +short
resolvectl status shows what DNS servers the server is using. If dig using your setup for resolving does not work but dig @1.1.1.1 works, the problem is with the resolver, not the network. dig can be found inside dnsutils (sudo apt install dnsutils if it is missing).
Step 4: reachability and the path
ping -c 4 example.com
tracepath example.com
mtr -rwc 50 example.com
ping lets you know if the response exists and time spent for round-trip. Some servers do not respond to pings, so no reply shouldn’t be treated as proof the server is down. tracepath will give you all the hops that the request had to traverse. mtr is a combination of both techniques and uses multiple queries at hops level to give you the loss and delay per hop statistics. This is the information required when making contact to the provider; install it with sudo apt install mtr-tiny. Loss reported at one hop but not further down the path probably means that router de-prioritizes probe packets, not real loss.
If you want to check the same path in reverse, run tests from our end. The latency checker gives you the Round Trip Time between our OrbitServers locations and your IP address as well as to any host you want to specify. The looking glass runs network tests from our network.
Step 5: ports and connections with the ss command
The ss command replaced netstat:
sudo ss -tulpn
ss -tn state established
The first command returns both listening TCP/UDP ports and their associated processes. A service bound to 127.0.0.1 can be reached only from within the server, which explains many "it works locally but not from outside" reports. The second command shows all the current TCP connections being made. If remote clients still cannot connect even though the port is open, check the firewall with sudo ufw status. Our guide to enabling and securing SSH on Ubuntu covers the firewall rules for SSH.
Step 6: does the service answer?
curl -I https://example.com
curl -o /dev/null -s -w 'dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s total %{time_total}s\n' https://example.com
nc -zv example.com 443
Output from curl -I contains only the response headers. The -w timer splits a slow request into four sections – DNS, TCP connect, TLS handshake and total – so you can see which stage is slow. The nc -zv tool checks whether a TCP port accepts connections, for services that do not speak HTTP.
Step 7: throughput
ping is for measuring delay, not bandwidth. To measure bandwidth, use iperf3 on two machines you control:
iperf3 -s # on the receiving machine
iperf3 -c receiver.example.com -P 4 -t 30 # on the sender
The result is explained by our 10Gbps dedicated server guide in relation to your port speed.
Old command, new command
| Old (net-tools) | Modern equivalent |
|---|---|
ifconfig |
ip addr |
route -n |
ip route |
netstat -tulpn |
ss -tulpn |
arp -a |
ip neigh |
sudo apt install net-tools will still install the old utilities; however, current scripts and manuals use ip and ss.
Want a go on a blank canvas? An OrbitServers VPS runs Ubuntu 22.04/24.04/26.04, so all commands provided here work from log-in onward.
Was this article helpful?
Written by Julius · Product Manager