Skip to content

Instantly share code, notes, and snippets.

@debashisbarman
Forked from Bostonncity/forwardport.sh
Created May 15, 2020 10:43
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save debashisbarman/7892a3b76a42a64f30cfa19f7d56c5b0 to your computer and use it in GitHub Desktop.
Save debashisbarman/7892a3b76a42a64f30cfa19f7d56c5b0 to your computer and use it in GitHub Desktop.
Forward port 80 to 8080 on EC2 instance.
sudo iptables -t nat -L
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
@unimonkiez
Copy link

To remove

sudo iptables -t nat -D PREROUTING 1

@Edweis
Copy link

Edweis commented Jan 13, 2021

I think you mean

sudo iptables -t nat -L
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 # 8080 -> 8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment