Skip to content

Instantly share code, notes, and snippets.

@brez
Last active August 29, 2015 14:26
Show Gist options
  • Save brez/207c431b609cb2ff2310 to your computer and use it in GitHub Desktop.
Save brez/207c431b609cb2ff2310 to your computer and use it in GitHub Desktop.
Totally untested but something like..
iptables -t nat -I OUTPUT --dest ! [GOOGLE ADDRESS] -p tcp --dport 80 -j DNAT --to-dest [IP ADDRESS TO SEND TO]
Notes:
1) Note the ! that is the traditional NOT that you have come to love in most programming languages
2) You can specity a range of addresses like 123.123.0.0/16, which is heavy binary crunching saying 123.123.*.*
3) Make sure iptables is enabled (sudo iptables -L)
4) Since you're hacking on the kernel firewall, sudo is required for everything
5) Getting the correct ip address(es) for google may prove to be tricky
6) Iptables adds won't survive a reboot without proper set, internet will tell you how to do that..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment