Skip to content

Instantly share code, notes, and snippets.

@thoward
Created August 7, 2013 21:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thoward/24b0102355331dd6dd3b to your computer and use it in GitHub Desktop.
Save thoward/24b0102355331dd6dd3b to your computer and use it in GitHub Desktop.
iptables 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