0 / 15 lessons — 0%
Lesson 05 / 15
Networking basics
The old ifconfig/netstat toolkit is deprecated on modern distros — ip and ss replaced them, and both are worth knowing well.
# interfaces and addresses ip addr show # or: ip a ip route show # the routing table — where traffic actually goes # what's listening, what's connected ss -tulpn # TCP+UDP listeners, with process names ss -tan # all TCP connections, numeric
ss flag | Meaning |
|---|---|
-t | TCP sockets |
-u | UDP sockets |
-l | listening sockets only |
-p | show the process using each socket (needs sudo) |
-n | numeric — skip slow DNS/service-name lookups |
# quick reachability checks ping -c 4 example.com curl -I https://example.com # headers only, fast sanity check dig example.com # DNS resolution, in detail traceroute example.com # which hops the traffic passes through
Firewall rules on modern distros usually go through a friendlier front-end rather than raw iptables:
# Ubuntu's ufw — "uncomplicated firewall" sudo ufw allow 22/tcp sudo ufw allow 'Nginx Full' sudo ufw enable sudo ufw status # RHEL/Fedora's firewalld sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --reload
Enable SSH access before you enable the firewall — or the exact same command that locks down a fresh box can lock you out of it entirely if port 22 isn't already allowed.
Try it yourselfRun
ss -tulpn on any machine you manage and read through what's actually listening. It's a good gut-check for "is anything running on this box that shouldn't be."