Skip to content

Instantly share code, notes, and snippets.

@intrd
Last active April 28, 2017 15:34
Show Gist options
  • Save intrd/1822496093fd081e309c339e4edc01a6 to your computer and use it in GitHub Desktop.
Save intrd/1822496093fd081e309c339e4edc01a6 to your computer and use it in GitHub Desktop.
Forward a remote site:port to a localhost:port
#!/bin/sh
# Forward a remote site:port to a localhost:port
# @author intrd - http://dann.com.br/
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
iptables -F
iptables -t nat -F
iptables -X
sysctl -w net.ipv4.conf.all.route_localnet=1
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 34.198.94.240:32914
iptables -t nat -A POSTROUTING -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment