Skip to content

Instantly share code, notes, and snippets.

@danibram
Created February 3, 2016 12:03
Show Gist options
  • Select an option

  • Save danibram/d00ed812f2ca6a68758e to your computer and use it in GitHub Desktop.

Select an option

Save danibram/d00ed812f2ca6a68758e to your computer and use it in GitHub Desktop.
Redirect 443,80 to 8443,8080 on ubuntu with persistence
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443
sudo sh -c "iptables-save > /etc/iptables.rules"
sudo apt-get install iptables-persistent
@greg-peters
Copy link
Copy Markdown

#allows localhost traffic to connect to 443 from 8443
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 8443

@sarnobat
Copy link
Copy Markdown

sarnobat commented Jan 8, 2025

Very helpful, thank you.

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