Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 konw is Why openvpn did not use network netmask as default gateway instead of netmask ?

share|improve this question

migrated from Sep 19 '11 at 5:12

This question came from our site for professional and enthusiast programmers.

up vote 9 down vote accepted

OpenVPN isn't using 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.

share|improve this answer
To be clear, there are two routes that are more specific than a single one covering everything. Basically making the entire IP range into two subnets. They are: 0- and The precision of two overrides the single bigger network range. You'll also have a route that is even more specific for your VPN server which goes to the Internet, not the VPN. Oh, and a /1 mask = – flickerfly Mar 29 at 20:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.