CentOS 5.5 DHCP伺服器安裝指南:
1.直接用yum -y dhcp安裝好dhcp rpm軟體包。也可以到http://pbone.net上下載即可。
2.安裝好之後就是拷貝設定檔dhcpd.conf檔案,在/usr/share/doc/dhcp-3.0/dhcpd.conf.example 把這個樣本檔案拷重新命名拷貝到 /etc/dhcpd.conf即可
3.vi /etc/dhcpd.conf 內容如下這個是我已經修改好的,只要修改這個檔案即可。
下載dhcpd.conf for CentOS 5.5
ddns-update-style interim;
ignore client-updates;
subnet 192.168.10.0 netmask 255.255.255.0 { //subnet一個子網中的用戶端,動態地指定ip地址,則在此subnet聲明中,必須包含一組ip位址範圍。
# --- default gateway
option routers 192.168.10.15; //網關地址
option subnet-mask 255.255.255.0;//子網路遮罩
option nis-domain "my.lk.org";
option domain-name "my.lk.org";
option domain-name-servers 202.101.172.35; //dns ip地址
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). Dont change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.10.128 192.168.10.254; //位址集區pool範圍地址
default-lease-time 21600;//預設的ip租用時間期限單位為秒
max-lease-time 43200;//ip租用最長的期限單位為秒
# we want the nameserver to appear at a fixed address //用來綁定伺服器的mac物理地址。
host ns {
next-server stationx.example.com;
hardware ethernet 00:0C:29:7E:7F:86;
fixed-address 192.168.10.223;
}
}
4.service dhcpd start 即可啟動,如果想開機啟動可以ntsysv 服務當中選擇dhcpd星號即可。
設定檔也可以寫成以下形式:
#//192.168.10.*
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.15; 網關
option subnet-mask 255.255.255.0; //子網路遮罩
option broadcast-address 192.168.10.255; //廣播位址
option domain-name-servers
202.101.172.xx,202.101.172.4.xx
range dynamic-bootp 192.168.10.20 192.168.10.150; //位址集區範圍
default-lease-time 21600;
max-lease-time 43200;
}