Skip to main content

File exists when pushing route with OpenVPN [Resolved]

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

Question Credit: dippynark
Question Reference
Asked July 13, 2019
Tags: , openvpn, mac-osx
Posted Under: Network
1 Answers

Solved using redirect-gateway with the block-local flag, essentially blocking all connections to the local network and routing all traffic through the VPN server to the remote network.

credit: Lenniey
Answered July 13, 2019
Your Answer