Page 1 of 1

How to specify DHCP Range in Config File CentOS

Posted: Mon Jun 10, 2013 2:24 pm
by tklosterman888
What is the proper way to specify the DHCP Range to clients? Server configuration file (openvpn.conf)

Re: How to specify DHCP Range in Config File CentOS

Posted: Tue Jun 11, 2013 5:40 am
by mwandelaar
Yes, that's the way to do so:
--server network netmask

A helper directive designed to simplify the configuration of OpenVPN's server mode. This directive will set up an OpenVPN server which will allocate
addresses to clients out of the given network/netmask. The server itself will take the ".1" address of the given network for use as the server-side end‐
point of the local TUN/TAP interface.

For example, --server 10.8.0.0 255.255.255.0 expands as follows:

Re: How to specify DHCP Range in Config File CentOS

Posted: Tue Jun 11, 2013 9:00 am
by janjust
if you want to specify a different range then replace the
dev tun
server 10.8.0.0 255.255.255.0
statement with

Code: Select all

mode server
tls-server
ifconfig 10.8.0.1 10.8.0.2
ifconfig-pool 10.8.0.4 10.8.0.251
route 10.8.0.0 255.255.255.0
push "route 10.8.0.0 255.255.255.0"
push "route 10.8.0.1"
it's the 'ifconfig-pool' that specifies the DHCP IP range. It's also possible to specify ranges outside of the server VPN IP, but in that case routing becomes trickier.