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.

Is it possible on the client side to setup the client.conf file to resolve a particular host/domain to a given IP.

For instance, domain.tld resolve usually from the Internet NS to 1.2.3.4

host domain.tld => 1.2.3.4

I would like to force domain.tld to resolve to 10.11.12.13 when using openvpn client.conf

openvpn client.conf
host domain.tld => 10.11.12.13
share|improve this question

1 Answer 1

up vote 2 down vote accepted

OpenVPN itself does not provide any name resolution. Usually name resolution is provided by a separate service, which will normally first question a local file (/etc/hosts under linux or C:/Windows/system32/etc/hosts or similar on a Windows computer) and, if the name is still unresolved, resort to using DNS, based on the name servers defined (these can either be fixed when using static addresses, but are usually set up by DHCP when acquiring an IP address).

With the above in mind, there are a few things you can do to achieve this:

1.) Configure the VPN server such that it provides a name server address to the client which will resolve domain.tld to to 10.11.12.13 or

2.) Configure the VPN client such that it will run a script once the connection has been established. This script can then either modify the local hosts file or change the name servers as required.

share|improve this answer
    
Thanks for your answer, but I want to avoid 1). 2) is what we are doing right now (actually the name is resolved locally via /etc/hosts and it lasts even after the VPN is closed). I was hoping the vpn client would be able to offer that feature... –  ring0 Jul 7 '11 at 13:26
    
Nope, not as far as I know. If the name persists even after the connection is closed, you might want to consider a pre-down script in addition to the post-up script. –  wolfgangsz Jul 7 '11 at 14:15

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.