Try Firewall Lab free in your browser, with nothing to install and no account. Write the rules for a firewall, then run a day of traffic against them: the class loading its website, logging in, playing a game, and an attack trying to get in. Each packet stops at the first rule that matches it. Six networks teach default deny, rule order, outbound rules and what no rule can stop. Your rules come out as a real ufw script for Ubuntu.