Skip to content

Instantly share code, notes, and snippets.

@yihyang
Forked from thekalinga/change-ip-tables.sh
Created April 23, 2020 10:39
Show Gist options
  • Save yihyang/0eb5fda3ad86303358cdf8c41bb07022 to your computer and use it in GitHub Desktop.
Save yihyang/0eb5fda3ad86303358cdf8c41bb07022 to your computer and use it in GitHub Desktop.
AWS redirect port 80 -> 8080
iptables --insert INPUT --protocol tcp --dport 80 --jump ACCEPT
iptables --insert INPUT --protocol tcp --dport 8080 --jump ACCEPT
iptables --table nat --append PREROUTING --in-interface eth0 --protocol tcp --dport 80 --jump REDIRECT --to-port 8080
# run next line to have changes survive reboot
service iptables save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment