DHCP Server Setup For Ubuntu
DHCP Server Setup For Ubuntu
Installation
Configuration
dhcp3-server and multiple interfaces
multiple interfaces example
Dynamic Host Configuration Protocol (DHCP)
The Dynamic Host Configuration Protocol (DHCP) is a network service that enables host
computers to be automatically assigned settings from a server as opposed to manually
configuring each network host. Computers configured to be DHCP clients have no
control over the settings they receive from the DHCP server, and the configuration is
transparent to the computer's user.
Installation
At a terminal prompt, enter the following command to install dhcpd:
You also need to edit /etc/default/dhcp3-server to specify the interfaces dhcpd should
listen to. By default it listens to eth0.
Configuration
The error message the installation ends with might be a little confusing, but the
following steps will help you configure the service:
Most commonly, what you want to do is assign an IP address randomly. This can be
done with settings as follows:
nano -w /etc/dhcp3/dhcpd.conf
# Sample /etc/dhcpd.conf
# (add your comments here)
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";
If you need to specify a WINS server for your Windows clients, you will need to include
the netbios-name-servers option, e.g.
nano -w /etc/default/dhcp3-server
nano -w /etc/network/interfaces
auto lo
iface lo inet loopback
mapping hotplug
script grep
map eth1
auto eth0
iface eth0 inet static
address 10.152.187.1
netmask 255.255.255.0
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
up
auto eth1
Select Interface card
nano -w /etc/default/dhcp3-server
INTERFACES="wlan0 eth0"
Configure Subnet
nano -w /etc/dhcp3/dhcpd.conf
ddns-update-style none;
log-facility local7;
option routers
192.168.1.1;
option subnet-mask
255.255.255.0;
option broadcast-address
192.168.1.255;
option domain-name-servers
option ntp-servers
194.168.4.100;
192.168.1.1;
option netbios-name-servers
192.168.1.1;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
host bla1 {
hardware ethernet DD:GH:DF:E5:F7:D7;
fixed-address 192.168.1.2;
}
host bla2 {
hardware ethernet 00:JJ:YU:38:AC:45;
fixed-address 192.168.1.20;
}
}
option routers
10.152.187.1;
option subnet-mask
255.255.255.0;
option broadcast-address
10.152.187.255;
option domain-name-servers
option ntp-servers
194.168.4.100;
10.152.187.1;
option netbios-name-servers
10.152.187.1;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
host bla3 {
hardware ethernet 00:KK:HD:66:55:9B;
fixed-address 10.152.187.2;
}
}
Check Route
ip route