Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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 first, then the servers given by DHCP
prepend domain-name-servers


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .