Skip to main content

iptables as firewall

  • Setup iptables as a firewall.
  • Drop packages from INPUT chain by default.
  • However, we have to allow response packages and requests to local DNS cache.
iptables -P INPUT DROP
iptables -I INPUT 1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT 2 -p icmp -j ACCEPT
iptables -I INPUT 3 -p udp --dport 53 -j ACCEPT