I am trying to configure OpenVPN for access to a remote network (192.168.1.0/24) which is the same as my local network. Because of this I have added the following to the server config to force traffic through the VPN:
push "route 192.168.1.0 255.255.255.0"
Unfortunately I see the following when connecting:
route: writing to routing socket: File exists add net 192.168.1.0: gateway 10.200.0.5: File exists
due to an existing route, presumably due to static DHCP routes:
$ netstat -nr -f inet Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire ... 192.168.1 link#6 UCS 4 0 en0 ! ...
If I connect and disconnect from OpenVPN this existing route is cleared so when I reconnect everything works. How can I configure OpenVPN so that this route is configured properly on first connect? I do not want to rely on a local DHCP configuration so I need to either need to clear the problematic route or replace it when connecting.
Note: I also tried setting
push "redirect-gateway def1" in the server config, but again due to this existing route traffic for 192.168.1.0/24 is not routed through the VPN.
uname -a: Darwin Lukes-Work-MBP 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64