Skip to content

Instantly share code, notes, and snippets.

@dekart
Last active August 29, 2015 14:01
Show Gist options
  • Save dekart/8dd552284c843dd456c0 to your computer and use it in GitHub Desktop.
Save dekart/8dd552284c843dd456c0 to your computer and use it in GitHub Desktop.
Iptables setup for port forwarding on local dev machine.
Should be added to /etc/network/if-pre-up.d/iptable_rules
Don't forget to run
chmod +x /etc/network/if-pre-up.d/iptable_rules
#!/bin/sh
iptables -t nat -A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 127.0.0.1:3000
iptables -t nat -A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:3001
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment