26

I would like my OpenVPN server to push a route down to the client with a different default gateway.

Specifically, my OpenVPN server has an internal IP address of 10.0.0.1, and I would like it to push a route of 10.10.10.1/24 using gateway 10.0.0.2.

Is it possible to do this by specifying a push route in the server config file?

6
  • Are you saying you want to push "route 10.10.10.0 255.255.255.0" to the client, and then the VPN clients traffic to have a different default gateway (10.0.0.2) on the VPN server network?
    – Drav Sloan
    Sep 17, 2013 at 16:02
  • @DravSloan I want the client to access IP addresses on the 10.10.10.0/24 network via 10.0.0.2, but I don't want to change any of the other routing behavior of the VPN. Sep 17, 2013 at 16:46
  • @josten I tried doing: push "route 10.10.10.1/24 255.255.255.255 10.0.0.2", no go. Sep 17, 2013 at 17:03
  • 2
    @LorinHochstein that should probably be push route "10.10.10.0 255.255.255.0 10.0.0.2 1"
    – Drav Sloan
    Sep 17, 2013 at 17:12
  • @josten Do you want post that answer, seeing as you suggested it (I just filled in the blanks...)
    – Drav Sloan
    Sep 17, 2013 at 18:12

1 Answer 1

32
push "route 10.10.10.0 255.255.255.0 10.0.0.2 1"

From the OpenVPN man page:

--route network/IP [netmask] [gateway] [metric]

This tells the server config to "push" to the client, the route command which sets a networking route of the 10.10.10.0/24 subnet via the gateway 10.0.0.2 with a metric of 1. Metrics are used to give "preference" if multiple routes exist (such that the lowest cost wins).

1
  • 4
    push route "10.10.10.0 255.255.255.0 10.0.0.2 1" made the openvpn parser crash. Had to specify push "route 10.10.10.0 255.255.255.0 10.0.0.2 1" instead.
    – wget
    Jun 1, 2017 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .