Configuration files and common settings of NetworkManager
NetworkManager manages network interface controller (NIC) configurations and connection status on Alibaba Cloud Linux 3. It detects available networks automatically, switches between networks as needed, and lets you configure IP addresses, gateways, and Domain Name System (DNS) settings.
NetworkManager configuration files
NetworkManager loads configuration files in sequence, with priority increasing from left to right:
| Priority | Path | Purpose |
|---|---|---|
| Lowest | /usr/lib/NetworkManager/conf.d | Default software settings |
| — | /run/NetworkManager/conf.d/ | Temporary runtime configurations |
| — | /etc/NetworkManager/NetworkManager.conf | Primary configuration file |
| Highest | /etc/NetworkManager/conf.d | Custom .conf files |
`/usr/lib/NetworkManager/conf.d`
Stores the default settings shipped with the software package. To override these defaults, place your custom settings in a higher-priority location, such as /etc/NetworkManager/conf.d, so they are not overwritten when the package is updated.
`/run/NetworkManager/conf.d/`
Stores temporary runtime configurations created by system services or startup scripts at boot time. Do not store custom settings here — the configurations are lost when the system restarts.
`/etc/NetworkManager/NetworkManager.conf`
The primary configuration file for NetworkManager. This file is updated when the package is removed or updated, so any custom settings you write here may be overwritten. Place custom settings in /etc/NetworkManager/conf.d instead.
`/etc/NetworkManager/conf.d`
The recommended location for custom settings. Create .conf files here to modify the default NetworkManager behavior. Settings in this directory are preserved across package updates. Files are read in lexicographic order by filename.
Common settings
Configure log settings
Enable verbose logging when you need to troubleshoot network issues or collect diagnostic information for a bug report. The level=TRACE and domains=ALL combination captures all available detail and is the recommended starting point for debugging.
Create and open the
set-log.conffile:sudo vim /etc/NetworkManager/conf.d/set-log.confPress
Ito enter Insert mode, then paste the following content:`level` values
Value Description OFFDisables all logging. ERROutputs logs at the error level. WARNOutputs logs at the warning level and higher levels. INFOOutputs logs at the information level. DEBUGOutputs logs at the debug level. TRACEOutputs detailed logs at the trace level. `domains` values
Value Description NONEDisables domain logging. ALLLogs all available domains. DEFAULTLogs the default set of domains. DHCPLogs Dynamic Host Configuration Protocol (DHCP) client activity. IPLogs IP management activity. [logging] level=TRACE domains=ALLPress
Esc, type:wq, and pressEnterto save and close the file.Restart NetworkManager for the changes to take effect:
sudo systemctl restart NetworkManagerView the logs:
journalctl -u NetworkManager
Exclude a NIC from NetworkManager management
By default, NetworkManager manages eth0 and eth1, but not lo. To prevent NetworkManager from managing a specific NIC, use the unmanaged-devices key.
(Optional) Check the current NIC status:
nmcli device status
Create and open the
unmanaged.conffile:sudo vim /etc/NetworkManager/conf.d/unmanaged.confPress
Ito enter Insert mode, then paste the following configuration:[keyfile] unmanaged-devices=interface-name:eth1Press
Esc, type:wq, and pressEnterto save and close the file.Restart NetworkManager for the changes to take effect:
sudo systemctl restart NetworkManagerVerify the change:
nmcli device statusThe excluded interface now shows as
unmanaged.
Configure plug-ins
NetworkManager uses two plug-ins to read and write network settings:
`ifcfg-rh`: reads and writes configurations in
/etc/sysconfig/network-scripts/ifcfg-*files. Used for the primary NIC (for example,eth0) by default.`keyfile`: a generic plug-in where each connection has a corresponding
.nmconnectionfile. Used for secondary NICs (for example,eth1) by default.
Plug-ins are applied in declaration order — the leftmost plug-in has the highest priority.
Open the
NetworkManager.conffile:sudo vim /etc/NetworkManager/NetworkManager.confPress
Ito enter Insert mode, then add or update thepluginsparameter:[main] plugins = ifcfg-rh, keyfilePress
Esc, type:wq, and pressEnterto save and close the file.Restart NetworkManager for the changes to take effect:
sudo systemctl restart NetworkManagerVerify that the plug-in configuration is active:
sudo journalctl -u NetworkManager | grep -i "settings plugin"