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.

I'm using Debian Lenny with two ethernet network cards, one plugged into a different network. My goal was to set both interfaces to DHCP, but I want the name server to be gotten from only one of them. The problem is, whoever gets the DHCP offer last, overrides the /etc/resolv.conf file to the wrong nameserver! I've deleted network-manager and network-manager-gnome as they are able to work with one interface a time. Both interfaces are set to DHCP and 'auto' in /etc/networking/interfaces like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

auto eth1
allow-hotplug eth1
iface eth1 inet dhcp

I want the nameserver to be gotten always from eth1, how can I do that?

thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I am not a big debian master, so I can't tell you how to do it in their rc scripts. However, if you are running dhclient it's not hard to do in the configuration. You define in dhclient.conf which options you want to retrieve from the server:

(The example from the man page)

interface "ep0" {
    send host-name "andare.fugue.com";
    send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
    send dhcp-lease-time 3600;
    supersede domain-name "fugue.com rc.vix.com home.vix.com";
    prepend domain-name-servers 127.0.0.1;
    request subnet-mask, broadcast-address, time-offset, routers,
            domain-name, domain-name-servers, host-name;
    require subnet-mask, domain-name-servers;
    script "/etc/dhclient-script";
    media "media 10baseT/UTP", "media 10base2/BNC";
}
share|improve this answer
    
That worked! I should have read the man page a little bit longer, it contemplated my problem almost word by word. Thanks! –  Diego Medaglia Nov 12 '10 at 11:58

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.