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.

In gentoo, this is as simple as:

dhcp_ethX="nodns nogateway"

How should I go about this in the interfaces file?

share|improve this question
    
What do you want, set them statically or use the current values? –  chmeee Jun 21 '09 at 14:53
    
I want to configure interface via DHCP, but ignore the given dns and gateway settings, this is for multiple uplink configuration. –  Karolis T. Jun 21 '09 at 15:16
add comment

4 Answers

up vote 7 down vote accepted

edit /etc/dhcp3/dhclient.conf

check the line:

#prepend domain-name-servers 127.0.0.1;

and uncomment it and set whatever dns servers you want to use

then in the request section below there will be something like this:

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, host-name,
        netbios-name-servers, netbios-scope, interface-mtu;

remove domain-name-servers and routers, that should remove the dns server and router/gateway requests via dhcp

share|improve this answer
add comment

While not doing exactly what you've asked for, the ifmetric package may provide a better solution.

sudo aptitude install ifmetric

Then in your /etc/network/interfaces file assign metrics to your interfaces. Note that not having a metric is the same as having a zero metric.

allow-hotplug eth0
iface eth0 inet dhcp
    metric 1

allow-hotplug eth1
iface eth1 inet dhcp

The above makes it so that when eth1 is plugged in, its routes will take precedence over routes from eth0. This may be better because you allow the routes to failover, so that it will still have a default route even if the eth1 interface is unplugged.

This doesn't affect dns settings, so depending on exactly what you want you may still have to uncomment the line in /etc/dhcp3/dhclient.conf:

#prepend domain-name-servers 127.0.0.1;

and remove domain-name-servers from the request list that immediately follows.

share|improve this answer
add comment

I don't think there's an exactly analagous command for /etc/network/interfaces; you'll have to set things up the way you like via the post-up command, most likely.

share|improve this answer
add comment

If you control the DHCP server then set the settings you want for this specific host based on the MAC address, otherwise setting a post-up script in /etc/network/interfaces is probably the simplest option

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.