LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   DHCP overriding my static IP configuration (https://www.linuxquestions.org/questions/debian-26/dhcp-overriding-my-static-ip-configuration-690016/)

jimdaworm 12-12-2008 02:40 AM

DHCP overriding my static IP configuration
 
Hi everyone its been a long while since I have been on here, even though I am using Linux for 95% of the time (I guess its getting that good!)

I have a static IP configured I have put my config below:

Quote:

# 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 dhcp
#iface wlan0 inet dhcp

auto eth0

iface eth0 inet static
address 10.0.0.10
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.1
Every time I restart the computer or my router it gets a dhcp address, the only trick I have found is that if I stop
Quote:

/etc/init.d/networking stop
and
Quote:

/etc/init.d/networking start
I get my static ip back again until the next time I turn off either the router or the computer.

Could anyone give me any ideas whats overriding the static ip or if I have it badly configured?

JosipBroz 12-12-2008 03:09 AM

Have you checked in your router that there is no overlapping between its DHCP range and your static IP?

salasi 12-12-2008 03:39 AM

Is it stacking resolv.conf's? If so, the running resolv.conf should contain the details of (the last program) that has stacked it.

Alternatively, are you running dhcpd/avahi or something?

Quote:

no overlapping between its DHCP range and your static IP?
I'm guessing, but I don't think that would do this; it would go wrong if/when two devices got the same ip, but I don't see how the router on its own can change your computer's IP (unless you are running some program which expects to pick up an ip from dhcp, of course).

jimdaworm 12-12-2008 05:56 AM

Hi again,

@JosipBroz the ip addresses are not overlapping. The router is giving out addresses starting at 10.0.0.11 and my static ip is 10.0.0.10 (Which gets changed by dhcp all the time to 10.0.0.11)


Its interesting if I stop dhcdb which I understand is the client side DHCP demon:
Quote:

/etc/init.d/dhcdbd stop
When I reboot the router eth0 doesnt have ANY ip!

@salasi
I think that I have left all the networking configuration standard. I am not sure what you mean by stacking resolv.con but here are the contents of my resolv.conf

Quote:

debby:/home/adam# cat /etc/resolv.conf
### BEGIN INFO
#
# Modified_by: NetworkManager
# Process: /usr/bin/NetworkManager
# Process_id: 3696
#
### END INFO

nameserver 10.0.0.1

salasi 12-13-2008 07:16 AM

Quote:

Originally Posted by jimdaworm (Post 3372864)

@salasi
I think that I have left all the networking configuration standard. I am not sure what you mean by stacking resolv.con but here are the contents of my resolv.conf

Quote:

debby:/home/adam# cat /etc/resolv.conf
### BEGIN INFO
#
# Modified_by: NetworkManager
# Process: /usr/bin/NetworkManager
# Process_id: 3696
#
### END INFO

nameserver 10.0.0.1

this is exactly what I mean: whatever you set up as resolv.conf (prior to NM running), NetworkManager has been at it, via the OS call to do exactly this, pushed the pre-network-manager version onto the stack and run its own version for the duration. if you look at mine under similar circumstances (running kde and NM active):

Quote:

### BEGIN INFO
#
# Modified_by: NetworkManager
# Process: /usr/bin/NetworkManager
# Process_id: 2900
#
### END INFO



nameserver 192.168.1.34
nameserver 192.168.1.1
but is otherwise similar. However, if you open NM, you'll see it also takes control of IP, Netmask, broadcast address (err, and MAC address).

I think if you you want to run NM, you can set the static address in there and it'll work (until the next time you have a non-clean shutdown, and then you might have to re-write resolv.conf, so you might need want to take a backup copy when NM isn't running).

jimdaworm 12-13-2008 10:36 AM

Hey salasi

Thanks for your help, it seems to be behaving its self now. I went into the network manager and even though it was already set to static IP I configured it again and applied the settings.

I have restarted my router and still have my static ip. I guess it could be some sort of a bug with the NM if you manually edit the settings and put a static IP.

tredegar 12-13-2008 01:02 PM

Quote:

I guess it could be some sort of a bug with the NM
NM was so buggy I uninstalled it.
If you'd like a NM that works look into wicd
http://www.wicd.net/
It is excellent.

JimBass 12-14-2008 01:56 PM

This is going back some years, but back in Sarge, if you allowed DHCP to set an address during install, then tried to configure a static afterwards, you would see exactly the problem you described. The installation would set up dhcp-client which would run on reboot even though you had set static. Since dhcp would run at boot, you'd lose your static.

The solution was to uninstall what was then dhcp-client, and now appears to be called dhclient3 on unstable. If you need the dhclient, then you need to edit your startup and make sure nothing uses dhclient.

Peace,
JimBass

jimdaworm 12-14-2008 05:04 PM

@tredegar thanks for the info although it seems to be behaving its self since I re-configured eth0 with the KDE NM.

@JimBass I did read something about what your describing but when I saw the dates (at least 2 years ago) I figured this issue must have been fixed. Anyway its keeping the static now


All times are GMT -5. The time now is 11:32 PM.