Monday, December 6, 2010

3 DHCP SERVER

This post will explain how to configure a DHCP Server running on Ubuntu Server 9.04 (Jaunty Jackalope) for more than one interfaces and more than one network.
This post assume you have :
- A private network with 192.168.123.0/24
Three network on which you have to assign dinamic IP Addresses, for example a LAB network, an SUP Network (Support) and a WIFI network with the following subnet.
- 192.168.124.0/24 (sup)
- 192.168.125.0/24 (lab)
- 192.168.127.0/24 (wifi)
This post also assume you have a system running ubuntu (or debian) with four (4) NIC each one connected to one of the network above, and you will have the following configuration :
SUP network
Server IP Address : 192.168.124.1
DHCP Scope : 192.168.124.100 – 192.168.124.200
Gateway : 192.168.124.254
LAB network
Server IP Address : 192.168.125.1
DHCP Scope : 192.168.125.100 – 192.168.125.200
Gateway : 192.168.125.254
WIFI network
Server IP Address : 192.168.127.1
DHCP Scope : 192.168.127.100 – 192.168.127.200
Gateway : 192.168.127.254
The name server for all the networks will be a server in the internal network (192.168.123.2).
First of all you have to install DHCP server, for doing so, type :
sudo apt-get install dhcp3-server
After this you have to check your network interfaces configuration by editing the /etc/network/interfaces as the following.
Note that eth0 on the internal network is configured for obtaining a dinamic ip address from another DHCP server, but if you want you should assign to it a static ip address.
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The SUP network interface
auto eth1
iface eth1 inet static
address 192.168.124.1
netmask 255.255.255.0
network 192.168.124.0
broadcast 192.168.124.255
# The LAB network interface
auto eth2
iface eth2 inet static
address 192.168.125.1
netmask 255.255.255.0
network 192.168.125.0
broadcast 192.168.125.255
# The WIFI network interface
auto eth3
iface eth3 inet static
address 192.168.127.1
netmask 255.255.255.0
network 192.168.127.0
broadcast 192.168.127.255
Now you have to declare on which interfaces the DHCP server will listen for DHCP request, default is eth0 only.
You can do it by editing /etc/default/dhcp3-server as follow :
INTERFACES=”eth1 eth2 eth3″
At this point you have “only” to configure your DHCP Scope to assign IP on all networks by editing /etc/dhcp3/dhcpd.conf as following :
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
# Avoid to serve anythings on INTERNAL network
subnet 192.168.123.0 netmask 255.255.255.0 {
}
# The SUP network scope
subnet 192.168.124.0 netmask 255.255.255.0 {
range 192.168.124.100 192.168.124.200;
option routers                  192.168.124.254;
option subnet-mask              255.255.255.0;
option broadcast-address        192.168.124.255;
option domain-name-servers      194.168.123.2;
option domain-name              “damatc.local”;
option ntp-servers              194.168.123.2;
option netbios-name-servers     194.168.123.2;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
}
# The LAB network scope
subnet 192.168.125.0 netmask 255.255.255.0 {
range 192.168.125.100 192.168.125.200;
option routers                  192.168.125.254;
option subnet-mask              255.255.255.0;
option broadcast-address        192.168.125.255;
option domain-name-servers      194.168.123.2;
option domain-name              “damlab.local”;
option ntp-servers              194.168.123.2;
option netbios-name-servers     194.168.123.2;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
}
# The WIFI network scope
subnet 192.168.127.0 netmask 255.255.255.0 {
range 192.168.127.100 192.168.127.200;
option routers                  192.168.127.254;
option subnet-mask              255.255.255.0;
option broadcast-address        192.168.127.255;
option domain-name-servers      194.168.123.2;
option domain-name              “damwifi.local”;
option ntp-servers              194.168.123.2;
option netbios-name-servers     194.168.123.2;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
}
Hope this help
Bye
Riccardo : http://www.riccardoriva.com/archives/693

No comments:

Post a Comment