Learn

Networking Essentials

DNS, TCP/IP, HTTP, ports, and the networking knowledge DevOps engineers need.

IP addresses and ports

Every machine on a network has an IP address. Every service on a machine listens on a port. Together, IP:port uniquely identifies a service.

bash
# See your IP addresses
$ ip addr show
$ hostname -I
 
# See what is listening on ports
$ ss -tlnp # modern
$ netstat -tlnp # older systems
$ lsof -i :80 # what is on port 80
 
# Common ports
# 22 SSH
# 80 HTTP
# 443 HTTPS
# 5432 PostgreSQL
# 6379 Redis

DNS

DNS translates domain names like thelastdeploy.com to IP addresses. Every network request starts with a DNS lookup.

bash
# Look up a domain
$ nslookup thelastdeploy.com
$ dig thelastdeploy.com
 
# Local DNS config
$ cat /etc/resolv.conf # DNS servers
$ cat /etc/hosts # Local overrides

HTTP

HTTP is the protocol that powers the web. Every request has a method, headers, and optionally a body. Every response has a status code.

Status codeMeaning
200 OKSuccess
201 CreatedResource created
301/302Redirect
400 Bad RequestClient error — bad input
401 UnauthorizedAuth required
403 ForbiddenAuth succeeded but no permission
404 Not FoundResource does not exist
500 Internal Server ErrorServer-side bug
502 Bad GatewayUpstream service failed
503 Service UnavailableService overloaded or down