Wednesday, February 8, 2012

Install DHCP Server on Debian 6.0 (Squeeze)

Dynamic Host Configuration Protocol, used to service the request from the client IP address. The function of DHCP, we don't need to configure IP on the computer, call it Zero Configuration. Then, client will be request for Ip Address on the server, then the server will provide IP allocation remaining.

Installation
Applications for DHCP Server on Debian called dhcp3-server.
#apt-get install dhcp3-server
Generating /etc/default/dhcp3-server...
Starting DHCP server: dhcpd3check syslog for diagnostics. failed! failed!
invoke-rc.d: initscript dhcp3-server, action "start" failed.

Every install the dhcp server, the message failed. This is because the Ip Address in our computer and Ip Address on default file configuration of dhcp3-server. Leave it, because it will be normal itself.

Configuration
Let's edit dhcp3-server file configuration. That file is dhcp.conf.
#nano /etc/dhcp3/dhcp.conf
Put "#" on all lines. Except the script line below. Adjust the allocation of ip with the network topology.
#. . .
# A slightly different configuration for an internal subnet.
subnet 10.122.2.1 netmask 255.255.255.0 {
range 10.122.2.100 10.122.2.150;
option domain-name-servers 10.122.2.1;
option domain-name "26maret1991.net";
option routers 10.122.2.1;
option broadcast-address 10.122.2.255;
default-lease-time 600;
max-lease-time 7200;
}
#. . .

Testing on Linux
If the computer have two or more Ethernet card. So we must knew, which one the Ethernet card would receive DHCP Server service. For that, edit the default file dhcp as follows.
#nano /etc/default/isc-dhcp-server
#. . .
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1" #change to “eth1” as your Ethernet configuration
#. . .
#/etc/init.d/dhcp3-server restart
If your client using the Linux operating system, please following this command. Then, the computer will get IP address automatically.
#dhclient eth0
In that condition, client IP would be lost if we restart the computer. To make Dhcp configuration continue, even if we reboot the computer, then we must edit the interfaces file. Then change it to dhcp mode.
#vim /etc/network/interfaces
#. . .
auto eth0
iface eth0 inet dhcp
#/etc/init.d/networking restart

No comments: