NIS and Linux Networking

What are the best networking tools for Linux?

Compare useful networking tools on Linux, from ip and ss to ping, tcpdump, mtr and Wireshark, and what each one is best for when troubleshooting.

On this page
  1. There is no single best tool
  2. Interfaces, addresses and routes
  3. Reachability and the path
  4. DNS checks
  5. Packets and traffic
  6. Ports and services
  7. Speed and link health
  8. Quick reference
  9. Choosing the right tool
  10. Summary

There is no single best tool

The best networking tool on Linux depends on the question you are trying to answer. Is the host reachable? Which process is listening on a port? Why is DNS slow? What is crossing the wire? Most administrators keep a small set of tools for these jobs rather than relying on one program.

Below are the tools most people reach for first, grouped by task.

Interfaces, addresses and routes

The ip command, from the iproute2 package, shows and changes interfaces, addresses, routes and neighbours. Examples include ip addr for addresses and ip route for the routing table. Older tutorials use ifconfig and route from net-tools, but the ip command is the usual choice on current systems.

The ss command lists sockets. For example, ss -tulpn shows listening TCP and UDP sockets along with the process that owns each one. It replaces netstat for most uses. Process names usually need root privileges.

Reachability and the path

ping sends ICMP echo requests and reports whether a host answers and how long the reply takes. Some hosts block ICMP, so a failed ping does not always mean the host is down.

traceroute and tracepath show the hops between you and a destination. mtr combines ping and traceroute and keeps updating the results, which helps when a problem comes and goes.

DNS checks

dig gives detailed answers from DNS servers and is the tool most people use when they need to see records and response times. host gives short answers and is quick for simple lookups. nslookup still appears in many guides, but dig is more precise.

Packets and traffic

tcpdump captures packets from the command line. It is useful on servers, where you may not have a desktop. Wireshark does the same job with a graphical interface, and its command-line companion, tshark, is handy for scripted captures.

Capture traffic only on networks and systems you are authorized to monitor. Captured packets can include sensitive data.

Ports and services

nc, also called netcat, can test whether a TCP port accepts connections. It is a simple way to check a service from another machine.

nmap scans hosts and ports, and it can identify services. Scan only systems you own or have permission to test, because scanning other networks can cause trouble even when no harm is intended.

iperf3 measures throughput between two hosts that you control. Run a server on one machine and a client on another, then compare the results with what you expect from the link.

ethtool shows link speed, duplex and driver settings for an interface. It is useful when a cable, port or switch setting may be limiting performance.

Quick reference

Tool Main use
ip Interfaces, addresses and routes
ss Listening and open sockets
ping Reachability and latency
mtr or traceroute Path and hop checks
dig DNS records and response times
tcpdump or Wireshark Packet capture and analysis
nc Testing a TCP port
nmap Port and service scanning on systems you are allowed to scan
iperf3 Throughput between two hosts
ethtool Link speed and driver settings

For a broader overview of everyday commands, read What are 10 common network commands? next. For ongoing monitoring rather than one-off checks, the question What are the best monitoring tools for monitoring networks? is the right place to go.

Choosing the right tool

Start with the simplest tool that answers your question. If the host does not respond to ping, check the route and the DNS name before you assume the network is broken. If the host responds but a service does not, check the listening socket and the firewall. Move to packet capture only when the higher-level checks do not explain the problem.

Many free tools cover these jobs. Before you install one, check its license and whether it suits your environment. Wireshark is a common example: Is Wireshark free to use? Yes, its core features are free under an open source license.

Summary

Linux has no single best networking tool. The most useful set covers interfaces with ip, sockets with ss, reachability with ping and mtr, DNS with dig, packets with tcpdump or Wireshark, ports with nc and nmap, and speed with iperf3 and ethtool. Choose the tool that matches the question, and use scanning and capture only where you have permission.

The complete guide to nis and linux networking

Network Information System (NIS) in Linux Explained
Read the guide

Keep exploring

Guides from other topics

All topics →