Page 1 of 1

--route-delay cannot be used with --mode server

Posted: Thu Aug 11, 2011 8:13 am
by Mimiko
Using the config:

Code: Select all

server 192.168.3.0 255.255.255.0
route-delay 10 20
On Windows it's normal. On Linux I get the error:
Options error: --route-delay cannot be used with --mode server
This is not stated in manual. So is this a bug?

Re: --route-delay cannot be used with --mode server

Posted: Thu Aug 11, 2011 8:47 am
by janjust
quoting the manual page:
--route-delay [n] [w]
Delay n seconds (default=0) after connection establishment, before adding routes. If n is 0, routes will be added immediately upon connection establishment. If --route-delay is omitted, routes will be added immediately after TUN/TAP device open and --up script execution, before any --user or --group privilege downgrade (or --chroot execution.)

This option is designed to be useful in scenarios where DHCP is used to set tap adapter addresses. The delay will give the DHCP handshake time to complete before routes are added.
so 'route-delay' only makes sense when a connection is established. as routes are not added to a server when a client connects this option does not make sense - I'm not sure if the manual page should explicitly mention that.

Re: --route-delay cannot be used with --mode server

Posted: Thu Aug 11, 2011 9:24 am
by Mimiko
Using
server 192.168.3.0 255.255.255.0
in config file, we make OpenVPN to use it's internal DCHP. On linux the tun/tap device is also set to dhcp. Why not to wait the routes addition some time? Oh, the thing is that in Windows its working as expected without giving this error. Why windows and linux interpret this two options differently?

Re: --route-delay cannot be used with --mode server

Posted: Mon Aug 15, 2011 6:08 pm
by Mimiko
so 'route-delay' only makes sense when a connection is established
After a while I get the idea on "mode server". But. "route-delay" makes sense when a connection is established, or (on server) when tun-adapter is brought up and got an ip.
On windows, "mode server" and "route-delay" behaves like this:
- OpenVPN is started;
- tun(or tap) adapter is brought up;
- tun adapter gets the ip;
- routes are added.

It may come that after tun-adapter initialization by the OpenVPN is done, the OpenVPN whants to add routes, without waiting adapter to come up and get IP. So a route-delay is necessary, otherwise, "route add a.b.c.d mask x.x.x.0 gw 192.168.3.1" will fail, because tun adapter didn't get the IP at route addition time.

When first starting to use, install and test OpenVPN, I come to this problem when routes wanted to be added before the tun-adapter is really up. So had to come on putting that "route-delay 60" (a full one minute), enough for adater to get the IP.

When moved to Linux, I expected the same problem. But hot into another. Ofcourse I can remove that option.

This is related only to OpenVPN server.