Jay Taylor's notes
back to listing indexuse dhcp on eth0 using command line
[web search]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.
Your Answer
|
asked |
1 year, 6 months ago |
|
viewed |
40,289 times |
|
active |
Related
site design / logo © 2018 Stack Exchange Inc; user contributions licensed under cc by-sa 3.0 with attribution required. rev 2018.5.25.30529
This site is not affiliated with Linus Torvalds or The Open Group in any way.