Hackbydoing Academy tool guide · Defense & blue team · free, no login
Iptables is the classic Linux firewall control: ordered chains of rules that accept or drop packets, checked top to bottom, first match wins.
sudo iptables -L -n --line-numbers
Lists the firewall's rule table with numbers on every rule and raw addresses (no name lookups), so you can point at the exact rule that is allowing or blocking traffic.
| -L | List the rules of the chain named after it (or every chain when none is named) instead of changing anything. |
| -n | Show numbers instead of names: IP addresses and port numbers, no reverse-DNS or service-name lookups slowing the listing down. |
| --line-numbers | Number every rule, so a later -D can delete a rule by its number. |
| -A | Append a rule to the chain named after it; the rest of the line describes the traffic it matches and the target (ACCEPT/DROP) jumps to it. |
| -I | Insert a rule at the position named after the chain, pushing the rules below it down — order matters because the first match wins. |
| -D | Delete a rule from the chain named after it, either by repeating the rule or by its line number. |
| -P | Set the chain's policy: what happens to a packet no rule matches, for example iptables -P INPUT DROP. |
Only run iptables on systems you own or have explicit, written permission to test — at work that means a signed engagement, at home that means your own lab. Inside Hackbydoing Academy you practice on simulated networks and lab machines built for exactly this, where breaking things is the lesson and no one else's systems are involved. Learning how a tool works also teaches you what it looks like from the defender's chair: the logs it leaves, the traffic it makes, and the settings that shut it down.
Reading about iptables is step one. In the Academy you run it yourself, step by step, in guided labs on simulated networks — 185 rooms covering attack and defense, from your first scan to full operations, with a defender's debrief at the end of every room. Founding membership is $9.99/mo for the first 500 members.
Join Hackbydoing Academy →Free from the Hackbydoing Academy — learn cybersecurity by doing: real tools, guided labs, attack and defense, on simulated networks. More free material: Tool Guides index · Free Downloads Library · Hackbydoing Academy · Print this page (Ctrl/Cmd+P) for a clean paper copy.