How to Restart IP Forwarding on VPN Server on Mac

I have been running a VPN server on my Mac for a while now, per Donald Burr’s most awesome instructions here. One day while out and about I tried to use my VPN from my Mac and iOS devices only to discover that while I could connect and get an IP address internal to my network, I could not get outside to the Internet. I described the problem to Donald and he sent me the following instructions to restart IP forwarding on the VPN server. This fixed my problem in a snap, hope it helps you too.

Try running the following commands in terminal on the VPN server. You’ll have to do this when you’re next at home obviously. Note: replace “INTERFACE” with “en0” if your machine is hardwired (ethernet) or “en1” if it’s on wifi.

sudo sysctl -w net.inet.ip.fw.enable=1
sudo sysctl -w net.inet.ip.forwarding=1
sudo natd -interface INTERFACE
sudo ipfw add divert natd ip from any to any via INTERFACE

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top