Common Ports

20-21 FTP (Data/Control)
22 SSH
23 Telnet
25 SMTP
53 DNS
67-68 DHCP (Server/Client)
80 HTTP
110 POP3
143 IMAP
443 HTTPS
3306 MySQL
5432 PostgreSQL
6379 Redis
8080 HTTP Alt

Subnetting Quick Reference

/32 = 1 host 255.255.255.255
/31 = 2 hosts 255.255.255.254 (P2P)
/30 = 4 hosts (2 usable) 255.255.255.252
/29 = 8 hosts (6 usable) 255.255.255.248
/28 = 16 hosts (14 usable) 255.255.255.240
/27 = 32 hosts (30 usable) 255.255.255.224
/26 = 64 hosts (62 usable) 255.255.255.192
/25 = 128 hosts (126 usable) 255.255.255.128
/24 = 256 hosts (254 usable) 255.255.255.0
/16 = 65,536 hosts 255.255.0.0
/8 = 16,777,216 hosts 255.0.0.0

Private IP Ranges (RFC 1918)

10.0.0.0/8 Class A (16M hosts)
172.16.0.0/12 Class B (1M hosts)
192.168.0.0/16 Class C (65K hosts)
169.254.0.0/16 Link-Local (APIPA)
127.0.0.0/8 Loopback

Diagnostic Commands

ping <host> Test connectivity
ping -c 4 <host> Ping 4 times
traceroute <host> Trace route (Linux)
tracert <host> Trace route (Windows)
mtr <host> Combined ping/traceroute
nslookup <domain> DNS lookup
dig <domain> DNS query
dig +short <domain> Short DNS answer
host <domain> Simple DNS lookup
whois <domain> Domain info

Network Info

ip addr Show IP addresses (Linux)
ip route Show routes (Linux)
ip link Show interfaces (Linux)
ifconfig Show interfaces (legacy)
netstat -tuln Listening ports
ss -tuln Listening ports (modern)
arp -a ARP table
ip neigh ARP table (modern)

Connection Testing

nc -zv <host> <port> Test TCP port
nc -zuv <host> <port> Test UDP port
telnet <host> <port> Test TCP connection
curl -I <url> HTTP headers
curl -v <url> Verbose HTTP
wget --spider <url> Check URL exists

Packet Capture

tcpdump -i eth0 Capture on interface
tcpdump -i eth0 port 80 Capture port 80
tcpdump -i eth0 host 10.0.0.1 Capture host
tcpdump -w capture.pcap Write to file
tcpdump -r capture.pcap Read from file
tcpdump -n No DNS resolution

Firewall (iptables)

iptables -L -n -v List rules
iptables -A INPUT -p tcp --dport 22 -j ACCEPT Allow SSH
iptables -A INPUT -j DROP Drop all input
iptables -F Flush all rules
iptables-save > rules.txt Save rules
iptables-restore < rules.txt Restore rules