Stop dhclient manually

Asked by Stephan T

System is: ubuntu 10.4. I switch manually - using the command line - from dynamic (dhcp) IP to static (fixed) IP. The steps I follow are: 1. modify the /etc/network/interfaces in order to configure eth0 as static. 2. run /etc/init.d/networking restart. Everything works fine and my eth0 has now the new, static IP. The problem is this manipulation leaves the dhclient active and running. After a while it renews the lease and my IP becomes again a dynamic one. I don't know how to stop and disable manually the dhclient. The solution I found on Ubuntu groups is to uninstall the dhclient - which is too extreme. Should be a way just to disable it. Proof is if I use the Gnome interface to do the same thing the dhclient gets stopped and disabled when the eth0 is set to static IP. Thanks for the help.

Question information

English Edit question
Ubuntu bash Edit question
No assignee Edit question
Solved by:
Stephan T
Last query:
Last reply:
Revision history for this message
Ubfan (ubfan1) said :

Stopping a process is easy:
1)Identity the process id (pid) with the ps ax command (number in first column)
ps ax | grep [d]hcli
2)Send it a polite request to clean up and terminate:
sudo kill pid f
3)Do step 1 again, and if it still exists, blast it off the system:
sudo kill -9 pid

You should ask yourself, what is starting the dhclient? Do you remove the dhcp from the interfaces file?
You mention networkmanager -- If you are still trying to simultaneously run network-manager and manually manipulate the interfaces file, good luck. My experience it that network-manager does not play nicely, and will periodically rewrite the interfaces file with just it's loopback entry.

Revision history for this message
Stephan T (stman937-linux) said :


I guess you read only the title of my question :)

This is not about stopping a linux process. Try by yourself the solution you proposed. You will note the process restarts automatically. Kill is not a solution here. And in general is not a solution at all. You kill a Unix process when there is no other solution.

As there is no documentation about "dhclient", there is no controlling script in "/etc/init.d" or "/etc/init" I wonder how do they stop it in the "networkmanager". In one word I wonder how one can do it manually. Looks like this is a very hot secret :)

Anyhow, thanks trying.

Revision history for this message
Ubfan (ubfan1) said :

Network-manager has a selection box to use dhcp, so it's startup uses that to kick off the dhclient. (and maybe restart it if it dies).
Manually, you explictily tell the networking scripts to use/start dhcp/dhclient (you never answered my question if you removed the dhcp so if you didn't, that may be where the dhclient is getting started. Beyond those two network control mechanisms you mentioned, I'm sure there are others (like wicd,...) which may themselves kick off dhclient.

Revision history for this message
Stephan T (stman937-linux) said :

Hi again,

Still out of scope! I do not care about the Gnome-graphical-tool. It works!

I want to do the same thing manually in a shell session (gnome-terminal, xterm, whatever). I know
how to switch the IP from dynamic to static but I don't know how to stop the "dhclient". Do you
know? If yes please give me the light.


Revision history for this message
Ubfan (ubfan1) said :

You should care about the "Gnome-graphical-tool" aka network-manager because it is working as configured and restarting dhclient when it "dies" or is "killed". Until you change its configuration, it's going to keep right on doing that. I have previously told you how to do that, (change you ipv4 tab method to manual from DHCP). You might have to do that on all network interfaces (eth0 and wlan0 etc to make sure no dhclient is started). Or just turn off network-manager completely (System/Preferences/StartupApplications), because I found it sporadically rewrites my /etc/network/interfaces file with all my manual settings. I gave up doing the manual network config (except on servers), because network-manager just provided too much other stuff besides wireless.

Revision history for this message
Stephan T (stman937-linux) said :


You very kind trying to help me.

The system I'm having this problem runs as server without the graphical interface. There is no keyboard, mouse nor monitor on it. Console talks on serial (COM1). So you can see as much as I should care of the graphical interface I cannot. After browsing for some time the net I removed the DHCP client from all together. Others have same problem and seems this is the simplest way to work around it. Ubuntu team just added this package without any doc. Even the man page is a joke, not a real man doc.

Anyway, ubuntu is not my choice. I prefer Redhat, which is much more Unix-compliant, reliable and serious.

What puzzles me more there seems to be none knowing the straight answer to my question. Even the ISC, which authored the dhclient is not able to get me an answer. So I presume there are no more dhclient maintainers, hence the package is still part of ubuntu release.


Revision history for this message
Ubfan (ubfan1) said :

Manually, the dhclient is started with the addition of "dhcp" on the iface line in the /etc/network/interfaces file.
If that is not present, I have no idea what could be starting your dhclient. I didn't catch the fact your were trying to configure a server, sorry.

Revision history for this message
Stephan T (stman937-linux) said :

Hi all,

As usual and so well said by Murphy: "A problem which doesn't fix by itself is no worth to be taken care of!", here I am with the solution. The problem is not in the dhclient but caused by another S/W monster which is the network-manager. Here is the