<![CDATA[Latest posts for the topic "Cấu hình DHCP server"]]> /hvaonline/posts/list/24.html JForum - http://www.jforum.net Cấu hình DHCP server 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:20:xx:xx:xx; fixed-address 172.31.0.1; } host xinhxinh { hardware ethernet 00:03:93:xx:xx:xx; 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.]]>
/hvaonline/posts/list/1297.html#6105 /hvaonline/posts/list/1297.html#6105 GMT
Cấu hình DHCP server /hvaonline/posts/list/1297.html#203858 /hvaonline/posts/list/1297.html#203858 GMT