I am trying to set the eth0 interface to use dhcp to get an ipv4 address, using the command line. I can manually change the ip address using

sudo ifconfig eth0 x.x.x.x netmask x.x.x.x

Is there a similar command to use to set eth0 to get an address using dhcp? I tried typing:

sudo dhclient eth0 

however the ip address doesn't change when I type this. The /etc/network/interfaces file was set to

iface eth0 inet manual 

which I then changed to:

auto eth0
iface eth0 inet dhcp 

however this doesn't change the eth0 ip address even if the system is rebooted.


If your dhcp is properly configured to give you an IP address, the command:

dhclient eth0 -v 

should work. The option -v enable verbose log messages, it can be useful.

If your eth0 is already up, before asking for a new IP address, try to deconfigure eth0.

To configure the network interfaces based on interface definitions in the file /etc/network/interfaces you can use ifup and ifdown commands.


First you need to run the following command:

dhclient -v -r

Then change the ip adress:

ifconfig eth0 xx.xx.xx.xx

Change xx.xx.xx.xx with the needed ip_adress

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy