2

I am wondering what is the role of push "route 0.0.0.0" in /etc/openvpn/server.conf. In fact, I had a push "route 0.0.0.0 " line (notice the space at the end) in my server.conf file, and I had to comment it out in order to gain access to my server-side LAN and to the Internet through the VPN connection. I am assuming it is a catch-all rule for all network traffic that does not comply with other routes... Is that what it is? And if so, what's the gateway then?

4
  • 1
    The default route is encoded as 0.0.0.0.
    – dirkt
    Sep 30, 2017 at 7:43
  • @dirkt And what would be the gateway for that default route? Oct 1, 2017 at 0:00
  • None (which would be a bug), unless it's specified somewhere else in the configuration with route-gateway.
    – dirkt
    Oct 1, 2017 at 4:32
  • @dirkt Would push "redirect-gateway def1" do the job? It is the only mention of gateway I can find in my server.conf file. Oct 2, 2017 at 21:57

2 Answers 2

0

If you use push "redirect-gateway def1", you are already pushing the default route (in the form of two /1 address ranges), with the correct gateway (the VPN server).

So that already does what you'd think push "route 0.0.0.0" would do, except it didn't miss the gateway option.

0

I’ll just quote the manual:

--route network/IP [netmask] [gateway] [metric] Add route to routing table after connection is established. Multiple routes can be specified. Routes will be automatically torn down in reverse order prior to TUN/TAP device close.

This option is intended as a convenience proxy for the route(8) shell command, while at the same time providing portable semantics across OpenVPN's platform space.

netmask default -- 255.255.255.255

gateway default -- taken from --route-gateway or the second parameter to --ifconfig when --dev tun is specified.

The default can be specified by leaving an option blank or setting it to "default".

The network and gateway parameters can also be specified as a DNS or /etc/hosts file resolvable name, or as one of three special keywords:

vpn_gateway -- The remote VPN endpoint address (derived either from --route-gateway or the second parameter to --ifconfig when --dev tun is specified).

net_gateway -- The pre-existing IP default gateway, read from the routing table (not supported on all OSes).

remote_host -- The --remote address if OpenVPN is being run in client mode, and is undefined in server mode.

As you can see, specifying the next hop is optional. Your server configuration most likely implicitly pushes either route-gateway, ifconfig, or both.

You must log in to answer this question.

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