Linux – CentOS 7 statically configured network adapter keeps getting DHCP address

centosinterfacelinuxnetworking

This is driving me nuts. I have a CentOS 7 system. It is acting as DHCP for the network it is attached to, is running Cobbler and PXE, but it is not the gateway. It is the primary file server for my network.

I have an on-board network adapter configured to be static that is also the adapter that DHCP is being handed out on:

# Generated by dracut initrd
NAME="enp5s0f0"
DEVICE="enp5s0f0"
ONBOOT=yes
NM_CONTROLLED=no
#NETBOOT=yes
UUID="82b4ef5d-6c06-43f1-a0fe-7b5fcdd1fc4f"
#IPV6INIT=yes
BOOTPROTO=static
IPADDR=10.101.24.21
NETMASK=255.255.252.0
TYPE=Ethernet
GATEWAY=10.101.24.1

This adapter, about once a week, decides it wants to override the statically configured IP, and get a DHCP address. Not after booting up. Just sitting there. Operating normally. At this point, I have to physically walk to the terminal or log in with IPMI to type:

systemctl restart network

And that brings it right back to the static address. Does anyone have any idea what's going on?

Best Answer

The BOOTPROTO parameter only accepts the following values:

 BOOTPROTO=protocol    ## where protocol is one of the following:

    none — No boot-time protocol should be used.
    bootp — The BOOTP protocol should be used.
    dhcp — The DHCP protocol should be used. 

According to the RHEL Network documentation. Dracut is probably running past the network init script using it's ifcfg module and defaulting it to dhcp since it doesn't know what static means. You might also try omitting the ifcfg module in dracut to see if that does what you expect, as well.

Related Topic