How to specify DHCP Range in Config File CentOS

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
tklosterman888
OpenVpn Newbie
Posts: 1
Joined: Mon Jun 10, 2013 2:17 pm

How to specify DHCP Range in Config File CentOS

Post by tklosterman888 » Mon Jun 10, 2013 2:24 pm

What is the proper way to specify the DHCP Range to clients? Server configuration file (openvpn.conf)

mwandelaar
OpenVPN Super User
Posts: 219
Joined: Mon Nov 23, 2009 8:24 pm

Re: How to specify DHCP Range in Config File CentOS

Post by mwandelaar » Tue Jun 11, 2013 5:40 am

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:

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: How to specify DHCP Range in Config File CentOS

Post by janjust » Tue Jun 11, 2013 9:00 am

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.

Post Reply