Setting an network interface to use DHCP using nmcli

Adland Lee
Adland Lee
  • Updated

To set an interface to use DHCP with nmcli, you can follow these steps:

  1. Identify the interface you want to configure. You can list all available interfaces using:

    nmcli device status
    
  2. Set the interface to use DHCP. Replace INTERFACE_NAME with the name of your interface:

    nmcli device modify INTERFACE_NAME ipv4.method auto
    
  3. Bring the interface up to apply the changes:

    nmcli device connect INTERFACE_NAME
    

Here's an example for an interface named eth0:

nmcli device modify eth0 ipv4.method auto
nmcli device connect eth0

This will configure the eth0 interface to obtain an IP address via DHCP. If you have any more questions or need further assistance, feel free to ask!

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.