Ubuntu works the apt-get way and hence makes it easy to install packages on it for confuguring Ubuntu as a DHCP server install the server software using the following command
$ sudo apt-get install dhcp3-server
this would install the required packages
after the package is installed backup the default configuration files using the following
$ sudo cp /etc/default/dhcp3-server dhcp3-server.back
dhcp3-server is a file where you specify the interface DHCP should server (wlan0 in mycase)
edit the file using
$ sudo vim /etc/default/dhcp3-server
change
INTERFACES=””
to
INTERFACES=”wlan0”
(wlan0 might be eth0 or eth1 in your case)
save and close the file
only one more file editing is required now create a backup for mail dhcpd.conf using
$ sudo cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.back
edit the file using
$ sudo vim /etc/dhcp3/dhcpd.conf
change
# option definitions common to all supported networks…
option domain-name “example.org”;
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
to
#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;
and
# A slightly different configuration for an internal subnet.
#subnet 10.5.5.0 netmask 255.255.255.224 {
# range 10.5.5.26 10.5.5.30;
# option domain-name-servers ns1.internal.example.org;
# option domain-name “internal.example.org”;
# option routers 10.5.5.1;
# option broadcast-address 10.5.5.31;
# default-lease-time 600;
# max-lease-time 7200;
#}
to
# A slightly different configuration for an internal subnet.
subnet 192.160.0.0 netmask 255.255.255.0 {
range 192.168.0.50 192.168.0.100;
option domain-name-servers 192.168.0.1;
option domain-name “mydomain.local”;
option routers 192.168.0.2;
option broadcast-address 192.168.0.255;
default-lease-time 600;
max-lease-time 7200;
}
thats it
restart the dhcp server using
$ sudo /etc/init.d/dhcp3-server restart
this server will start allocating IP dynamically.