Skip to content

Instantly share code, notes, and snippets.

@denisshevchenko
Last active December 9, 2015 04:40
Show Gist options
  • Save denisshevchenko/4910e8f38b6eebe1649a to your computer and use it in GitHub Desktop.
Save denisshevchenko/4910e8f38b6eebe1649a to your computer and use it in GitHub Desktop.
# Rule: all outgoing requests to :80 -> 127.0.0.1:4444
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:4444
# Rule: all outgoing requests to www.zalora.com.tw:80 -> 127.0.0.1:4444
sudo iptables -t nat -A OUTPUT -p tcp -d www.zalora.com.tw --dport 80 -j DNAT --to-destination 127.0.0.1:4444
# Delete these rules
sudo iptables -t nat -D OUTPUT -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:4444
sudo iptables -t nat -D OUTPUT -p tcp -d www.zalora.com.tw --dport 80 -j DNAT --to-destination 127.0.0.1:4444
# View all rules
sudo iptables -t nat -L -n -v
# Delete all rules
sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo iptables -X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment