Saturday, 21 November 2009

Install and Configure quickly a DHCP Server

NOTE: These commands have been tested in Debian version unstable.

DHCP stands for Dynamick Host Configuration Protocol. This protocol allows to automatically obtain an IP address and set the network configuration.

We install a DHCP server:
#aptitude install dhcp3-server

Next step is configuring the DHCP server:
We have to set correcty the /etc/dhcp3/dhcpd.conf file.

There is a configuration file example at:

e.g: I added these lines to my /etc/dhcp3/dhcpd.conf

subnet netmask {
option routers;
option domain-name-servers,;

subnet and netmask indicate the network addresses of our network:
e.g: subnet netmask match,, and IP addresses.

range means which addresses can be returned by our dhcp server, here, it can return and

routers indicates the gateway

domain-name-servers shows all dns addresses separated by commas.

Once we have correctly set dhcpd.conf file we restart the dhcp daemon:
#/etc/init.d/dhcp3-server restart

If everything has gone fine, we will execute in a client computer:
$sudo dhclient eth0

and the dhcp server will associate an IP adress to eth0 interface.

NOTE: dhcp3-client package provides dhclient command.
#aptitude install dhcp3-client

Sunday, 1 November 2009

Shell Script that shows Network Speed

The following shell script shows current download and upload speeds for the network interface you choose.

Copy the shell script in a file named, i.e:

Then after setting execution permissions:
$ chmod a+x

You can run the shell script passing as the first argument the network interface you want to monitor:
$ ./ eth0

You will get a line like that:
ppp0 DOWN:15 KB/s UP:880 B/s

This script works parsing /proc/net/dev file and calculating the difference between current transmitted or received bytes and their values one second ago.