CentOS 7 minimal doesn’t get an IP address

Issues related to configuring your network
Post Reply
takeoff9048
Posts: 13
Joined: 2022/02/20 15:47:11

CentOS 7 minimal doesn’t get an IP address

Post by takeoff9048 » 2022/03/23 12:56:42

I have created a small closed cluster system running on centos 7 minimal and not connected to outside world. I have connected all the nodes via a switch and assign each of which a static IP inside the ifcfg-enp4s0 file. Each IP's are different from each other, so IP conflict is not the case at all.

On startup, the node gets IP but a couple of seconds later disconnects. I struggle to make it have the IP again by restarting either the network or doing ifup enp4s0. Sometimes I repeat this process maybe for 10 minutes so that it can get the IP assigned in the following config file.

Is there a way to fix this issue so that machine can have IP automatically?

Below is the output of the ethernet interface file ifcfg-enp4s0.

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
#DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
#IPV6INIT="yes"
#IPV6_AUTOCONF="yes"
#IPV6_DEFROUTE="yes"
#IPV6_FAILURE_FATAL="no"
#IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp4s0"
UUID="1fe7b71d-5b84-40af-a9e7-958188cf0d91"
DEVICE="enp4s0"
ONBOOT="yes"
IPADDR=192.168.1.105
KEY_MGMT="IEEE8021X"
#IEEE_8021X_EAP_METHODS="TTLS"
#IEEE_8021X_IDENTITY="I removed intenionally"
#IEEE_8021X_ANON_IDENTITY="I removed intenionally"
#IEEE_8021X_INNER_AUTH_METHODS="PAP"
#IPV6_PRIVACY="no"

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 7 minimal doesn’t get an IP address

Post by TrevorH » 2022/03/23 13:27:33

Pretty sure you need to specify either NETMASK= or PREFIX= (one or other, or both would need to agree).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

takeoff9048
Posts: 13
Joined: 2022/02/20 15:47:11

Re: CentOS 7 minimal doesn’t get an IP address

Post by takeoff9048 » 2022/03/23 17:39:30

TrevorH wrote:
2022/03/23 13:27:33
Pretty sure you need to specify either NETMASK= or PREFIX= (one or other, or both would need to agree).
The default config file does not include Netmask or Gateway or Prefix lines, that's why I did not modify or add them. However, I added them now. Hope It will work. Can not test it right now as I am running jobs on the cluster. As soon as the jobs are done, I will restart the machines to check if they get IPs automatically.

I will update the status later on.

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 7 minimal doesn’t get an IP address

Post by TrevorH » 2022/03/23 18:04:51

Saying "get ip's automatically" usually means "use DHCP" so I suspect what you really mean is "bring up the configured ip's correctly".
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: CentOS 7 minimal doesn’t get an IP address

Post by jlehtone » 2022/03/23 18:09:43

TrevorH wrote:
2022/03/23 13:27:33
Pretty sure you need to specify either NETMASK= or PREFIX= (one or other, or both would need to agree).
IIRC, PREFIX is used if it is defined. If not, then NETMASK. If neither ... no idea.
IMHO, PREFIX is way easier to use than NETMASK.

Default config (file) is set to use DHCP. That is, to "automatically" get network config from DHCP Server. That is why config has no values set.
One could run "dnsmasq" service in one machine. That is a DHCP (and DNS) Server. Although, static config in cluster is nice (when you get it right).

takeoff9048
Posts: 13
Joined: 2022/02/20 15:47:11

Re: CentOS 7 minimal doesn’t get an IP address

Post by takeoff9048 » 2022/03/23 22:15:29

TrevorH wrote:
2022/03/23 18:04:51
Saying "get ip's automatically" usually means "use DHCP" so I suspect what you really mean is "bring up the configured ip's correctly".
Sorry, my bad. Yeah, what I meant was to bring up the configured ip's correctly.

takeoff9048
Posts: 13
Joined: 2022/02/20 15:47:11

Re: CentOS 7 minimal doesn’t get an IP address

Post by takeoff9048 » 2022/03/26 11:24:26

I appended the following lines in the config file corresponding to the interface, however, it still does not work. I mean it does not get assigned IP automatically after booting up.
.....
.....
IPADDR=192.168.1.101
PREFIX=24
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
......
......

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: CentOS 7 minimal doesn’t get an IP address

Post by jlehtone » 2022/03/26 12:33:33

Redundant. NETMASK and BROADCAST are calculated from IPADDR and PREFIX; you don't need to set them.

First post: IPADDR=192.168.1.105. Now: IPADDR=192.168.1.101.

Lets get basic details:

Code: Select all

systemctl status NetworkManager
systemctl status network
nmcli d s
nmcli c s

takeoff9048
Posts: 13
Joined: 2022/02/20 15:47:11

Re: CentOS 7 minimal doesn’t get an IP address

Post by takeoff9048 » 2022/03/26 14:40:51

jlehtone wrote:
2022/03/26 12:33:33
Redundant. NETMASK and BROADCAST are calculated from IPADDR and PREFIX; you don't need to set them.
OK. I will then remove the lines corresponding to BROADCAST and NETMASK.
jlehtone wrote:
2022/03/26 12:33:33
First post: IPADDR=192.168.1.105. Now: IPADDR=192.168.1.101.
I have currently 5 nodes running in my small cluster. None are picking up the assigned IP automatically after rebooting. When I open up this issue on here, I dumped config file from node 5. Later on, I copied and pasted the config file from node 1, that's why IP's are different.

Below is the output of the commands I executed as directed. This time, I executed commands on the node2.

[ali_0@hep-node2 ~]$

Code: Select all

systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-03-15 23:30:18 +03; 1 weeks 4 days ago
Docs: man:NetworkManager(8)
Main PID: 885 (NetworkManager)
Tasks: 3
Memory: 6.6M
CGroup: /system.slice/NetworkManager.service
└─885 /usr/sbin/NetworkManager --no-daemon

Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.5955] device (enp4s0): state change: disconnected -> ...rnal')
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.5968] device (enp4s0): state change: prepare -> confi...rnal')
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.5978] device (enp4s0): state change: config -> ip-con...rnal')
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.5988] device (enp4s0): state change: ip-config -> ip-...rnal')
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.6010] device (enp4s0): state change: ip-check -> seco...rnal')
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.6017] device (enp4s0): state change: secondaries -> a...rnal')
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.6030] manager: NetworkManager state is now CONNECTED_LOCAL
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <info> [1647377606.6181] device (enp4s0): Activation: successful, device...vated.
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <warn> [1647377606.6852] ifcfg-rh: loading "/etc/sysconfig/network-scrip...8021X'
Mar 15 23:53:26 hep-node2 NetworkManager[885]: <warn> [1647377606.8493] ifcfg-rh: loading "/etc/sysconfig/network-scrip...8021X'
Hint: Some lines were ellipsized, use -l to show in full.


[ali_0@hep-node2 ~]$

Code: Select all

systemctl status network -l
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: active (exited) since Tue 2022-03-15 23:30:53 +03; 1 weeks 4 days ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0
Memory: 0B

Mar 15 23:30:48 hep-node2 systemd[1]: Starting LSB: Bring up/down networking...
Mar 15 23:30:48 hep-node2 network[1055]: Bringing up loopback interface: [ OK ]
Mar 15 23:30:53 hep-node2 network[1055]: Bringing up interface enp4s0: [ OK ]
Mar 15 23:30:53 hep-node2 systemd[1]: Started LSB: Bring up/down networking.


[ali_0@hep-node2 ~]$

Code: Select all

 nmcli d s
DEVICE TYPE STATE CONNECTION
enp4s0 ethernet connected enp4s0
enp66s0 ethernet unavailable --
lo loopback unmanaged --

[ali_0@hep-node2 ~]$

Code: Select all

nmcli c s
NAME UUID TYPE DEVICE
enp4s0 1d273234-c53f-4a00-a5c8-134b7e1acd5f ethernet enp4s0
enp66s0 8c9324a8-7879-4922-b004-2e59b9d064fa ethernet --
Wired connection 1 cf1ccc13-8a9a-37aa-a8b9-15d97cfddd80 ethernet --


However, the following output is from the last added node into the cluster system. Output is different than other nodes.

[ali_0@hep-node1 ~]$

Code: Select all

systemctl status network -l
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2022-02-03 15:30:37 EST; 19h ago
Docs: man:systemd-sysv-generator(8)
Process: 951 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Tasks: 0
Memory: 180.0K

Feb 03 15:30:32 hep-node1 systemd[1]: Starting LSB: Bring up/down networking...
Feb 03 15:30:33 hep-node1 network[951]: Bringing up loopback interface: [ OK ]
Feb 03 15:30:37 hep-node1 network[951]: Bringing up interface enp4s0: [ OK ]
Feb 03 15:30:37 hep-node1 network[951]: Bringing up interface enp66s0: Error: Connection activation failed: No suitable device found for this connection (device ens4f0 not available because profile is not compatible with device (mismatching interface name)).
Feb 03 15:30:37 hep-node1 network[951]: [FAILED]
Feb 03 15:30:37 hep-node1 systemd[1]: network.service: control process exited, code=exited status=1
Feb 03 15:30:37 hep-node1 systemd[1]: Failed to start LSB: Bring up/down networking.
Feb 03 15:30:37 hep-node1 systemd[1]: Unit network.service entered failed state.
Feb 03 15:30:37 hep-node1 systemd[1]: network.service failed.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: CentOS 7 minimal doesn’t get an IP address

Post by jlehtone » 2022/03/26 22:06:05

Okay, now we know that you have NetworkManager.service in use and network.service disabled.

When using NetworkManager, you should:
* use the NetworkManager tools, e.g. nmcli, nmtui, whatever GUI it has
* not edit files directly
* not attempt systemctl start network / service network start
* not run ifup enp4s0

Your machine(s) seem to have two NICs: enp4s0 and enp66s0. The second is not used?

On this node, I would first remove all configured connections:

Code: Select all

nmcli con del enp4s0
nmcli con del enp66s0
nmcli con del cf1ccc13-8a9a-37aa-a8b9-15d97cfddd80
One can use both name and uuid to specify connection. "Wired connection 1" is inconvenient name.

Then, create a connection:

Code: Select all

nmcli con add con-name lan type ethernet ifname enp4s0 ipv4.method manual ipv4.address 192.168.1.2/24 ipv6.method ignore
Note though that your config had KEY_MGMT="IEEE8021X" and I have no idea what that is, but I suspect that it is not a good thing.

The NetworkManager does create connections for all NICs on boot by default. There is a package NetworkManager-config-server that prevents that. Option B is to create a dummy, probably with:

Code: Select all

nmcli con add con-name enp66s0 type ethernet ifname enp66s0 ipv4.method disabled ipv6.method ignore connection.autoconnect no
Creation of connection should automatically bring it up too. If not, then

Code: Select all

nmcli con up lan
I usually look at state with the

Code: Select all

nmcli d s
nmcli c s
ip ro
nmcli
and if I did create connection named "lan", also its details with:

Code: Select all

nmcli c s lan

Post Reply