[Article] Cấu hình DHCP server |
12/07/2006 21:11:36 (+0700) | #1 | 6105 |
|
tranvanminh
HVA Friend
|
Joined: 04/06/2003 06:36:35
Messages: 516
Location: West coast
Offline
|
|
Nội dung
1. Giới thiệu
2. Cấu hình DHCP
3. Tham khảo
Giới thiệu
Cấu hình DHCP
Soạn file cấu hình /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 172.16.0.0 netmask 255.240.0.0 {
# default gateway
option routers 172.31.255.254;
option subnet-mask 255.240.0.0;
option nis-domain "nis-domain";
option domain-name "domain.name";
option domain-name-servers ns1.domain.name, ns2.domain.name;
# ntp server, nếu có
# option ntp-servers 172.16.0.2;
# dành 100 địa chỉ IP cho DHCP client
range dynamic-bootp 172.30.255.1 172.30.255.100;
default-lease-time 7200;
max-lease-time 18000;
# những máy luôn nhận IP cố định
host duyendang {
hardware ethernet 08:00:20xxx;
fixed-address 172.31.0.1;
}
host xinhxinh {
hardware ethernet 00:03:93xxx;
fixed-address 172.31.0.2;
option host-name "xinhxinh";
}
}
Xong khởi động dhcpd
# /etc/init.d/dhcpd start
Ví dụ về script khởi động /etc/init.d/dhcpd (của FC1)
#!/bin/sh
#
# dhcpd This script takes care of starting and stopping
# dhcpd.
#
# chkconfig: - 65 35
# description: dhcpd provide access to Dynamic Host Control Protocol.
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
. /etc/sysconfig/dhcpd
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/dhcpd ] || exit 0
[ -f /etc/dhcpd.conf ] || exit 0
[ -f /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases
RETVAL=0
prog="dhcpd"
configtest()
{
local retval TEMP=/tmp/dhcpd$$.err
/usr/sbin/dhcpd -t 2>$TEMP
retval=$?
if [ $retval -ne 0 ]
then
cat $TEMP
rm -f $TEMP
fi
return $retval
}
start() {
# Start daemons.
echo -n $"Starting $prog: "
daemon /usr/sbin/dhcpd ${DHCPDARGS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc dhcpd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcpd
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
configtest || exit $?
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcpd ]; then
stop
start
RETVAL=$?
fi
;;
configtest)
configtest
RETVAL=$?
;;
status)
status dhcpd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
exit 1
esac
exit $RETVAL
Tham khảo
1. /usr/share/doc/dhcp-x.x.x/dhcpd.conf.sample
2. man dhcpd.conf
Nguồn : http://james.dyndns.ws/index.php
James Nguyen. |
|
|
|
|
[Article] Cấu hình DHCP server |
25/01/2010 14:53:24 (+0700) | #2 | 203858 |
meomagadong
Member
|
0 |
|
|
Joined: 20/12/2009 00:12:07
Messages: 2
Offline
|
|
cảm ơn rất nhiều mình đang rất cần cái này |
|
|
Users currently in here |
1 Anonymous
|
|
Powered by JForum - Extended by HVAOnline
hvaonline.net | hvaforum.net | hvazone.net | hvanews.net | vnhacker.org
1999 - 2013 ©
v2012|0504|218|
|
|