Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm connecting to different WLANs all the time, and at boot time my computer also connects through a VPN-tunnel. The problem is that the DNS-server address received via DHCP often times don't allow clients from the IP-range I'm assigned to by my VPN-host. I take care of this by entering the Google public DNS:es into resolv.conf, but it's a pain to do that each time I reboot my computer.

Could this be fixed in a better way? Could I assign the DNS-server to use in the config of OpenVPN? I was thinking about denying write access for all users to the resolv.conf, but I'm worried that will cause other problems. Surely there must be a way to do this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Look for your dhclient.conf (all my Debian boxes are on static IPs, but my Ubuntu laptop has it at /etc/dhcp3/dhclient.conf, so that's a good place to look first). You can set fixed name servers (among other things) in there and they will either be added to or replace the name servers given to you by the DHCP server:

# Check 1.2.3.4 first, then the servers given by DHCP
prepend domain-name-servers 1.2.3.4

or

# Check only 1.2.3.4 and ignore servers given by DHCP
supersede domain-name-servers 1.2.3.4
share|improve this answer
add comment

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.