2

I'm working on a system where we rename some of the network interfaces for consistency in the application. We're struggling to configure the IP addresses during the installation. I did a bit of testing, by configuring connections with nmtui and it seems as though there are two use cases:

Automatically named interface: When the interface name has the OS-designated name (example eno1), the connection configuration is stored in /etc/NetworkManager/system-connections/eno1.nmconnection

Renamed interface: When the interface name has been changed (example data by providing a DEVICE in the ifcfg- file), the connection configuration is stored in the /etc/sysconfig/network-scripts/ifcfg-data file.

Now in both cases, an ifcfg- file existed. In the case of eno1, the file sets the MTU and ZONE, in the case of data, it sets NAME and DEVICE.

Does anyone have an explanation, on why the apparent inconsistency and how I should pre-configure my interfaces given the two cases?

Update: I've done some further testing, and regardless of whether or not in include the NAME setting in ifcfg, as long as the device is set to something other than the default, NetworkManager will store the IP configuration for that interface in ifcfg. If you populate NAME and DEVICE with the original interface name, it will store the IP configuration in an .nmconnection file.

Prdufresne
  • 161
  • 1
  • 7

1 Answers1

0

I never found a way to pre-configure my renamed interfaces effectively, so the procedure we're using now is as follows:

  1. Do not configure the interfaces with the ks network command. This results in network configurations being configured against the default interface name in nmconnection key file format. You can do this if you need the interface during installation. We'll delete them later anyway.
  2. In the kickstart %post script:
    1. In the new file system (it should be mounted on /mnt/sysimage), create the ifcfg- files for the interfaces you want to rename. Include HWADDR with the MAC address of the interface DEVICE with the device name you want and NAME with the connection name you want.
    2. Create a network-config.sh script that will be run during the first boot that does the following:
      1. Deletes any automatically generated connections in /etc/NetworkManager/system-connections
      2. reloads network configurations (nmcli conn reload)
      3. uses nmcli to configure your network interfaces using the new device names
      4. disables then re-enables the interfaces
      5. Modifies your boot script to make sure the network-config.sh script is only run on the very first boot.

The end result is that renamed interfaces will have their IP configurations stored in /etc/sysconfig/network-scripts/ifcfg-* and your interfaces with default names will be configured in /etc/NetworkManager/system-connections/*.nmconnection

Prdufresne
  • 161
  • 1
  • 7