How to disable dhclient in CentOS
If your running multiple IPs on Linode server using CentOS 6.5 with cPanel, you may have to disable dhclient. An issue with dhclient running process in CentOS server was creating conflict.
# ps faux |grep dh
root 1931 0.0 0.0 2908 1160 ? Ss Sep15 0:01 /sbin/dhclient -1 -q -cf /etc/dhcp/dhclient-eth0.conf -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
cPanel recommends disable dhclient and configuring it accordingly. Linode provides some great documentation on how to disable dhclient. This article will help you better understand and shorten the process. Following Linode’s instructions, notice that there are three files that are part of configuration. For this instance, there are two only files necessary. Having a third file (ifcfg-eth0:1) is not necessary because that IP is already going to be configured in ifcfg-eth0.
Use the Linode Manager or Putty to SSH into your server. Edit (use vi command) the following files ifcfg-eth0 & create another file ifcfg-eth0:0 and use the bellow configuration as template. You will require the configuration information from your Linode Manager. Dashboard > Remote Access: Public Network contains your IPs & Gateways.
<– file 1: /etc/sysconfig/network-scripts/ifcfg-eth0 –>
####
# Configuration for eth0
#
DEVICE=eth0
BOOTPROTO=none
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
# The address, netmask, and gateway are all necessary.
IPADDR=01.234.56.78
NETMASK=255.255.255.0
GATEWAY=198.58.101.1
<–file 2: /etc/sysconfig/network-scripts/ifcfg-eth0:0 –>
####
# Configuration for eth0:0
#
DEVICE=eth0:0
BOOTPROTO=none
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
# The address, and netmask, are necessary.
IPADDR=09.010.11.12
NETMASK=255.255.255.0
*In second file eth0:0 you don’t need to include the gateway.
Restart the network!
# service network restart
That’s it, now you disable dhclient on your Linode server running CentOS 6.5!
Additionally, you may wan to set ipaliases as monitored within the servers Service Manager. An effort to ensure that IPs defined in /etc/ips remain bound to the system.
Linux Static IP Configurations: https://www.linode.com/docs/networking/linux-static-ip-configuration