Last active
August 29, 2015 14:04
-
-
Save benkahle/f25539344e4e9c47b3ec to your computer and use it in GitHub Desktop.
Commands to set up port redirection on ubuntu
This file contains 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
//list current rules | |
sudo iptables -t nat -L --line-numbers | |
//delete rule for port <n> | |
sudo iptables -t nat -D PREROUTING <n> | |
//redirect port 80 to port <n> | |
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port <n> | |
//Save settings (need package iptables-persistent installed) | |
sudo iptables-save >/etc/iptables/rules.v4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment