A solid understanding of TCP/IP networking is essential for managing servers. This guide covers the key concepts every VPS administrator needs to know, from IP addressing to the TCP handshake.
The TCP/IP Model
# Four layers:
# Application — HTTP, SSH, DNS, SMTP (your applications)
# Transport — TCP (reliable), UDP (fast) — ports
# Internet — IP addressing, routing
# Link — Ethernet, ARP — physical connectionIP Addressing
# IPv4 address: 198.48.63.50 (32-bit, ~4.3 billion addresses)
# IPv6 address: 2001:db8::1 (128-bit, virtually unlimited)
# Subnet notation (CIDR):
# 198.48.63.32/27 = 32 addresses (198.48.63.32 - 198.48.63.63)
# 10.0.0.0/24 = 256 addresses (10.0.0.0 - 10.0.0.255)
# 10.0.0.0/16 = 65,536 addresses
# Private IP ranges (not routable on internet):
# 10.0.0.0/8 (10.0.0.0 - 10.255.255.255)
# 172.16.0.0/12 (172.16.0.0 - 172.31.255.255)
# 192.168.0.0/16 (192.168.0.0 - 192.168.255.255)TCP vs UDP
# TCP (Transmission Control Protocol):
# - Reliable delivery (guaranteed order, retransmission)
# - Connection-oriented (3-way handshake)
# - Used for: HTTP, SSH, SMTP, databases
# 3-way handshake: SYN -> SYN-ACK -> ACK
# UDP (User Datagram Protocol):
# - No guaranteed delivery
# - Connectionless (fire and forget)
# - Lower latency, less overhead
# - Used for: DNS, VPN (WireGuard), video streaming, gamingPorts
# Well-known ports (0-1023): require root
# 22 — SSH
# 25 — SMTP
# 53 — DNS
# 80 — HTTP
# 443 — HTTPS
# 3306 — MySQL
# 5432 — PostgreSQL
# 6379 — Redis
# Check listening ports
ss -tlnp
# Check if a specific port is open
nc -zv server-ip 80DNS Resolution
# How DNS works:
# 1. Client asks: "What is the IP of example.com?"
# 2. Recursive resolver checks cache, then queries root servers
# 3. Root server points to .com TLD servers
# 4. TLD server points to example.com nameservers
# 5. Authoritative nameserver returns the IP
# DNS commands
dig example.com # Query DNS
dig example.com +short # Just the IP
dig example.com MX # Mail servers
dig example.com NS # Name servers
nslookup example.com # Simple lookup
host example.com # Even simplerRouting
# View routing table
ip route show
# Default route (gateway to the internet)
ip route | grep default
# default via 198.48.63.33 dev eth0
# Trace the path to a destination
traceroute example.com
# Or with MTR (combines ping and traceroute)
mtr example.comNetwork Configuration Commands
# View network interfaces
ip addr show
# View specific interface
ip addr show eth0
# Add an IP address
sudo ip addr add 10.0.0.2/24 dev eth0
# View ARP table (IP to MAC mappings)
ip neigh show
# View network statistics
ip -s link show eth0