Search code examples
linuxvpnopenvpnmacos-big-sur

Route internet traffic from the VM via openVPN in MacOS


My VPN allows only one connection to the VPN at a time.

Host OS : Mac OS Big Sur

VM: linux on VMWare Fusion

I wish to use the VPN on both.

I have tried adding route

sudo route -n add -net 10.0.0.0/8 192.168.11.1

Where 192.168.11.1 is the gateway ip of the VPN. However, this does not seem to work.

The VPN is on utun2 while the VM is on bridge100.

EDIT: Changing network adapter to NAT does not do the trick


Solution

  • Turns out there is an issue with Big Sur. It does not allow through traffic.

    As a temporary fix, ran the following commands:

    sudo pfctl -a com.apple.internet-sharing/shared_v4 -s nat 2>/dev/null >newrules.conf

    echo "nat on utun2 inet from 192.168.13.0/24 to any -> (utun2) extfilter ei" >>newrules.conf

    sudo pfctl -a com.apple.internet-sharing/shared_v4 -N -f newrules.conf 2>/dev/null

    Here 192.168.13.0/24 is the ip range where my VM is.

    This needs to run every time the VM is restarted.