views:

2174

answers:

2

I have an OpenVPN server that dynamically assigns IP addresses (dhcp-style) to its clients. The address range is specified with a --server directive in the config file. I need to exclude a small number of addresses within that range and reserve them for clients that need to fixed IP addresses. I suppose I need to modify the config file client-side to assign the address.

Does anyone have some hints to change the configuration correctly?

+1  A: 

Try this in your client file:

ifconfig 10.2.0.12 255.255.255.0

Put your desired client IP there and network submask there.

If it does not work try posting your server and client configs or their parts related to the problem.

EDITED: Check the official OpenVPN HOWTO, scroll down to "Configuring client-specific rules and access policies" section. It seems to be what you want.

Sergey
I'm sure it works. But how can I prevent the server to assign the same ip to another client?
Nice question. See my edits.
Sergey
+2  A: 

Excerpted from the server configuration file in the OpenVPN HOWTO:

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

Create a ccd directory -- "client configuration directory" -- on the server and follow the instructions to assign a specific IP address and set of routing rules to each client.

Adam Liss