Configuration files and common settings of NetworkManager

Updated at:

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:

PriorityPathPurpose
Lowest/usr/lib/NetworkManager/conf.dDefault software settings
—/run/NetworkManager/conf.d/Temporary runtime configurations
—/etc/NetworkManager/NetworkManager.confPrimary configuration file
Highest/etc/NetworkManager/conf.dCustom .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.

  1. Create and open the set-log.conf file:

    sudo vim /etc/NetworkManager/conf.d/set-log.conf
  2. Press I to enter Insert mode, then paste the following content:

    `level` values

    ValueDescription
    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

    ValueDescription
    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=ALL
  3. Press Esc, type :wq, and press Enter to save and close the file.

  4. Restart NetworkManager for the changes to take effect:

    sudo systemctl restart NetworkManager
  5. View 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.

  1. (Optional) Check the current NIC status:

    nmcli device status

    image

  2. Create and open the unmanaged.conf file:

    sudo vim /etc/NetworkManager/conf.d/unmanaged.conf
  3. Press I to enter Insert mode, then paste the following configuration:

    [keyfile]
    unmanaged-devices=interface-name:eth1
  4. Press Esc, type :wq, and press Enter to save and close the file.

  5. Restart NetworkManager for the changes to take effect:

    sudo systemctl restart NetworkManager
  6. Verify the change:

    nmcli device status

    The 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 .nmconnection file. Used for secondary NICs (for example, eth1) by default.

Plug-ins are applied in declaration order — the leftmost plug-in has the highest priority.

  1. Open the NetworkManager.conf file:

    sudo vim /etc/NetworkManager/NetworkManager.conf
  2. Press I to enter Insert mode, then add or update the plugins parameter:

    [main]
    plugins = ifcfg-rh, keyfile
  3. Press Esc, type :wq, and press Enter to save and close the file.

  4. Restart NetworkManager for the changes to take effect:

    sudo systemctl restart NetworkManager
  5. Verify that the plug-in configuration is active:

    sudo journalctl -u NetworkManager | grep -i "settings plugin"