Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a VM (on ESXi 5.1.0) running Debian Wheezy (7.0).

eth0 has a statically assigned address. eth1 was DHCP-assigned, and now I want to make it static.

Here is my old /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback

# The primary network interface
allow-hotplug eth0 eth1
iface eth0 inet static
 address 10.2.1.77
 broadcast 10.2.1.255
 netmask 255.255.255.0
 pointopoint 10.2.1.1

iface eth1 inet dhcp

And here is my new /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback

# The primary network interface
allow-hotplug eth0 eth1
iface eth0 inet static
 address 10.2.1.77
 broadcast 10.2.1.255
 netmask 255.255.255.0
 pointopoint 10.2.1.1

iface eth1 inet static
        address 10.1.0.254
        netmask 255.255.255.0
        gateway 10.1.0.1
        dns-nameservers 8.8.8.8

When I reboot, I can see dhcpcd try to renew my lease for my old DHCP-assigned address, and succeed. And then it overwrites /etc/resolv.conf, which should contain 8.8.8.8 but does not. eth1 does have the correct (static) address, however.

What am I doing wrong here? I don't want to disable dhcpcd outright. In the near future I might switch eth1 back to DHCP, or add a third DHCP-assigned interface.

share|improve this question

2 Answers 2

Run (as root):

update-rc.d -f dhcpd remove

If you want to re-enable it in the future,

update-rc.d dhcpd defaults

NOTE: Removing it from rc.d will disable it on all interfaces. Restoring it will enable on all interfaces.

share|improve this answer
    
So it's all interfaces or no interfaces? Is there a way to use an alternative dhcp client? –  craig65535 Feb 5 '13 at 22:20
    
As far as I am aware, yes. I don't know much about Linux, sadly. –  Kruug Feb 5 '13 at 22:24
    
So I was using the dhcpcd5 package. Looks like there are lots of alternatives: dhcpcd, udhcpc, isc-dhcp-client and pump are some of them. –  craig65535 Feb 6 '13 at 0:20
    
Switched to isc-dhcp-client and it seems to be working now. –  craig65535 Feb 6 '13 at 1:10

You could disable the service. http://serverfault.com/questions/32438/disable-a-service-from-starting-at-all-runlevels

The preferred method would be to update the /etc/sysconfig/network-scripts/ifcfg-* file for the device removing the dhcp line (or altering it to false)

Unfortunately I'm not in front of my linux machine right now so I can't pull the exact configuration for you.

share|improve this answer
    
Unfortunately /etc/sysconfig does not exist on Debian. Or at least on my install. –  craig65535 Feb 5 '13 at 22:13
    
I should also mention that doing both wont hurt anything unless you plan on adding a NIC that will use DHCP. –  codeReign Feb 5 '13 at 22:13
    
My appologies. I've only ever encountered this problem when using network manager on the command line. After a quick google it appears those files are part of NetworkManager configuration opposed to what you are using. –  codeReign Feb 5 '13 at 22:17

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.