Skip to content

Instantly share code, notes, and snippets.

@Marko-M
Last active May 7, 2016 07:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Marko-M/2f72080ba103611fe819 to your computer and use it in GitHub Desktop.
Save Marko-M/2f72080ba103611fe819 to your computer and use it in GitHub Desktop.
Forward Vagrant forwarded ports to standard ports using iptables
#!/bin/bash
# Forward relevant Vagrant forwarded ports to standard ports using iptables (adjust 8080, 8443).
# To make persistent install and use "iptables-persistent" package. Just do a
# "sudo iptables-persistent save" and service will reload saved rules on each boot.
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 443 -j REDIRECT --to-ports 8443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment