# Configuring an Ethernet connection by using nmcli

<section class="section" id="bkmrk-2.1.%C2%A0configuring-an-">## [2.1. Configuring an Ethernet connection by using nmcli](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/configuring_and_managing_networking/configuring-an-ethernet-connection#configuring-an-ethernet-connection-by-using-nmcli)

<div class="center top initialized" id="bkmrk-copy-link" style="--_floating-content-translate: -22.46656036376953px -73px;"><div id="bkmrk-"><div aria-hidden="true" class=" ui " id="bkmrk--1"></div></div><div class=" dark " id="bkmrk-copy-link-1" role="status"><div class="section-link tooltip-content" slot="content"><span class="copy-link-text">Copy link</span></div></div></div>
If you connect a host to the network over Ethernet, you can manage the connection’s settings on the command line by using the `nmcli` utility.

**Prerequisites**

<div class="itemizedlist">- A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s configuration.

</div>**Procedure**

<div class="orderedlist">1. List the NetworkManager connection profiles:
    
    <div class="content-code-block-container"><div class="expandable fullHeight" style="column-gap: 50px;"><div><div aria-hidden="true" id="bkmrk--3"></div></div></div></div>```plaintext
    # <strong>nmcli connection show</strong>
    NAME                UUID                                  TYPE      DEVICE
    Wired connection 1  a5eb6490-cc20-3668-81f8-0314a27f3f75  ethernet  enp1s0
    ```
    
    <div class="content-code-block-container"><div class="expandable fullHeight" id="bkmrk--4" style="column-gap: 50px;"><div id="bkmrk--5"></div><div id="bkmrk--6"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--7"><div id="bkmrk--8"></div></div></div></div>By default, NetworkManager creates a profile for each NIC in the host. If you plan to connect this NIC only to a specific network, adapt the automatically-created profile. If you plan to connect this NIC to networks with different settings, create individual profiles for each network.
2. If you want to create an additional connection profile, enter:
    
    <div class="content-code-block-container" data-wrap-available="true"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--9"></div></div></div></div>```plaintext
    # <strong>nmcli connection add con-name <em><connection-name></em> ifname <em><device-name></em> type ethernet</strong>
    ```
    
    <div class="content-code-block-container" data-wrap-available="true"><div class="  " id="bkmrk--10" style="column-gap: 50px;"><div id="bkmrk--11" tabindex="0"></div><div id="bkmrk--12"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--13"><div id="bkmrk--14"></div></div><div class=" center " id="bkmrk--15"><div id="bkmrk--16"></div></div></div></div>Skip this step to modify an existing profile.
3. Optional: Rename the connection profile:
    
    <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--17"></div></div></div></div>```plaintext
    # <strong>nmcli connection modify "Wired connection 1" connection.id "Internal-LAN"</strong>
    ```
    
    <div class="content-code-block-container"><div class="  " id="bkmrk--18" style="column-gap: 50px;"><div id="bkmrk--19" tabindex="0"></div><div id="bkmrk--20"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--21"><div id="bkmrk--22"></div></div></div></div>On hosts with multiple profiles, a meaningful name makes it easier to identify the purpose of a profile.
4. Display the current settings of the connection profile:
    
    <div class="content-code-block-container"><div class="expandable truncated" style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--23"></div></div></div></div>```plaintext
    # <strong>nmcli connection show Internal-LAN</strong>
    ...
    connection.interface-name:     enp1s0
    connection.autoconnect:        yes
    ipv4.method:                   auto
    ipv6.method:                   auto
    ...
    ```
    
    <div class="content-code-block-container"><div class="expandable truncated" id="bkmrk--24" style="column-gap: 50px;"><div id="bkmrk--25" tabindex="0"></div><div id="bkmrk--26"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--27"><div id="bkmrk--28"></div></div></div></div>
5. Configure the IPv4 settings:
    
    <div class="itemizedlist">
    - To use DHCP, enter:
        
        <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--29"></div></div></div></div>```plaintext
        # <strong>nmcli connection modify Internal-LAN ipv4.method auto</strong>
        ```
        
        <div class="content-code-block-container"><div class="  " id="bkmrk--30" style="column-gap: 50px;"><div id="bkmrk--31" tabindex="0"></div><div id="bkmrk--32"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--33"><div id="bkmrk--34"></div></div></div></div>Skip this step if `ipv4.method` is already set to `auto` (default).
    - To set a static IPv4 address, network mask, default gateway, DNS servers, and search domain, enter:
        
        <div class="content-code-block-container" data-wrap-available="true"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--35"></div></div></div></div>```plaintext
        # <strong>nmcli connection modify Internal-LAN ipv4.method manual ipv4.addresses 192.0.2.1/24 ipv4.gateway 192.0.2.254 ipv4.dns 192.0.2.200 ipv4.dns-search example.com</strong>
        ```
        
        <div class="content-code-block-container" data-wrap-available="true"><div class="  " id="bkmrk--36" style="column-gap: 50px;"><div id="bkmrk--37" tabindex="0"></div><div id="bkmrk--38"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--39"><div id="bkmrk--40"></div></div><div class=" center " id="bkmrk--41"><div id="bkmrk--42"></div></div></div></div>
    
    </div>
6. Configure the IPv6 settings:
    
    <div class="itemizedlist">
    - To use stateless address autoconfiguration (SLAAC), enter:
        
        <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--43"></div></div></div></div>```plaintext
        # <strong>nmcli connection modify Internal-LAN ipv6.method auto</strong>
        ```
        
        <div class="content-code-block-container"><div class="  " id="bkmrk--44" style="column-gap: 50px;"><div id="bkmrk--45" tabindex="0"></div><div id="bkmrk--46"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--47"><div id="bkmrk--48"></div></div></div></div>Skip this step if `ipv6.method` is already set to `auto` (default).
    - To set a static IPv6 address, network mask, default gateway, DNS servers, and search domain, enter:
        
        <div class="content-code-block-container" data-wrap-available="true"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--49"></div></div></div></div>```plaintext
        # <strong>nmcli connection modify Internal-LAN ipv6.method manual ipv6.addresses 2001:db8:1::fffe/64 ipv6.gateway 2001:db8:1::fffe ipv6.dns 2001:db8:1::ffbb ipv6.dns-search example.com</strong>
        ```
        
        <div class="content-code-block-container" data-wrap-available="true"><div class="  " id="bkmrk--50" style="column-gap: 50px;"><div id="bkmrk--51" tabindex="0"></div><div id="bkmrk--52"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--53"><div id="bkmrk--54"></div></div><div class=" center " id="bkmrk--55"><div id="bkmrk--56"></div></div></div></div>
    
    </div>
7. To customize other settings in the profile, use the following command:
    
    <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--57"></div></div></div></div>```plaintext
    # <strong>nmcli connection modify <em><connection-name></em> <em><setting></em> <em><value></em></strong>
    ```
    
    <div class="content-code-block-container"><div class="  " id="bkmrk--58" style="column-gap: 50px;"><div id="bkmrk--59" tabindex="0"></div><div id="bkmrk--60"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--61"><div id="bkmrk--62"></div></div></div></div>Enclose values with spaces or semicolons in quotes.
    
    For details about which settings you can modify, see the `nm-settings(5)` man page on your system.
8. Activate the profile:
    
    <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--63"></div></div></div></div>```plaintext
    # <strong>nmcli connection up Internal-LAN</strong>
    ```
    
    <div class="content-code-block-container"><div class="  " id="bkmrk--64" style="column-gap: 50px;"><div id="bkmrk--65" tabindex="0"></div><div id="bkmrk--66"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--67"><div id="bkmrk--68"></div></div></div></div>

</div>**Verification**

<div class="orderedlist">1. Display the IP settings of the NIC:
    
    <div class="content-code-block-container" data-wrap-available="true"><div class="expandable truncated" style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--69"></div></div></div></div>```plaintext
    # <strong>ip address show enp1s0</strong>
    2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 52:54:00:17:b8:b6 brd ff:ff:ff:ff:ff:ff
        inet 192.0.2.1/24 brd 192.0.2.255 scope global noprefixroute enp1s0
           valid_lft forever preferred_lft forever
        inet6 2001:db8:1::fffe/64 scope global noprefixroute
           valid_lft forever preferred_lft forever
    ```
    
    <div class="content-code-block-container" data-wrap-available="true"><div class="expandable truncated" id="bkmrk--70" style="column-gap: 50px;"><div id="bkmrk--71" tabindex="0"></div><div id="bkmrk--72"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--73"><div id="bkmrk--74"></div></div><div class=" center " id="bkmrk--75"><div id="bkmrk--76"></div></div></div></div>
2. Display the IPv4 default gateway:
    
    <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--77"></div></div></div></div>```plaintext
    # <strong>ip route show default</strong>
    default via 192.0.2.254 dev enp1s0 proto static metric 102
    ```
    
    <div class="content-code-block-container"><div class="  " id="bkmrk--78" style="column-gap: 50px;"><div id="bkmrk--79" tabindex="0"></div><div id="bkmrk--80"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--81"><div id="bkmrk--82"></div></div></div></div>
3. Display the IPv6 default gateway:
    
    <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--83"></div></div></div></div>```plaintext
    # <strong>ip -6 route show default</strong>
    default via 2001:db8:1::fffe dev enp1s0 proto static metric 102 pref medium
    ```
    
    <div class="content-code-block-container"><div class="  " id="bkmrk--84" style="column-gap: 50px;"><div id="bkmrk--85" tabindex="0"></div><div id="bkmrk--86"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--87"><div id="bkmrk--88"></div></div></div></div>
4. Display the DNS settings:
    
    <div class="content-code-block-container"><div class="expandable truncated" style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--89"></div></div></div></div>```plaintext
    # <strong>cat /etc/resolv.conf</strong>
    search example.com
    nameserver 192.0.2.200
    nameserver 2001:db8:1::ffbb
    ```
    
    <div class="content-code-block-container"><div class="expandable truncated" id="bkmrk--90" style="column-gap: 50px;"><div id="bkmrk--91" tabindex="0"></div><div id="bkmrk--92"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--93"><div id="bkmrk--94"></div></div></div></div>If multiple connection profiles are active at the same time, the order of `nameserver` entries depend on the DNS priority values in these profiles and the connection types.
5. Use the `ping` utility to verify that this host can send packets to other hosts:
    
    <div class="content-code-block-container"><div class="  " style="column-gap: 50px;"><div tabindex="0"><div aria-hidden="true" id="bkmrk--95"></div></div></div></div>```plaintext
    # <strong>ping <em><host-name-or-IP-address></em></strong>
    ```
    
    <div class="content-code-block-container"><div class="  " id="bkmrk--96" style="column-gap: 50px;"><div id="bkmrk--97" tabindex="0"></div><div id="bkmrk--98"></div></div><div class="content-code-block-container-actions"><div class=" center " id="bkmrk--99"><div id="bkmrk--100"></div></div></div></div>

</div>**Troubleshooting**

<div class="itemizedlist">- Verify that the network cable is plugged-in to the host and a switch.
- Check whether the link failure exists only on this host or also on other hosts connected to the same switch.
- Verify that the network cable and the network interface are working as expected. Perform hardware diagnosis steps and replace defective cables and network interface cards.
- If the configuration on the disk does not match the configuration on the device, starting or restarting NetworkManager creates an in-memory connection that reflects the configuration of the device. For further details and how to avoid this problem, see the Red Hat Knowledgebase solution [NetworkManager duplicates a connection after restart of NetworkManager service](https://access.redhat.com/solutions/3068421).

</div></section>