The Computer Oracle

Linux/CentOS how to permanent inititate DHCP Client any reboot?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dream Voyager Looping

--

Chapters
00:00 Linux/Centos How To Permanent Inititate Dhcp Client Any Reboot?
00:20 Accepted Answer Score 20
00:51 Answer 2 Score 2
01:17 Thank you

--

Full question
https://superuser.com/questions/578293/l...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #centos #boot #dhcp

#avk47



ACCEPTED ANSWER

Score 19


In CentOS, put the following into /etc/sysconfig/network-scripts/ifcfg-ethX:

DEVICE=ethX
BOOTPROTO=dhcp
ONBOOT=yes
HWADDR=XX:XX:XX:XX:XX:XX

Of course change ethX to your interface name (eth0, eth1 or similar).

Similarly, change HWADDR to yours interface MAC address. You can see it by looking at the output of ifconfig -a command (the part after HWaddr keyword).




ANSWER 2

Score 2


Had a similar issue. dhclient wouldn't start on boot, even though the config looked to be correct. After a while i remembered that this is case sensitive.

BOOTPROTO=DHCP

will not start your dhclient on boot.

BOOTPROTO=dhcp

The value needs to be lowercase.