Using static DNS in Debian Squeeze?

2

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?

cmbrnt

Posted 2011-04-07T07:46:24.800

Reputation: 200

Answers

2

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

Dave Sherohman

Posted 2011-04-07T07:46:24.800

Reputation: 5 143