User Tools

Site Tools


Go Back

Recent Changes

Setup NAT on macOS

Enable IP forwarding on OSX

sudo sysctl -w net.inet.ip.forwarding=1

Edit /etc/pf.conf file. Forward packets from to en0

scrub on en0 reassemble tcp no-df random-id
nat on en0 from to any -> en0

Load PF config

# Disable PF if it was enabled before
sudo pfctl -d
# Enable PF and load the config
sudo pfctl -e -f /etc/pf.conf

Setup IP and gateway on client ( Linux )

sudo ip addr add dev eth0
sudo ip route add default via
macos/setup_nat.txt · Last modified: 2021/08/26 14:42 (external edit)