Skip to content

Networking Commands

The old note mixed outdated and current tools from several sources. This version keeps the same topic in a clean style with an emphasis on modern Linux commands.

Interfaces and Addresses

ip a
ip -br a
ip link
ip addr show dev eth0
hostname -I

Legacy fallback on older systems:

ifconfig -a

Routes

ip r
ip route get 8.8.8.8
route -n
traceroute 8.8.8.8
tracepath 8.8.8.8

Sockets and Listening Ports

ss -tulpn
ss -tan
ss -lun
netstat -rn
netstat -tulpn

ss is preferred over netstat on modern Linux systems.

Basic Reachability

ping -c 4 1.1.1.1
ping -c 4 google.com
nc -vz example.com 443
telnet example.com 25
curl -I https://example.com

DNS Commands

dig example.com
dig example.com +short
dig MX example.com +short
dig @1.1.1.1 example.com
host example.com
nslookup example.com
resolvectl query example.com

ARP and Neighbors

ip neigh
arp -an

Packet Capture

tcpdump -i eth0
tcpdump -nn -i eth0 port 53
tcpdump -nn -i any host 10.0.0.10

Port Scanning and Security Testing

nmap -sn 10.0.0.0/24
nmap -p 22,80,443 example.com
nmap -sC -sV example.com
nmap --script ssl-enum-ciphers -p 443 example.com

Run nmap only where you have permission to scan.

Useful Config Files

  • /etc/hosts
  • /etc/resolv.conf
  • /etc/services
  • /etc/networks
  • /etc/hostname

Practice

  • On Linux, start with ip, ss, resolvectl, and tcpdump.
  • Keep legacy tools such as ifconfig, route, and netstat as fallbacks for older systems.
  • Separate name resolution, routing, and port issues: these are different layers of problems.