Skip to content

Instantly share code, notes, and snippets.

@spy86
Created November 25, 2018 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spy86/78498e9717b78ceca1d49c74163991cc to your computer and use it in GitHub Desktop.
Save spy86/78498e9717b78ceca1d49c74163991cc to your computer and use it in GitHub Desktop.
iptables settings to block udp other than dns
# allow dns requests to google nameservers
iptables -A OUTPUT -p udp --dport 53 -d 8.8.8.8 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -d 8.8.4.4 -j ACCEPT
# block all other udp
iptables -A OUTPUT -p udp -j DROP
ip6tables -A OUTPUT -p udp -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment