192.168.0.X dev.mydomain.com
192.168.0.4 dev.supersite.com
sudo ifconfig lo0 192.168.0.X alias
sudo ifconfig lo0 192.168.0.4 alias
/etc/pf.anchors/com.myworld
rdr pass on lo0 inet proto tcp from 192.168.0.X to self port 80 -> 127.0.0.1 port XXXX
rdr pass on lo0 inet proto tcp from 192.168.0.4 to self port 80 -> 127.0.0.1 port 8081
- Add rdr-anchor below the
rdr-anchor
of Apple
rdr-anchor "com.apple/*"
rdr-anchor "port80"
- Add load anchor below the Apple one
load anchor "port80" from "/etc/pf.anchors/com.myworld"
If macOS refuse to forwards IPs you can enable IP forwarding with:
sudo sysctl net.inet.ip.forwarding=1
Simply run:
sudo pfctl -ef /etc/pf.conf
sudo pfctl -f /etc/pf.conf