I struggled to find a simple guide to setting up local lan based routing on Mac OS X.
Finally got it working and thought it might help someone.
- MacMini (OSX) connected via ethernet to router.
- MacMini internal IP address 192.168.0.2 (setup with ipforwarding and interface routing)
- MacMini ZeroTier IP address 10.0.0.2
- Various other local computers / printers / NAS drives etc on 192.168.0.0/24 network
Using ZeroTier to connect various devices MacBook, iPad, iPhone to Home Network.
ZeroTier set up on 10.0.0.0/24 range
Setup ZeroTier network as needed on the computers/laptop/iPhone etc
Set up Managed Routes for the network on my.zerotier.com
On Mac mini set ip IP Forwarding:
sudo sysctl -w net.inet.ip.forwarding=1
Check the network interfaces on Mac mini by running ifconfig and checking for the right interface ids, (mine are en0 for the lan and feth3632 for zerotier)
On Mac mini set up Interface Routing:
create /etc/pfzerotier.conf and add the following line (editing the interface ids)
nat on en0 from feth3632:network to any -> (en0)
sudo pfctl -d
sudo pfctl -e -f /etc/pfzerotier.conf
Test on one of the external devices, (eg iPhone) you should now be able to reach any local IP address on your home network.
Hope this helps.