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

20,748

Solution 1

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).

Solution 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.

Share:
20,748

Related videos on Youtube

Rohit Muneshwar
Author by

Rohit Muneshwar

Updated on September 18, 2022

Comments

  • Rohit Muneshwar
    Rohit Muneshwar almost 2 years

    In my CentOS, i need to run dhclient -v command at every time i start/reboot the server. How to make this permanent please?

  • djsmiley2kStaysInside
    djsmiley2kStaysInside about 7 years
    What file should this be in?