danny 2006-11-19 18:55
快速建構DHCP Service (For CentOS)
(1) 將 sample檔拷貝到 /etc/ 下(若原本已存在請覆蓋掉)
[code]cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf[/code]
(2)編輯設定檔
[code]vi /etc/dhcpd.conf[/code]
[code]
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
#設定預設閘道(必要)
option routers 192.168.0.1;
#設定子遮罩(必要)
option subnet-mask 255.255.255.0;
#若您有使用NIS服務當作帳號認證請設定,一般狀況下不需要
# option nis-domain "domain.org";
#若您有使設定網域服務請設定,一般狀況下不需要
# option domain-name "domain.org";
#設定主要及次要DNS服務
option domain-name-servers 168.95.1.1;
option domain-name-servers 210.66.72.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
#設定IP範圍及租期
range dynamic-bootp 192.168.0.200 192.168.0.230;
default-lease-time 21600;
max-lease-time 43200;
#若您有給予特定主機固定IP請依下列設定
# we want the nameserver to appear at a fixed address
# host ns {
# next-server marvin.redhat.com;
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 207.175.42.254;
# }
}[/code]
(3) 檢查/var/lib/dhcp/dhcpd.leases 是否存在,若是沒有請創建一個空檔案即可
(4) 啟動服務
[code]service dhcpd start[/code]
(5)測試
[img]http://www.ihao.org/php/web/dhcp/dhcp1.jpg[/img]
[img]http://www.ihao.org/php/web/dhcp/dhcp2.jpg[/img]
(6)完成