I have a gateway running on Debian Squeeze with 2 network interfaces, one static (internal, eth0) and one DHCP (external, eth1). I have an internal DNS server that I want the gateway to use.
In my /etc/network/interfaces, I have eth0 set to static, with a dns-nameserver directive, pointing to 192.168.3.4. However, upon rebooting or restarting the networking service, my /etc/resolv.conf changes to the DNS server provided by the external DHCP.
How can I get Debian to use my internal DNS server but still obtain a DHCP lease from eth1?
Best Answer
One option would be to adjust your
/etc/dhcp/dhclient.conf
file to simply not request thedomain-name-servers
anddomain-name
DHCP options.You mention that you provided the
dns-nameserver
option in your interfaces file. Do you actually have the resolvconf package installed? If not, then that setting isn't going to do anything useful, and DHCP will pretty much always over-write the resolv.conf if DNS options are recieved.If the resolvconf package is installed you can modify the interface-order config to control the order the settings are used.