File exists when pushing route with OpenVPN

by dippynark   Last Updated July 12, 2019 13:00 PM - source

I am trying to configure OpenVPN for access to a remote network ( 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"

Unfortunately I see the following when connecting:

route: writing to routing socket: File exists
add net gateway File exists

due to an existing route, presumably due to static DHCP routes:

$ netstat -nr -f inet
Routing tables

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 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
  • OpenVPN version: 2.3.14

Related Questions

Should I use tap or tun for openvpn?

Updated March 31, 2015 16:00 PM

OpenVPN UDP and TCP Traffic Fowarding

Updated April 01, 2015 18:00 PM

OpenVPN not working well on specific ISPs

Updated April 11, 2015 21:00 PM