Create a gist now

Instantly share code, notes, and snippets.

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