Set static IP in OpenVPN

IanArman asked:

I have an OpenVPN server (, and three server clients.

I’m trying to set a static IP address, for the VPN clients.

I’ve created ipp.txt /etc/openvpn/ccd/ipp.txt.

The file ipp.txt uses the following syntax:

[client name],[ip address]

When connecting the server is not issuing a static ip address.

My answer:

That’s because that is not how you manually assign IP addresses. There is a file ipp.txt that OpenVPN can maintain, so that clients (sometimes) get the same IP address reassigned to them if they reconnect or OpenVPN restarts.

See the sample config:

# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

But that’s not what you’ve configured.

The files in the ccd directory are interpreted as client-specific configuration. So creating a file ccd/ipp.txt causes OpenVPN to attempt to interpret the file’s contents as directives applying to a client named ipp.txt.

This doesn’t appear to be what you want.

Let’s go back to the sample config:

# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of
# First uncomment out these lines:
;client-config-dir ccd
# Then add this line to ccd/Thelonious:
#   ifconfig-push

So it looks like you want a file named ccd/miami-test containing ifconfig-push

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.