fixing network manager after new NIC

Issues related to configuring your network
Post Reply
ron7000
Posts: 162
Joined: 2019/01/15 20:00:28

fixing network manager after new NIC

Post by ron7000 » 2022/09/07 14:27:35

the X520DP NIC in my server failed, it is a quad port network interface card,
I replaced it, system booted, now my Network Manager screen looks like this and I have no working network.
I assume because the new NIC has different MAC addresses which linux doesn't know about it's looking for the mac addresses of the failed NIC that's no longer present.
How does one properly fix this? thanks. This is CentOS 7.9 x86-64.


Image

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

Re: fixing network manager after new NIC

Post by jlehtone » 2022/09/13 06:32:14

I do manage configuration almost always from command line, with Ansible or nmcli for NetworkManager.service (NM).

NM can use MAC or name of interface to match a connection to a device.
CentOS installer sets MAC into the connection, while nmcli forces use of interface name (but allows adding MAC later).

NM has also default that if no connection has been defined for device, then one is generated (but not stored) during boot
and that connection does use DHCP. (One can disable these by installing package 'NetworkManager-config-server'.)

If your four connections do use MAC and those MAC do not exist, then those connections are not used
and if you have disabled automatic (e.g. by installing 'NetworkManager-config-server') then new connections are not created.

You can list the defined connections with nmcli c s

If 'name' of connection is "em1", then you can show its details with nmcli c s em1
(You can specify connection with uuid or name.)
There are two fields of interest: connection.interface-name and 802-3-ethernet.mac-address. One is probably empty (--) and the other has value.

You can list the devices with nmcli d s (the 's' means 'state') or more detailed with nmcli d show. There is field GENERAL.HWADDR
(which one can see with ip li too).

Lets say that connection 'em1' has (wrong) MAC set and you want to update it with new value (0a:1b:2c:3d:4e:5f):

Code: Select all

nmcli c mod em1 802-3-ethernet.mac-address 0a:1b:2c:3d:4e:5f
Alternative: remove MAC and bind with name:

Code: Select all

nmcli c mod em1 802-3-ethernet.mac-address "" connection.interface-name em1
Then, to ensure that connection starts to use the new value, restart it:
nmcli c down em1 ; nmcli c up em1
or restart NM:
systemctl restart NetworkManager


(All this assumes that you do use the default, NM, and have not explicitly fallen back to network.service.)

ron7000
Posts: 162
Joined: 2019/01/15 20:00:28

Re: fixing network manager after new NIC

Post by ron7000 » 2022/09/13 15:32:36

thanks, that was insightful. I am completely clueless when it comes to nmcli

Here is what I have
  • The server was built from dvd iso, as server with gui and everything was working fine.
  • NIC card failed, we actually replaced entire main board and also the NIC; the old NIC still resulted in a UEFI0056 error on boot the new main board then we replaced the NIC. Server booted back up, linux running except for network functionality.
  • The /etc/sysconfig/network-scripts/ifcfg-em1 to em4 files are not present after boot; I did not delete them I assume they are created every time on boot? Can any insight be given on this?
  • doing an ifconfig shows em1 to em4 with MAC addresses, but how do I know if those are correct and not of the old NIC?
  • doing a nmcli s shows nothing, em1..em4 does not display.
  • doing a nmcli s em1 or any of them results in no such connection profile
  • doing a nmcli d shows state disconnected for em1..em4
  • doing a nmcli d show displays the same MAC from what was shown via ifconfig for GENERAL.HWADDR for em1..em4

ron7000
Posts: 162
Joined: 2019/01/15 20:00:28

Re: fixing network manager after new NIC

Post by ron7000 » 2022/09/13 18:09:11

the other thing I am recognizing is the ifcfg-em1 from an identical working server, which is

Code: Select all

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
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=ens11f0
UUID=20dea36a-4375-4323-ad76-9867e4f43154
DEVICE=ens11f0
ONBOOT=no
The UUID ... which is universal unique identifier... that's gonna be different for every port of every NIC right? How do I get that value of an existing NIC? And then if I do not have any ifcfg- files under /etc/sysconfig/network-scripts other than ifcfg-lo how do I get one or properly create one?

My observations and learning experience thus far is, if you don't have existing and correct ifcfg-xxxxxx file(s) then you're networking is F'd. These ifcfg- files are critical to having network working, yes?

With the predictable network interface name crap that did away with eth syntax convention, what and how does DEVICE= get populated with the syntax ens11f0 in the above file? Because I've seen em1, eno1, and others between all the computers I have run linux on with centos 7.

Where / how does the mapping of network hardware to device name happen? Who decided the syntax? See below for reference...

Code: Select all

lspci output :

Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)                                   == Device ens11f

Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port Gigabit Ethernet PCIe                == Device em
Ethernet controller: Broadcom Inc. and subsidiaries BCM57412 NetXtreme-E 10Gb RDMA Ethernet Controller (rev 01)   == Device em

a pluggable dongle ASIX 88772 usb-to ethernet                                                                     == Device enp0s20f0u12

my asrock pc at home if I remember correctly                                                                      == Device eno
Last edited by ron7000 on 2022/09/13 19:13:00, edited 1 time in total.

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

Re: fixing network manager after new NIC

Post by jlehtone » 2022/09/13 19:09:24

ron7000 wrote:
2022/09/13 15:32:36
* The /etc/sysconfig/network-scripts/ifcfg-em1 to em4 files are not present after boot; I did not delete them I assume they are created every time on boot? Can any insight be given on this?
As said, if there is no connection for device, then NM creates one on every boot. If you modify such connection, then it is stored as file.
Up to EL8 NM did store most connections as /etc/sysconfig/network-scripts/ifcfg-* in format compatible with the legacy initscripts (ifup, ifdown). In EL9 format and location is different.
However, connections defined by installer (for original NICs) should still be there as files.
ron7000 wrote:
2022/09/13 15:32:36
* doing an ifconfig shows em1 to em4 with MAC addresses, but how do I know if those are correct and not of the old NIC?
* doing a nmcli d show displays the same MAC from what was shown via ifconfig for GENERAL.HWADDR for em1..em4
The ifconfig is old tool. The ip was introduced two decades ago as better alternative. All three (ifconfig, ip, nmcli) do show MACs of devices that do exist. They don't show what is not there.
ron7000 wrote:
2022/09/13 15:32:36
* doing a nmcli s shows nothing, em1..em4 does not display.
* doing a nmcli s em1 or any of them results in no such connection profile
Devil is in detail. Some abbreviation is allowed in the parameters:

Code: Select all

nmcli c s
nmcli con show
nmcli connection show
Those mean the same. Plain nmcli s does not.

If the four NICs do get config from DHCP, then it is up to the DHCP servers (on the other end of cables) to dictate what config they give. If you want predictable IP address, then config the DHCP server to hand up specific address for a MAC.
ron7000 wrote:
2022/09/13 18:09:11
With the predictable network interface name crap that did away with eth syntax convention, what and how does DEVICE= get populated with the syntax ens11f0 in the above file?
Frankly, the names are more crap than MAC addresses, and the "old names" are even more so; totally unpredictable.

Do not look at the ifcfg-* files. When NM creates connection, it assigns random UUID to it (in hopes that the UUID is unique within the machine) and shows the UUID too (if you need for further connections, like bridge-ports).

Read man nmcli-examples

nmcli con add type Ethernet ifname em1
creates connection (and a file too) and writes "DEVICE=em1" into it. For NM that means: connection.interface-name em1

When NetworkManager.service starts on boot it will find the file and use config it in for whichever device happens to have name "em1".
(I prefer to clear the connection.interface-name and set the 802-3-ethernet.mac-address to bind by MAC, not by name.)

What names the devices? Something earlier in the boot. I live happily without knowing those gory details.
Although, Red Hat explains them in https://access.redhat.com/documentation ... ice_naming


Plug cable into only one NIC port. Run ip li (short for ip link show). You should see which port has "link up", unlike all the others. Now you know one {name, MAC, physical port} triplet.


With lspci it is good to use '-nn', as in lspci -nn
That shows the usual stuff and Device ID. That ID is quite unabiguous to the exact model of device; drivers list IDs that they support.

ron7000
Posts: 162
Joined: 2019/01/15 20:00:28

Re: fixing network manager after new NIC

Post by ron7000 » 2022/09/13 19:29:13

Image

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

Re: fixing network manager after new NIC

Post by jlehtone » 2022/09/13 20:16:28

You are not wrong, but imagine this: machine with two ports.
* Boots, has eth0 and eth1 and network does not work. You manage to get the links up and save the config.
* Reboot. The eth0 and eth1 are there but network does not work. You manage to get the links up and save the config.
* Reboot. The eth0 and eth1 are there but network does not work. You manage to get the links up and save the config.
...

Why? The names did switch in (almost) every boot.


Part of presumed rationale:
A. You have ten ports: eth[0-9]
B. You have ten ports: em[01], ens5f[01], ens6f[01], ens7f[0-3]

Does one of these reveal more about the hardware than the other?

Post Reply