[Solved] One static IP and the rest Dynamic/Define DHCP pool

Scripts to manage certificates or generate config files

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

Post Reply
craig97
OpenVpn Newbie
Posts: 3
Joined: Fri Mar 27, 2020 11:14 am

[Solved] One static IP and the rest Dynamic/Define DHCP pool

Post by craig97 » Fri Mar 27, 2020 11:29 am

Hey!

I'm a bit new to OpenVPN and this might be a silly question but here goes.

Got my VPS setup as a VPN server.
3 Clients, let's say A, B and C. A(common name: AConfig) has a shared drive I need access to and hence require to assign a static IP to A.
B and C are two clients (common name: clientConfig) that share a common certificate and config file and will connect to the server and access the above stated shared drive from A.
The server config has

Code: Select all

client-config-dir ccd
client-to-client
duplicate-cn
topology subnet
The "AConfig" (ccd) file has

Code: Select all

ifconfig-push 10.10.0.2 255.255.255.0
and there is no ccd file for B and C.

My understanding and logical interpretation was that "A" would be allocated an IP of 10.10.0.2, which does happen; and that the other clients would be allocated an IP other than 10.10.0.2, but this doesn't work out. They sometimes get 10.10.0.2 and otherwise 10.10.0.3+

Creating a separate config file for each client is not something I'm keen on doing because in reality I have 30-40 such B's and C's whose identities change from time to time.

So what I need to do is assign a static IP, say 10.10.0.2 to "A" and somehow, have a DHCP pool of 10.10.0.3 - 10.10.0.254 for the other clients (B's and C's)

Would really appreciate the help.

Thanks,
Craig

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: One static IP and the rest Dynamic/Define DHCP pool

Post by TinCanTech » Fri Mar 27, 2020 11:56 am

The simplest solution is to give all of your clients a CCD file with an `ifconfig-push` statement.

craig97
OpenVpn Newbie
Posts: 3
Joined: Fri Mar 27, 2020 11:14 am

Re: One static IP and the rest Dynamic/Define DHCP pool

Post by craig97 » Fri Mar 27, 2020 12:50 pm

True but as I mentioned, these clients keep changing as time goes by. The only constant is A.

User avatar
Pippin
Forum Team
Posts: 1201
Joined: Wed Jul 01, 2015 8:03 am
Location: irc://irc.libera.chat:6697/openvpn

Re: One static IP and the rest Dynamic/Define DHCP pool

Post by Pippin » Fri Mar 27, 2020 1:28 pm

Read
--server network netmask ['nopool']
--ifconfig-pool start-IP end-IP [netmask]
in manual 2.4:
https://community.openvpn.net/openvpn/w ... n24ManPage
I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
Halton Arp

craig97
OpenVpn Newbie
Posts: 3
Joined: Fri Mar 27, 2020 11:14 am

Re: One static IP and the rest Dynamic/Define DHCP pool

Post by craig97 » Fri Mar 27, 2020 1:50 pm

Perfect! That's exactly what I needed. Thanks Pippin!!
How do I mark this as Solved?

Post Reply