Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zjor/e2adc8406366cd9a9d4d599e57d29a4a to your computer and use it in GitHub Desktop.
Save zjor/e2adc8406366cd9a9d4d599e57d29a4a to your computer and use it in GitHub Desktop.
Challenges - The Iptables Command: Lab 1

iptables challenges 101

  1. Write the iptables commands that set the default POLICY to ACCEPT on INPUT and OUTPUT chains and DROP on FORWARD chain.
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
  1. Write the iptables command that lists only the filter table of INPUT chain.
iptables -t filter -vnL
  1. Write the iptables commands that list the nat table.
iptables -t nat -vnL
  1. Write the iptables command that flushes the filter table of all chains.
iptables -t filter -F
  1. Write an iptables rule that drops all incoming packets to port 22/tcp (ssh). This should be the first rule in the chain.
iptables -t filter -I INPUT -p tcp -dport 22 -j DROP
  1. Write the iptables commands that flush all the tables of all chains and set the ACCEPT policy on all chains. This will delete any firewall.
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
iptables -t raw -F

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment