[SOLVED] How To Control DHCP Lease In OpenVPN
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVPN User
- Posts: 21
- Joined: Sat Sep 03, 2011 8:33 pm
[SOLVED] How To Control DHCP Lease In OpenVPN
Hello Everybody
My OpenVPN configuration is working perfectly alright with Active Directory authentication. However, I noticed that the IP address that's assigned to the Client Machines from the Server is for a period of one Year.
Is there a way to control this Parameter? If yes, I would like to bring this down to one day. Could you kindly help?
Thanks
Blue
My OpenVPN configuration is working perfectly alright with Active Directory authentication. However, I noticed that the IP address that's assigned to the Client Machines from the Server is for a period of one Year.
Is there a way to control this Parameter? If yes, I would like to bring this down to one day. Could you kindly help?
Thanks
Blue
- Mimiko
- Forum Team
- Posts: 1564
- Joined: Wed Sep 22, 2010 3:18 am
Re: How To Control DHCP Lease In OpenVPN
who is serving DHCP requests: OpenVPN or some other DHCP server? If OpenVPN - its not a problem. If some DHCP server on LAN - you have to configure it. It's out of scope of OpenVPN.
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: How To Control DHCP Lease In OpenVPN
the 1 year DHCP lease is assigned by OpenVPN itself; it can be controled (on the CLIENT side for Windows clients using
e.g.
Code: Select all
ip-win32 dynamic [offset] [lease-time]
Code: Select all
ip-win32 dynamic 0 3600
-
- OpenVPN User
- Posts: 21
- Joined: Sat Sep 03, 2011 8:33 pm
Re: How To Control DHCP Lease In OpenVPN
Hi Mimiko and Janjust
The Lease is served by OpenVPN, however it would be great if there was a simpler way to do it on the OpenVPN Server rather than on individual client machines...
Thanks
Blue
The Lease is served by OpenVPN, however it would be great if there was a simpler way to do it on the OpenVPN Server rather than on individual client machines...
Thanks
Blue
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: How To Control DHCP Lease In OpenVPN
In a 'tun' style network the DHCP lease is done by the OpenVPN *client*, not the server. The OpenVPN client program acts as a mini DHP client to the local tap-win32 adapter.
If you want to have a server side DHCP server then you need a 'tap' style network, possibly using bridging (which I would NOT recommend)
On the server side you might be able to get away with
If you want to have a server side DHCP server then you need a 'tap' style network, possibly using bridging (which I would NOT recommend)
On the server side you might be able to get away with
Code: Select all
push "ip-win32 dynamic [offset] [lease-time] "
-
- OpenVPN User
- Posts: 21
- Joined: Sat Sep 03, 2011 8:33 pm
Re: How To Control DHCP Lease In OpenVPN
Hi Janjust
I have a bridge mode setup on my Network with OpenVPN running on FreeBSD 8.0 serving Win XP clients. Therefore I should be able to use the option you mentioned in my "server.conf" file...?
Also what's the Offset parameter? Could you kindly give me an example please...?
Thanks
Blue
I have a bridge mode setup on my Network with OpenVPN running on FreeBSD 8.0 serving Win XP clients. Therefore I should be able to use the option you mentioned in my "server.conf" file...?
Also what's the Offset parameter? Could you kindly give me an example please...?
Thanks
Blue
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: How To Control DHCP Lease In OpenVPN
I've never tested if this works, but it just might: add
to the server.conf file, restart the openvpn server and reconnect the clients.
Code: Select all
push "ip-win32 dynamic 0 3600"
-
- OpenVPN User
- Posts: 21
- Joined: Sat Sep 03, 2011 8:33 pm
Re: How To Control DHCP Lease In OpenVPN
Hi Janjust
Congratulations! it worked! I added the push ip-win32 directive to my server.conf file and the lease now shows one day.
Thanks to you and everybody in this thread.
Blue
Congratulations! it worked! I added the push ip-win32 directive to my server.conf file and the lease now shows one day.
Thanks to you and everybody in this thread.
Blue
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: How To Control DHCP Lease In OpenVPN
great to hear that - this is one for the FAQs
closing topic.

closing topic.