[root@loaclhost /]mount /dev/hdc /hdc //掛載光盤到/dev/
[root@loaclhost /]cd hdc/Server //進入關盤的Server目錄
[root@loaclhost Server]rpm –ivh dhcp-3.0.5-7.el5.i386.rpm //rpm安裝DHCP的服務器端
[root@loaclhost Server]cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf // 將/etc/dhcpd.conf替換成/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample
//小提示:DHCP服務器默認情況下是沒有配置文件的,需要從/usr目錄下復制樣本,然後再進行修改,如果是熟練的工程師,可以直接創建。
[root@loaclhost Server]cd /etc
[root@loaclhost etc]vi dhcpd.conf
Ddns-update-style interim;
Ignore client-updates; //動態DNS解析
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; //子網掩碼
Option nis-domain "domain.org"; //NIS域名為domain.org
Option domai-name "domain.org"; //域名為domain.org
Option domain-name-servers "192.168.1.1"; //DNS
Option time-offset -18000; # eastern Standard Time //
# Option ntp-servers 192.168.1.1;
# Option netbios-name-servers 192.168.1.1;
# --- Selscts point-to-point node (default is hybrid). don't change thisunless
# -- you understand Netbios very well
# option netbios-node-type 2;
Range dynamic-bootp 192.168.0.128 192.168.0.254; //分配地址池
Default-lease-time 21600; //默認租約時間21600s
Max-lease-time 43200; //最大租約時間為43200s
# 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 192.168.0.11;
}
}
注:配置文件,橙色部分為全局配置;藍色部分為機遇MAC,主機名分配靜態IP。
[root@localhost etc]ifconfig eth0 192.168.0.1
[root@localhost etc]service dhcpd restart //重新啟動dhcpd服務