Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Ubuntu server 12.10 as DRBL and CloneZilla. How can I find out how many IP addresses have been assigned to the clients. How do I control/monitor the DHCP daemon service(stop/start/status)?

share|improve this question

To monitor Dhcp leases just type in terminal :

gedit /var/lib/dhcp/dhcpd.leases 
share|improve this answer
Is gedit really the best way to peek into that file? First, it requires a desktop environment, which is usually not present on a server installation. Second: launching an editor suggests this file could be modified, but I'm pretty sure that editing it can cause nothing but trouble. – Rafał Cieślak Dec 10 '14 at 18:50

To list all the active Clients IP's you can use namp.It can list you both DHCP and as well as static clients also.

you can install namp in your PC with

sudo apt-get install nmap

Then to list all the active clients you can do like ,

 nmap -v -sP

here the IP's from 0 to 255 will be scanned and active IP's will be showup.

The better network monitor I can found my self is nethogs. you can get it by installing with

sudo apt-get install nethogs

Then simply

sudo nethogs <connection_name>

Can show the traffic monitor in your terminal.

hope this can help you.

share|improve this answer
Big difference between assigned and active though, this will miss a lot of the inactive ones – Meer Borg Mar 8 '13 at 14:51

The script used to control the DHCP daemon depends on which one you're using. I'm assuming isc-dhcp-server. Then it would be:

service isc-dhcp-server stop
service isc-dhcp-server start
service isc-dhcp-server status

If that doesn't work, look in /etc/init for a config file named after dhcp, and use that. Say your config file is called dhcpd3.conf, then you'd replace isc-dhcp-server in the above commands with dhcpd3.

To see "how many ip addresses have been assigned to clients", which was your original request, you can do this:

grep "^lease" /var/lib/isc-dhcp-server/dhcpd.leases |sort |uniq |wc -l

This will plainly give you the number of assigned addresses.

Again, if you get an error about /var/lib/isc-dhcp-server not being findable, look in /var/lib and replace it with something suggestind a dhcp server, usually dhcp or dhcp3

Note that as mentioned in another answer, this will miss the distinction between assigned and active (i.e. with a system using them at the moment) addresses. Also, if a client is forcefully shutdown and doesn't release the lease, you will also get unused addresses reported as assigned.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.