Adding routing rule on macOS

After setting up StrongSwan, everything should be done, ie you can connect to the vpn server and the subnet behind. However, in some circumstance, the local subnet mask cover the remote subnet, ie the remote subnet is 192.168.55.0/24, while the local subnet is 192.168.0.0/32.

In this case, the packet which is intended go to remote 192.168.55.1 will go to local gateway. Therefore, we have to add a custom routing rule on the local 

mac os

  • First list the current routing tables by netstat -nr
  • Remove the existing one if any route delete 192.168.55.0/24
  • Add a new rule to route the traffic to vpn server route add 192.168.55.0/24 10.10.10.1 where 10.10.10.1 is the vpn gateway
Posted in notesTagged