Sunday, 7 June 2009

DHCP server with ubuntu

first install the correct package :
sudo aptitude install dhcp3-server
then edit the configuration file :
vim /etc/dhcp3/dhcpd.conf
ddns-update-style none;

# option definitions common to all supported networks...

option domain-name "domain.tld"
option domain-name-servers 80.10.246.3, 80.10.246.1, 80.10.246.129;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).

log-facility local7;

# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.


# eth0 subnet configuration

subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.100 192.168.2.200;
option routers 192.168.2.254;
option broadcast-address 192.168.2.255;
}
Replace domain.tld by your local domain (keep the quotes around the domaine).
Replace the nameservers by your ISP domain servers (or your local DNS server)
then modify the subnet configuration according to your network.


Here I setup a dhcp server on network 192.168.2.0 (gateway : 192.168.2.254).

The dhcp server will attribute ip from 192.168.2.100 to 192.168.2.200.

then start the server :

sudo service dhcp3-server start

No comments: