venerdì 16 dicembre 2011

Configure DHCP server onto Ubuntu Server 11.04

Hi all,
today I will show you how to configure a DHCP server onto Ubuntu Server 11.04 already running.

first you should check that the server has a static ip address,

vi /etc/network/interfaces


in my case is something like this:

auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.255
gateway 192.168.0.1

then check for the name servers:

vi /etc/resolv.conf


I have this:
nameserver 192.168.0.1


if you change yours files (interfaces and/or resolv.conf) , you need to type this:

/etc/init.d/networking restart


check also your hostname file:

vi /etc/hosts

should be something like this:

127.0.0.1          localhost.localdomain  localhost
192.168.0.100  server1.example.com server1

bcause in my case the server is called "server1"

DHCP installation and configuration


First download and install the dhcp service:

sudo apt-get install dhcp3-server


after the installation you will see a failed status, but it's ok, because we still need to configure the service.

vi /etc/dhcp/dhcpd.conf


Now we are going to change the file to configure our subnet,
in my case my server is 192.168.0.100 so my configuration will be something like this:

subnet 192.168.0.0 netmask 255.255.255.0 {
 range 192.168.0.10 192.168.0.50;
 option broadcast-address 192.168.0.255;
 option routers 192.168.0.1;
}

This way the service will release addresses in the range 192.168.0.10 -> 192.168.0.50

save the file and restart the dhcp service:

/etc/init.d/isc-dhcp-server start


Now the dhcp should be working fine.

There are a lot of other options that can be configured in the dhcpd.conf file, check the documentaiton for that

bye
Digger

Nessun commento:

Posta un commento