Skip to content

Instantly share code, notes, and snippets.

@tlwr
Created January 27, 2021 14:56
Show Gist options
  • Save tlwr/7e27440e3e88b372a8f8e2611d6fb0f9 to your computer and use it in GitHub Desktop.
Save tlwr/7e27440e3e88b372a8f8e2611d6fb0f9 to your computer and use it in GitHub Desktop.
iptables
iptables -A INPUT -i lo -j ACCEPT # Loopback
iptables -A INPUT -p icmp -j ACCEPT # ICMP
iptables -A INPUT -p tcp -m tcp --dport 2222 -m state --state NEW,ESTABLISHED -j ACCEPT # SSH port 2222
iptables -A INPUT -p udp -m state --state ESTABLISHED -j ACCEPT # DNS response
iptables -A INPUT -p tcp -m tcp -m state --state ESTABLISHED -j ACCEPT # Established TCP conns
iptables -A INPUT -j DROP # Drop remaining traffic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment