A firewall decides which connections may come in. Ubuntu's is ufw. Once it's on, it lets in only the new connections its rules allow, and silently drops the rest. Pings still get through.
New command
sudo ufw status
Shows whether the firewall is on, and its rules.
Usagesudo ufw status
text
learner@web:~$ sudo ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere ← ssh may come in, from anywhere
80/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)A dropped connection gets no answer at all, so the sender waits: it times out. nc waits over two minutes; -w 3 gives up after 3 seconds:
text
learner@ops:~$ nc -zv -w 3 web 8080
nc: connect to web (10.0.0.10) port 8080 (tcp) timed out: Operation now in progressEach failure points somewhere else:
- Network is unreachable: no route (Chapter 3).
- No route to host: nothing answers at that address (Chapter 1's Destination Host Unreachable).
- Connection refused: the machine answered, but no program listens on that port and address.
- Timed out: something on the way dropped it, often a firewall.
Objectives
- Refused, or timed out?
- What web's firewall lets in.