UnixPedia : HPUX / LINUX / SOLARIS: September 2023

Friday, September 22, 2023

Linux NetworkManager : Nic configuration

 In NetworkManager, network configurations, including IP address assignments, are typically managed through connection profiles stored in the /etc/NetworkManager/system-connections/ directory for system-wide configurations or in the ~/.config/NetworkManager/system-connections/ directory for user-specific configurations.

Each connection profile is stored in a separate file in these directories. These files are typically named after the connection's name, and they are usually in a format like connection-name.nmconnection.

You can edit the connection profile for a specific network interface to configure its IP address settings. Here's a general outline of how to do this:

  1. List Your Network Connections: You can use the following command to list all network connections managed by NetworkManager:

    bash
    nmcli connection show

  2. Edit the Connection Profile: To edit a specific connection profile (e.g., for Ethernet interface eth0), you can use the nmcli command with the edit option and specify the connection name:

    bash
    nmcli connection edit connection-name

    Replace connection-name with the name of the connection profile you want to edit.

  3. Configure IP Address: Once you're in the editing interface, you can configure the IP address settings. For example, to set a static IP address, you can use commands like:

    bash
    nmcli> set ipv4.addresses 192.168.1.10/24 nmcli> set ipv4.gateway 192.168.1.1

    Adjust these commands according to your specific network configuration.

  4. Save Changes: After configuring the IP address settings, save the changes:

    bash
    nmcli> save persistent

    This saves the changes to the connection profile.

  5. Exit the Editing Interface: Finally, exit the editing interface:

    bash
    nmcli> quit

The changes you make to the connection profile will be stored in the appropriate .nmconnection file in the corresponding directory, and NetworkManager will apply these settings the next time the network connection is activated.

Please replace connection-name and the IP address details with the actual connection name and IP settings you want to configure. Also, make sure to adapt these instructions to your specific network requirements and the connection profile you are working with.