1

I am trying to work out how to assign my various OpenVPN clients static IPs every time they connect.

I have found multiple posts explaining how to do it when OpenVPN is on a PC, but not when it is on a DD-WRT based router.

I understand it will involve adding information to my server config and also to my routers start up commands. I just don't know what I should be adding.

Any advice would be greatly received

Richard Lapthorn
  • 71
  • 1
  • 2
  • 6

1 Answers1

0

CCD is an overkill for simple task like assign statc IP. (Looking from sysadmin point of view, excuse me :)

Source: man openvpn

--ifconfig-pool-persist file [seconds] Persist/unpersist ifconfig-pool data to file, at seconds intervals (default=600), as well as on program startup and shutdown.

The goal of this option is to provide a long-term association between clients (denoted by their common name) and the virtual IP address assigned to them from the ifconfig-pool. Maintaining a long-term association is good for clients because it allows them to effectively use the --persist-tun option.

file is a comma-delimited ASCII file, formatted as <Common-Name>,IP-address>.

If seconds = 0, file will be treated as read-only. This is useful if you would like to treat file as a configuration file.

Source: https://openvpn.net/archive/openvpn-users/2006-05/msg00316.html

I do not have ifconfig-pool-persist in my local.conf, so I will put that in now. My next question is how do I define the fixed IP's in the file that you reference? e.g. ifconfig-pool-persist ipp.txt but what does in ipp.txt? and does that just live in the same directory as the .conf file? I have tried to look in google and the man pages but can't find anything helpful.

As the man page says: "file is a comma-delimited ASCII file, formatted as ,". ipp.txt will either be created by OpenVPN itself after clients connect or, if you add a 0 as an optional argument, as in

ifconfig-pool-persist ipp.txt 0

then OpenVPN will make no updates to the file and expect you to be responsible for maintaining it.

The location of the file, as with all other files referenced from your .conf file, is (by default) relative to your current working directory (typically the .conf file's location) or can be an absolute path instead.

Michal Sokolowski
  • 1,461
  • 1
  • 11
  • 24