Linux/CentOS how to permanent inititate DHCP Client any reboot?
In my CentOS, i need to run dhclient -v
command at every time i start/reboot the server. How to make this permanent please?
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).
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.