Mastering Network Tools
Linux Mastery: Essential Linux Tools and Techniques: Part 4 of 6
Whether you’re managing a fleet of servers or just trying to troubleshoot a misbehaving connection, understanding the right tools can make all the difference. Here’s your guide to the essential network utilities every Linux sysadmin should have in their toolkit.
Socket and Connection Monitoring
ss
– Socket Statistics
Forget netstat
; ss
is the modern way to check socket statistics. It’s faster and more reliable.
ss -tuln
This command shows all listening TCP and UDP sockets.
lsof
– List Open Files
In UNIX, everything is a file, including network sockets. Use lsof
to see which processes are using which ports.
lsof -i :80
This command lists all processes using port 80.
Network Scanning and Discovery
nmap
– Network Mapper
Need to discover hosts and services on a network? nmap
is your go-to tool.
nmap -sV 192.168.1.0/24
ping
– Send ICMP Echo Requests
A classic tool to check if a host is reachable.
ping 8.8.8.8
fping
– Fast Ping
Need to ping multiple hosts at once? fping
does that efficiently.
fping -a -g 192.168.1.0/24
arp
– View ARP Table
Inspect IP to MAC address mappings in your local network.
arp -a
Packet Capture and Analysis
tcpdump
– Command-Line Packet Analyzer
Capture and analyze network traffic in real-time.
tcpdump -i eth0
wireshark
– GUI Packet Analyzer
For a graphical interface, wireshark
provides detailed packet analysis. Filter by protocol, IP, port, and more.
tshark
– Command-Line Version of Wireshark
Great for scripting or when working in terminal-only environments.
tshark -i eth0
Route and Path Tracing
traceroute
– Trace Packet Path
Identify the path packets take to a destination.
traceroute example.com
mtr
– My Traceroute
Combines ping
and traceroute
into one tool.
mtr example.com
ip route
– Routing Table
View or modify the system’s routing table.
ip route
DNS Query and Name Resolution
dig
– Domain Information Groper
Query DNS records for a domain.
dig example.com
host
– Simple DNS Lookup
A simpler alternative to dig
.
host example.com
nslookup
– DNS Tool
Another common tool for name resolution.
nslookup example.com
Interface and IP Configuration
ifconfig
– Legacy Interface Configuration
Still used in some environments.
ifconfig eth0 up
ip
– Modern Interface and Routing Tool
The replacement for ifconfig
.
ip addr show
ethtool
– Ethernet Device Settings
View or change low-level NIC settings.
ethtool eth0
iwconfig
– Wireless Interface Configuration
Configure wireless networking interfaces.
iwconfig wlan0 essid "NetworkName"
nmcli
– NetworkManager CLI
Manage connections on systems using NetworkManager.
nmcli dev status
System Identity and Naming
hostname
– Show or Set Hostname
hostname
Displays the current system hostname.
hostname new-hostname
Sets the hostname.
Bonus Tools for Power Users
fping
– Faster alternative toping
for many hosts.mtr
– Combinesping
andtraceroute
.lsof
– See which processes are using which ports.tshark
– CLI version of Wireshark.ethtool
– Ethernet interface diagnostics.nmcli
– Great for GUI-enabled environments.arp
,host
,nslookup
– Lightweight, effective alternatives to heavier tools.
Wrapping Up
Each tool here solves a specific piece of the network puzzle. Mastering them means less guessing and more understanding when you’re under pressure. Keep this guide handy, and dig deeper into each tool’s man page when you need advanced usage.
Happy hunting.