Results 1 to 5 of 5
Hi
Can anyone please tell me how to disable dhclient on redhat host.
I have set static IP to one of my redhat host but I don't know how it ...
- 05-24-2010 #1Just Joined!
- Join Date
- May 2010
- Posts
- 2
dhclient
Hi
Can anyone please tell me how to disable dhclient on redhat host.
I have set static IP to one of my redhat host but I don't know how it changes to some other IP after few hours.
here is the output from ifcfg-eth0 and rc.local
Code:
test-123 root # cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=X.X.X.X
NETMASK=255.255.255.0
GATEWAY=X.X.X.X
test-123 root # cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
test-123 #
snip from /var/log/messages
May 24 16:05:37 server dhclient: DHCPDISCOVER on lo to 255.255.255.255 port 67 interval 13
May 24 16:05:50 server dhclient: DHCPDISCOVER on lo to 255.255.255.255 port 67 interval 3
May 24 16:05:53 server dhclient: No DHCPOFFERS received.
May 24 16:05:53 server dhclient: No working leases in persistent database - sleeping.
Thanks for help.
Tannu
- 05-25-2010 #2
Hello and Welcome!

After assigning your network info, have you already tried restarting the network to enable your changes?
Should beCode:service network restart
Jay
New users, read this first.
New Member FAQ
Registered Linux User #463940
I do not respond to Private Messages asking for Linux help. Please, keep it on the public boards.
- 05-25-2010 #3Just Joined!
- Join Date
- May 2009
- Posts
- 13
Looking at your messages file, it looks like your loopback interface is set to ask for DHCP.
Can you run the following:
ls -la /etc/sysconfig/network-scripts/
then give us a cat *filename* of all files starting with "ifcfg-"
- 05-25-2010 #4
My guess is that dhclient is getting run somewhere with no arguments. That will cause it to attempt dhcp discovery on ALL interfaces, no matter their BOOTPROTO. Are the snipped messages the only dhclient logs you get? If my guess is correct, you should also have some like:
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPOFFER from 192.168.0.1
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.0.1
bound to 192.168.0.106 -- renewal in 34590 seconds.
That's from testing the scenario on a Fedora 12 box with a static address. In F12, mkinitrd has a dependency on dhclient, so you would not want to remove the package. You could effectively disable it by renaming the executable:
mv /sbin/dhclient /sbin/dhclient.real
Reverse the mv after troubleshooting to put it back.
You could also try to figure out what's running dhclient with a script. After doing the mv,
echo "ps -ef|grep $$ >> /tmp/dhclient" > /sbin/dhclient
chmod 755 /sbin/dhclient
Then watch for contents in /tmp/dhclient, which should contain ps lines for the parent process(es) that called dhclient. More ways to skin this cat; others may have better suggestions.
- 05-25-2010 #5Just Joined!
- Join Date
- May 2010
- Posts
- 2
Thanks all for your replies.
Really appreciate your help.
I figured out that the dhclient process was running so I killed the process kill -9 <pid> and after that the IP has not changed.
Thanks
Tann


Reply With Quote