Network Initscript and NetworkManager on RHEL 7/OL 7

NetworkManager is a suite of network management tools — GUI, CLI (nmcli), and TUI (nmtui — Text User Interface) designed to make networking maintenance simple. The idea is to eliminate the need to manually edit network configuration files directly.

Examples with the nmcli command:

root@joedb01:~# nmcli con show
NAME           UUID                                  TYPE      DEVICE
System ens192  3d523dd4-06e1-44dd-a940-e5d318a199d9  ethernet  ens192
System ens224  a825f353-a03b-4d9b-bc07-9b1c3c3da8a6  ethernet  --
System ens256  b0f7181f-2853-4971-8a2d-96d0839c02ca  ethernet  --
	 

root@joedb01:~# nmcli dev show ens192
GENERAL.DEVICE:                         ens192
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         00:50:56:AD:80:71
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     System ens192
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         10.71.12.166/26
IP4.GATEWAY:                            10.71.12.129
IP4.ROUTE[1]:                           dst = 10.71.12.128/26, nh = 0.0.0.0, mt = 100
IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 10.71.12.129, mt = 100
IP6.ADDRESS[1]:                         fe80::250:56ff:fead:8071/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 256

Network initscript (/etc/init.d/network, /etc/sysconfig/network-scripts) is a basic network interface start/stop framework that is part of the legacy initscripts package.

While both networking methodologies are available for use in RHEL 7, NetworkManager is now the default mechanism for RHEL 7. If NetworkManager is disabled by the administrator, then the fallback would be to use initscripts for network interface management.

Due to the increased focus in NetworkManager, RedHat has even stated it might deprecate Network Initscript in a future major release.

The network initscript methodology was originally designed to be synchronously loaded. This is not a problem for RHEL 5/6 where services are started one after another, so the system loads in a predictable way. Starting in RHEL 7, the boot process is highly parallelized with systemd and it’s the duty of services to cope with and dynamically react to any changes in the system. As such, the network initscript was not intended to be loaded this way and a number of timing issues have been uncovered where network devices may not start after system initialization.

In Red Hat Enterprise Linux 7, NetworkManager is started first, and /etc/init.d/network checks with NetworkManager to avoid tampering with NetworkManager’s connections. NetworkManager is intended to be the primary application using sysconfig configuration files, and /etc/init.d/network is intended to be secondary.

A few things to note:

  1. restart or reload NetworkManager.service or “nmcli conn reload” might not pick up new configurations. For example, if you add a static route in the file route-interface by either editing it directly or using nmcli command (e.g. nmcli connection modify “System ens192” +ipv4.routes “10.198.69.0/25 10.71.12.139”), it won’t be picked up by restarting or reloading methods aforementioned. Although you can bring down the interface and bring it up again, that will cause the lose of the connection.

Without rebooting the system or restart the interface itself, possible ways to do this are:

  • Use “ip route add” to add a route on the fly. Also put the static route into the file route-interface.
  • Or use “ifup-routes <interface>” to read the static route from the file route-interface.
  • If network.service is running, restart it will pick up the change without losing the connection. (reload doesn’t work for network.service)

2. A system can be configured to run either with NetworkManager or network.service, or both (default). If both NetworkManager and network are running. Stopping NetworkManager won’t bring down the network. But stopping network will bring down the network.

3. “If the default gateway is already assigned by DHCP and if the same gateway with the same metric is specified in a configuration file, an error during start-up, or when bringing up an interface, will occur. The follow error message may be shown: “RTNETLINK answers: File exists“. This error may be ignored.”

4. Extra unnecessary ifcfg files under /etc/sysconfig/network-scripts will cause network.service fail to start. For example, I’ve seen systems with ifcfg-ens224 and ifcfg-ens256 existing under /etc/sysconfig/network-scripts although the NICs have been removed at VM level in vSphere client. That caused the network.service startup failure. Once they are removed, network.service starts with no error. However, NetworkManager is not affected by this.


root@joedb01:/etc/sysconfig/network-scripts# systemctl status network.service
● 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 Fri 2021-05-28 14:15:51 CDT; 1 months 10 days ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1151 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

May 28 14:15:50 joedb01 network[1151]: Bringing up loopback interface:  [  OK  ]
May 28 14:15:51 joedb01 network[1151]: Bringing up interface ens192:  [  OK  ]
May 28 14:15:51 joedb01 network[1151]: Bringing up interface ens224:  Error: Connection activation failed: No suitable device found for this connection (device ens192 not available because profile is not compatible wit...interface name)).
May 28 14:15:51 joedb01 network[1151]: [FAILED]
May 28 14:15:51 joedb01 network[1151]: Bringing up interface ens256:  Error: Connection activation failed: No suitable device found for this connection (device ens192 not available because profile is not compatible wit...interface name)).
May 28 14:15:51 joedb01 network[1151]: [FAILED]
May 28 14:15:51 joedb01 systemd[1]: network.service: control process exited, code=exited status=1
May 28 14:15:51 joedb01 systemd[1]: Failed to start LSB: Bring up/down networking.
May 28 14:15:51 joedb01 systemd[1]: Unit network.service entered failed state.
May 28 14:15:51 joedb01 systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

root@joedb01:/etc/sysconfig/network-scripts# systemctl restart network.service
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

root@joedb01:/etc/sysconfig/network-scripts# systemctl status network.service
● 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 2021-07-08 17:39:38 CDT; 42s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 28848 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Jul 08 17:39:38 joedb01 network[28848]: RTNETLINK answers: File exists
Jul 08 17:39:38 joedb01 network[28848]: RTNETLINK answers: File exists
Jul 08 17:39:38 joedb01 network[28848]: RTNETLINK answers: File exists
Jul 08 17:39:38 joedb01 network[28848]: RTNETLINK answers: File exists
Jul 08 17:39:38 joedb01 network[28848]: RTNETLINK answers: File exists
Jul 08 17:39:38 joedb01 network[28848]: RTNETLINK answers: File exists
Jul 08 17:39:38 joedb01 systemd[1]: network.service: control process exited, code=exited status=1
Jul 08 17:39:38 joedb01 systemd[1]: Failed to start LSB: Bring up/down networking.
Jul 08 17:39:38 joedb01 systemd[1]: Unit network.service entered failed state.
Jul 08 17:39:38 joedb01 systemd[1]: network.service failed.

Reference:

https://access.redhat.com/solutions/783533

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s