Skip to content

Instantly share code, notes, and snippets.

@fabslab
Created October 11, 2015 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabslab/fea7d2f5d48f8f2127c5 to your computer and use it in GitHub Desktop.
Save fabslab/fea7d2f5d48f8f2127c5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Re-route HTTP port 80 to 8080
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
# Re-route HTTPS port 443 to 8443
iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8443 -j ACCEPT
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment