Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to give a specific user his own private IP to use. How do I assign this in OpenVPN? I have googled on the specific terms, but I couldn't find anything useful.

Anyone here with more experience than I have could help me out? Thanks.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You would do this by adding files in the /etc/openvpn/ccd directory. The file should be named after the Common Name of the client certificate. You can then use per-client configurations.

For example:

# ls /etc/openvpn/ccd
WorkLaptop

# cat /etc/openvpn/ccd/WorkLaptop
ifconfig-push 10.8.0.13 10.8.0.14
push "route 10.10.0.0 255.255.255.0"
push "dhcp-option WINS 10.8.0.1"

So, in the above example, a client connecting to the server with a certificate "WorkLaptop" will receive the IP 10.8.0.13, as well as the routing and the information about the WINS server. The directives in the CCD file are applied after the main server.conf directives are applied, so the connecting client can be assigned a different route, etc., as these CCD directives will supersede what you already had in server.conf.

The section of the man page you need to look for is the client-config-dir option. I don't know why it's so hard to find it on the OpenVPN website. I recall it being relatively easy to find the documentation, but that was a few years ago. You can look at http://openvpn.net/index.php/open-source/documentation/howto.html and search down the page for "client-config" and there seems to be some info.

Note that changes to files in the CCD directory will take effect immediately; you don't need to restart the openvpn server.

share|improve this answer
    
Thank you for your wonderful explanation. But I ment in my first post the IP as external IP, will I just push that IP aswell? Using ifconfig-push EXTERNAL IP ? Sorry for my bad explanation. –  Devator Sep 13 '11 at 16:26
    
What's your setup? You're actually going to rewrite the (existing) IP address of the client? The ifconfig-push used by openvpn should only be applied to the tun0 interface of the client, not the other interfaces. –  cjc Sep 13 '11 at 17:06
    
Well, its for when a client connects to the VPN server, they will browse with the IP of the server. I want a specific client to get his own (external) IP. –  Devator Sep 13 '11 at 17:30
    
I think that actually becomes a routing question, rather than an openvpn one. You basically will be routing the openvpn addresses through the server, without modification. You will need to be more specific on what you're doing in that case (i.e., post sample IPs, a quick summary of your network, etc.) You might want to open a new question for this. –  cjc Sep 13 '11 at 17:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.