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 debian machine that is supposed to have a static ip, but insists on getting its address from the DHCP server.

Here's this settings file:

$> cat /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
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
  address   192.168.1.99
  gateway   192.168.1.1
  netmask   255.255.255.0
  network   192.168.1.0
  broadcast 192.168.1.255

Yet

$> sudo /etc/init.d/networking restart
Reconfiguring network interfaces...done.
$> sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 00:e0:03:09:05:2e
          inet addr:192.168.1.205  Bcast:255.255.255.255  Mask:255.255.255.0
...

Where is it being told to use dhcp?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Well, apparently a complete restart fixed it. so much for Linux not needed restarts on settings changes! :P

share|improve this answer
1  
killall dhclient would probably done the same thing. Or stop, followed by editing the file, followed by start. It only stops the dhcp client process if the interface is set to use dhcp, so a restart does not kill dhcp, if the interface is not set to use dhcp. –  Justin Smith Apr 7 '10 at 18:41
    
Ah. Thanks much! Put that as an answer and I'll upvote and accept it :) –  user13743 Apr 7 '10 at 20:41
add comment

To actually answer your question, you have the right file.

This stanza:

iface eth0 inet static

is what controls whether a static IP is assigned on boot or if it tries to use DHCP. To use DHCP, change to:

iface eth0 inet dhcp

man interfaces will tell you more.

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.