5

Hi have a Debian Squeeze box with eth0 and eth1.

In /etc/network/interfaces is:

auto eth1
iface eth1 inet static
 address 10.1.2.208
 netmask 255.255.255.0
 gateway 10.1.2.1

But every 24 hours, eth1 loses its statically-assigned IP address, and fetches one from DHCP instead! Manually doing:

# ifup eth1 && ifdown eth1

puts it back to how it should be.

But why does it spontaneously break in the first place?!

9

Is dhcpcd/dhclient still running? It will refresh its DHCP address on the interface if you don't kill it.

Also, did you configure Network Manager? That'll override the interfaces file. Get rid of it if you're not using it.

  • 3
    Change 'dhcpcd' to 'dhclient' above, and I'll mark this answer as correct. It seems that if you edit /etc/networking/interfaces so that eth1 is now 'static' instead of 'dhcp', then an 'ifdown eth1 && ifup eth1' won't kill the dhclient instance which ifupdown started initially. Kill it manually, and it stays away when you ifdown/ifup. – David Bullock Dec 16 '11 at 15:25
  • 2
    Exactly. It would have worked if you had run ifdown, THEN edited to change the method to static, THEN run ifup. In your case, ifdown had no idea that dhclient needed to be killed. – MikeyB Dec 16 '11 at 22:05
0

Try this:

auto eth1
iface eth1 inet static
  address 10.1.2.208
  netmask 255.255.255.0
  gateway 10.1.2.1
  hwaddress ether mac_address_of_the_network_card_here

For example:

...
  hwaddress ether 00:00:5e:00:53:b2
  • 1
    How does this improve on accepted answer? – Dave M Feb 17 '18 at 19:30
  • It is for remember myself. ;) – Ferrarezi Mar 18 '18 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.