(1) 將 sample檔拷貝到 /etc/ 下(若原本已存在請覆蓋掉)
複製內容到剪貼板
代碼:
cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
(2)編輯設定檔
複製內容到剪貼板
代碼:
vi /etc/dhcpd.conf
複製內容到剪貼板
代碼:
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;
# }
}
(3) 檢查/var/lib/dhcp/dhcpd.leases 是否存在,若是沒有請創建一個空檔案即可
(4) 啟動服務
複製內容到剪貼板
代碼:
service dhcpd start
(5)測試
(6)完成