Rabu, 04 November 2009

DHCP-server

Objectives Tujuan
DHCD server is only needed if you have to distribute IP number to users within your local network. DHCD server hanya diperlukan jika Anda memiliki nomor IP untuk mendistribusikan kepada pengguna dalam jaringan lokal Anda.
It is recommended to use the default Slackware standard installation to handle this installation. Dianjurkan untuk menggunakan standar Slackware standar instalasi untuk instalasi ini.
Fine tune, konfigurasikan
The DHCP configuration file: Pada file konfigurasi DHCP:
# ISC DHCP-Server Configuration # ISC DHCP-Server Configuration
# /etc/dhcpd.conf # / Etc / dhcpd.conf
# #
default-lease-time 86400 ; # one day default-lease-time 86400; # satu hari
max-lease-time 604800 ; # one week max-lease-time 604800; # satu minggu
ddns-update-style ad-hoc ; DDNS-update-style ad-hoc;
ddns-updates on; DDNS di-update;
option ip-forwarding off; option ip-forwarding off;
option routers 192.168.2.1 ; # important when this corresponds to: 'gateway' option routers 192.168.2.1; # penting saat ini berkaitan dengan: 'gateway'
option subnet-mask 255.255.255.0 ; option subnet-mask 255.255.255.0;
ignore client-updates ; ignore client-updates;
option broadcast-address 192.168.2.255 ; option broadcast-address 192.168.2.255;
option domain-name "mydomain.com" ; option domain-name "mydomain.com";
option domain-name-servers 194.22.190.10 , 194.22.194.14; # important when this corresponds to: 'DNS Servers' option domain-name-servers 194.22.190.10, 194.22.194.14; # penting saat ini berkaitan dengan: 'DNS Server'
# #
# LAN # LAN
subnet 192.168.2.0 netmask 255.255.255.0 { subnet 192.168.2.0 netmask 255.255.255.0 (
range 192.168.2.40 192.168.2.60; range 192.168.2.40 192.168.2.60;
} )
# DMZ # DMZ
subnet 192.168.3.0 netmask 255.255.255.0 { subnet 192.168.3.0 netmask 255.255.255.0 (
range 192.168.3.40 192.168.3.60; range 192.168.3.40 192.168.3.60;
} )
# #
# List an unused interface here # List an unused interface disini
subnet 192.168.1.0 netmask 255.255.255.128 { subnet 192.168.1.0netmask255.255.255.128 (
} )
Tests Tes
You can test the configuration by, first stop and then start it in debug mode. Anda dapat menguji konfigurasi oleh, pertama dan kemudian mulai berhenti dalam modus debug.
shell> killall dhcpd shell> killall dhcpd
shell> dhcpd -d & 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 Ini memaksa untuk berjalan di depan dan Anda dapat melihat hasilnya bila DHCP server handout statis IP-address
Start at boot Mulai saat boot
Add in the local system initialization script /etc/rc.d/rc.local Tambahkan dalam sistem lokal initialization script / etc / rc.d / rc.local
sh ./rc.dhcpd start sh. / rc.dhcpd mulai
The script, /rc.dhcpd, it self looks like below: Script, / rc.dhcpd, itu sendiri terlihat seperti berikut:
#!/bin/sh #! / bin / sh
# #
# /etc/rc.d/rc.dhcpd # / Etc / rc.d / rc.dhcpd
# #
# Start/stop/restart the DHCP daemon. # Start / stop / restart daemon DHCP.
# #
# To make dhcpd start automatically at boot, make this # Untuk membuat dhcpd start secara otomatis ketika boot, membuat ini
# file executable: chmod 755 /etc/rc.d/rc.dhcpd # File executable: chmod 755 / etc / rc.d / rc.dhcpd
# #
############################################# #############################################
CONFIGFILE="/etc/dhcpd.conf" CONFIGFILE = "/ etc / dhcpd.conf"
LEASEFILE="/var/state/dhcp/dhcpd.leases" LEASEFILE = "/ var / state / dhcp / dhcpd.leases"
INTERFACES="eth1" Antarmuka = "eth1"
OPTIONS="-q" OPTIONS = "-q"
############################################# #############################################
dhcpd_start() { dhcpd_start () (
if [ -x /usr/sbin/dhcpd -a -r $CONFIGFILE ]; then if [-x / usr / sbin / dhcpd-a-r $ CONFIGFILE], kemudian
echo "Starting DHCPD..." echo "Starting dhcpd ..."
/usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES / usr / sbin / dhcpd-cf $ CONFIGFILE-lf LEASEFILE $ $ $ PILIHAN antarmuka
# /usr/sbin/dhcpd -q $INTERFACES # / Usr / sbin / dhcpd-q $ antarmuka
fi fi
} )
dhcpd_stop() { dhcpd_stop () (
killall dhcpd killall dhcpd
} )
dhcpd_restart() { dhcpd_restart () (
dhcpd_stop dhcpd_stop
sleep 2 2 tidur
dhcpd_start dhcpd_start
} )
case "$1" in case "$ 1" di
'start') 'mulai')
dhcpd_start ;; dhcpd_start;;
'stop') 'stop')
dhcpd_stop ;; dhcpd_stop;;
'restart') 'restart')
dhcpd_restart ;; dhcpd_restart;;
*) *)
echo "usage $0 start|stop|restart" ;; echo "usage $ 0 start | stop | restart";;
esac esac

0 komentar:

Posting Komentar