I am using openvpn. Once the clients are connected, I would like that they can be addressed by using the names instead of the ip addresses.
e.g. instead of "ping 10.8.0.2" I can use "ping client-name"
How can I achieve that?
I am using openvpn 2.3 on a centos 6.5. I also installed dnsmasq.
Assuming you have access to your DNS server, you should be able to assign static IPs for each VPN client on your OpenVPN server and then make an entry to that static IP in DNS.
This blog has a nice write up of how to assign static IPs in OpenVPN: http://michlstechblog.info/blog/openvpn-set-a-static-ip-address-for-a-client/
The basic steps are:
mkdir /etc/openvpn/staticclients
client-config-dir /etc/openvpn/staticclients
openssl x509 -in /etc/openvpn/yourClientCertificate.cer -noout -subject | sed -e 's/.*CN=\(.*\)\/.*/\1/'
Edit this file to contain the following: