Created
November 23, 2015 12:45
-
-
Save leemour/06232d23eae462b5bda9 to your computer and use it in GitHub Desktop.
Iptables redirect port 3000 to port 80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000 | |
# sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3000 | |
sudo iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-port 3000 | |
# Save iptables to file | |
sudo bash -c "iptables-save -c > /etc/iptablesrc" | |
# Apply localhost redirect saved in iptablesrc on system start | |
# sudo bash -c "iptables-restore < /etc/iptablesrc" | |
alias iptrest='sudo bash -c "iptables-restore < /etc/iptablesrc"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment