The IP address is lost after the NetworkManager is restarted.
Initially, the NM takes over all interfaces. To prevent the GW interface from being managed by the NM, modify the configuration file and enable the keyfile plug-in, as shown in the following figure.
[main]
plugins+=keyfile
[keyfile]
unmanaged-devices=interface-name:gw_*
Run the following command to take effect:
rm -rf /var/run/NetworkManager/devices/
systemctl restart NetworkManager
Oddly, the eth1 interface activated by the NM before the reboot is configured as the connection "System eth1" read from ifcfg-eth1. It specifies that eth1 obtains an IP address in DHCP mode.
After the NM service is restarted, the dhclient subprocess is stopped. The NM generates a new connection eth1. The connection.autoconnect attribute of the connection is no. The dhclient is not started.
Therefore, when the lease expires, the IP address of eth1 is lost. In this case, change other interfaces to obtain IP addresses in DHCP mode and run the ifdown and ifup commands to activate the corresponding ifcfg file. As a result, the DNS settings in resolv.conf obtained by DHCP on eth1 will be lost.
The attachment is the NM log after debugging is enabledNM-log-0926.txt