IP Config resets to default settings in Linux every night

6,279

The fact that dhclient-script is being called makes me think that NetworkManager service is running, /etc/network/interface's DHCP=no is keeping the iface scripts from being rewritten the way that resolv.conf is, but it isn't preventing dhclient-script from running ifconfig commands and getting at the actual interface configuration.

Here is a CentOS mailing list link about such a thing: http://lists.centos.org/pipermail/centos/2009-November/086566.html and what the author would have you do, if I am correct.

/sbin/service NetworkManager stop

chkconfig NetworkManager off

Share:
6,279

Related videos on Youtube

David
Author by

David

Updated on September 18, 2022

Comments

  • David
    David over 1 year

    I have a linux server (centos 5) which for the past 2-3 weeks has been resetting it's ip config information to a local ip (192.168.x.x). In /etc/network/interfaces I have:

    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    address 172.20.10.10
    netmask 255.255.255.0
    gateway 172.20.10.1
    

    So, i would have thought this would sort the problem. I have also tried running a reset of the details at 7am each morning with a cron:

    0 7 * * * route add default gw 172.20.10.1 eth0
    0 7 * * * ifconfig eth0 172.20.10.10 netmask 255.255.255.0
    

    But that doesn't seem to work either.

    cat /etc/sysconfig/network:

    NETWORKING_IPV6=no
    NETWORKING=yes
    HOSTNAME=localhost.localdomain
    

    cat /etc/sysconfig/network-scripts/ifcfg-eth0:

    TYPE=Ethernet
    DEVICE=eth0
    BOOTPROTO=none
    NETMASK=255.255.255.0
    IPADDR=172.20.10.10
    HWADDR=00:16:17:d6:31:f9
    GATEWAY=172.20.10.1
    DHCP=no
    PROBE=no
    

    The server is on a managed VPN (i think) inside a building of offices. We aren't aware of any DHCP servers and it's only been happening for 2-3 weeks. The building's network admins say they haven't changed anything that would affect it and we can't think of anything we have done either.

    Any help would be much appreciated as I'm really stuck!

    UPDATE 1

    Noticed this in boot.log:

    May 17 02:02:43 localhost NET[30723]: /sbin/dhclient-script : updated /etc/resolv.conf
    

    So, i've had a look at /etc/resolv.conf and I get this:

    ; generated by /sbin/dhclient-script
    nameserver 192.168.1.1
    

    UPDATE 2

    If read a little more about dhclient-script and it's called by dhclient which references dhclient.conf. I think it looks for it in /etc/. The only one i can find on our serve is at /etc/dhcp/dhclient.conf and it contains:

    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    address 172.20.10.10
    netmask 255.255.255.0
    gateway 172.20.10.1
    
    • Khaled
      Khaled about 12 years
      Any related information from system logs?
    • David
      David about 12 years
      @Khaled Interstingling, we have this in boot.log: May 17 02:02:43 localhost NET[30723]: /sbin/dhclient-script : updated /etc/resolv.conf
    • Sirch
      Sirch about 12 years
      Is this server rebooted every night?
    • David
      David about 12 years
      @Sirch no, the server is left on
    • rackandboneman
      rackandboneman about 12 years
      Maybe centos has the same bug as some debian releases: if you change an interface from dhcp to static and restart networking or ifdown & ifup, the dhcp client is left running until killed and will reset things when you least need it.
  • David
    David about 12 years
    Well, I killed the dhclient process and that seems to have done the trick. I tried running those commands but there isn't a service by that name. So, whatever it is, its dhclient and i image its getting started on bootup.