27

If you use redirect-gateway def1 option in OpenVPN config file,the server will add a default gateway on your route table, what I want to know is why OpenVPN did not use network 0.0.0.0 netmask 0.0.0.0 as a default gateway instead of netmask 128.0.0.0 ?

pevik
  • 302
Forcyy
  • 373

2 Answers2

41

OpenVPN isn't using 0.0.0.0/0 as the route on the default gateway because you told it not to, with the redirect-gateway def1 config option. The manpage explains more, but basically by putting in two /1 routes covering the entire IPv4 address space, you get the same end result, but as it's more specific than a standard default route, it gets used in preference, so you don't have to either delete the existing default route, nor do you have to play games with routing metrics to get your OpenVPN route preferred.

womble
  • 98,245
0

It's worth mentioning that in Network Manager on linux, the default is to use 0.0.0.0 . See: https://serverfault.com/a/469131/223931

This is different from how it works on the OpenVPN client on windows.

DustWolf
  • 155