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?!

David Bullock
  • 791
  • 3
  • 14
  • 20

2 Answers2

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.

MikeyB
  • 38,725
  • 10
  • 102
  • 186
  • 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
kasperd
  • 29,894
  • 16
  • 72
  • 122
Ferrarezi
  • 101
  • 1