Setup DHCP-server
DHCP-server
Objectives
Software
ISC DHCPd version 3.0.4
Prerequisite
None
Sources
Slackware CD, /slackware/n/dhcp-3.0.4-i486-2.tgz
http://www.isc.org/index.pl?/sw/dhcp/
Dependences
None
Installation
By Slackware std PKT
The DHCP configuration file:
# ISC DHCP-Server Configuration
# /etc/dhcpd.conf
#
default-lease-time 86400 ; # one day
max-lease-time 604800 ; # one week
ddns-update-style ad-hoc ;
ddns-updates on;
option ip-forwarding off;
option routers 192.168.2.1 ; # important when this corresponds to: ‘gateway’
option subnet-mask 255.255.255.0 ;
ignore client-updates ;
option broadcast-address 192.168.2.255 ;
option domain-name "mydomain.com" ;
option domain-name-servers 194.22.190.10 , 194.22.194.14; # important when this corresponds to: ‘DNS Servers’
#
# LAN
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.40 192.168.2.60;
}
# DMZ
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.40 192.168.3.60;
}
#
# List an unused interface here
subnet 192.168.1.0 netmask 255.255.255.128 {
}
Tests
You can test the configuration by, first stop and then start it in debug mode.
shell> killall dhcpd
shell> dhcpd -d &
This forces it to run on the foreground and you can see the result when the DHCP server handout a static IP-address
Start at boot
Add in the local system initialization script /etc/rc.d/rc.local
sh ./rc.dhcpd start
The script, /rc.dhcpd, it self looks like below:
#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
#
# Start/stop/restart the DHCP daemon.
#
# To make dhcpd start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.dhcpd
#
#############################################
CONFIGFILE="/etc/dhcpd.conf"
LEASEFILE="/var/state/dhcp/dhcpd.leases"
INTERFACES="eth1"
OPTIONS="-q"
#############################################
dhcpd_start() {
if [ -x /usr/sbin/dhcpd -a -r $CONFIGFILE ]; then
echo "Starting DHCPD..."
/usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
# /usr/sbin/dhcpd -q $INTERFACES
fi
}
dhcpd_stop() {
killall dhcpd
}
dhcpd_restart() {
dhcpd_stop
sleep 2
dhcpd_start
}
case "$1" in
'start')
dhcpd_start ;;
'stop')
dhcpd_stop ;;
'restart')
dhcpd_restart ;;
*)
echo "usage $0 start|stop|restart" ;;
esac
References, recommended readings
Objectives
DHCPD server is only needed if you have to distribute IP number to users within your local network.
It is recommended to use the default Slackware standard installation to handle this installation.Software
ISC DHCPd version 3.0.4
Prerequisite
None
Sources
Slackware CD, /slackware/n/dhcp-3.0.4-i486-2.tgz
http://www.isc.org/index.pl?/sw/dhcp/
Dependences
None
Installation
By Slackware std PKT
The DHCP configuration file:
# ISC DHCP-Server Configuration
# /etc/dhcpd.conf
#
default-lease-time 86400 ; # one day
max-lease-time 604800 ; # one week
ddns-update-style ad-hoc ;
ddns-updates on;
option ip-forwarding off;
option routers 192.168.2.1 ; # important when this corresponds to: ‘gateway’
option subnet-mask 255.255.255.0 ;
ignore client-updates ;
option broadcast-address 192.168.2.255 ;
option domain-name "mydomain.com" ;
option domain-name-servers 194.22.190.10 , 194.22.194.14; # important when this corresponds to: ‘DNS Servers’
#
# LAN
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.40 192.168.2.60;
}
# DMZ
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.40 192.168.3.60;
}
#
# List an unused interface here
subnet 192.168.1.0 netmask 255.255.255.128 {
}
Tests
You can test the configuration by, first stop and then start it in debug mode.
shell> killall dhcpd
shell> dhcpd -d &
This forces it to run on the foreground and you can see the result when the DHCP server handout a static IP-address
Start at boot
Add in the local system initialization script /etc/rc.d/rc.local
sh ./rc.dhcpd start
The script, /rc.dhcpd, it self looks like below:
#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
#
# Start/stop/restart the DHCP daemon.
#
# To make dhcpd start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.dhcpd
#
#############################################
CONFIGFILE="/etc/dhcpd.conf"
LEASEFILE="/var/state/dhcp/dhcpd.leases"
INTERFACES="eth1"
OPTIONS="-q"
#############################################
dhcpd_start() {
if [ -x /usr/sbin/dhcpd -a -r $CONFIGFILE ]; then
echo "Starting DHCPD..."
/usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
# /usr/sbin/dhcpd -q $INTERFACES
fi
}
dhcpd_stop() {
killall dhcpd
}
dhcpd_restart() {
dhcpd_stop
sleep 2
dhcpd_start
}
case "$1" in
'start')
dhcpd_start ;;
'stop')
dhcpd_stop ;;
'restart')
dhcpd_restart ;;
*)
echo "usage $0 start|stop|restart" ;;
esac
References, recommended readings
- ISC actual information.http://www.isc.org/index.pl?/sw/dhcp/dhcpv3-README.php
- http://www.faqs.org/docs/Linux-mini/DHCP.html#SLACKWARE some old.
- http://www.linux.se/doc/HOWTO/mini/DHCP/index.html some old.
- http://www.ops.ietf.org/dns/dynupd/secure-ddns-howto.html How handle security.
- http://alex.kruijff.org/FreeBSD/Dynamic_DNS.html How to set up DHCP to interact with a DNS server.
Thanks
Comments