Skip to content

Instantly share code, notes, and snippets.

@ionatan-israel
Created May 14, 2018 14:55
Show Gist options
  • Save ionatan-israel/62261c94bc5ff793071cbebda863147b to your computer and use it in GitHub Desktop.
Save ionatan-israel/62261c94bc5ff793071cbebda863147b to your computer and use it in GitHub Desktop.
Configurando port forwarding en MacOS
# Edito /etc/hosts
192.168.0.100 frontend.test
192.168.0.101 backend.test
# Asigno alias a lo0
sudo ifconfig lo0 192.168.0.101 alias
sudo ifconfig lo0 192.168.0.100 alias
# sudo nano /etc/pf.anchors/development.forwarding
rdr pass on lo0 inet proto tcp from any to 192.168.0.100 port 80 -> 127.0.0.1 port 3000
rdr pass on lo0 inet proto tcp from any to 192.168.0.101 port 80 -> 127.0.0.1 port 8000
# sudo nano /etc/pf-development.conf
rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/development.forwarding"
# Activar forwarding
sudo pfctl -ef /etc/pf-development.conf
# Desactivar forwarding
sudo pfctl -d
# Resetear la configuración de port forwarding en Mac OS
pfctl -F all -f /etc/pf.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment