IP addresses, subnets, ports, TCP vs UDP, and practical tools: curl, netcat, and nmap.
Learn the core concepts of TCP/IP and Ports and apply them in practical exercises.
# IPv4: 4 octets, each 0-255 192.168.1.100 10.0.0.1 ← private (10.x.x.x) 172.16.0.1 ← private (172.16-31.x.x) 192.168.0.1 ← private (192.168.x.x) 127.0.0.1 ← loopback (this machine) # IPv6: 128 bits 2001:0db8:85a3::8a2e:0370:7334 # Check your IP curl ifconfig.me # public IP ip addr show # local IPs (Linux) ipconfig # local IPs (Windows)
# Well-known ports 22 SSH 25 SMTP 53 DNS 80 HTTP 443 HTTPS 3306 MySQL 5432 PostgreSQL 6379 Redis 27017 MongoDB # Check open ports ss -tlnp # listening TCP ports nmap localhost # scan local ports # Test if a port is open nc -zv hostname 443 curl -v telnet://hostname:443
# TCP: connection-oriented, reliable
# - Handshake before data
# - Guarantees delivery and order
# - Used for: HTTP, HTTPS, SSH, databases
# UDP: connectionless, fast
# - No handshake, fire and forget
# - Faster, lower overhead
# - Used for: DNS, video streaming, gaming, VoIP
# Test TCP connection
curl -w 'Connected in %{time_connect}s\n' -o /dev/null -s https://github.com
Before moving on, confirm understanding of these key concepts: