Redhat AS5U2配置DHCP服務器

 
首先安裝dhcp-3.0.5-7.el5.i386.rpm,
配置文件是/etc/dhcpd.conf,
租約數據庫文件是/var/lib/dhcpd/dhcpd.leases,
 
[root@mailsvr1 ~]# vi /etc/dhcpd.conf    
裏面沒什麼,
see /usr/share/doc/dhcp*/dhcpd.conf.sample 可以將這個文件覆蓋現在的文件
 
[root@mailsvr1 ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆蓋“/etc/dhcpd.conf”? y
 
/etc/dhcpd.conf文件的簡單解釋
ddns-update-style interim;  #定義所支持的DNS動態更新類型
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;     #子網掩碼:默認子網掩碼
        option nis-domain               "domain.org";      #nis域
        option domain-name              "domain.org";   #DNS後綴
        option domain-name-servers      192.168.1.1;  #DNS服務器地址
        option time-offset              -18000;                     # Eastern Standard Time
#       option ntp-servers              192.168.1.1;      #NTP服務器
#       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;
        range dynamic-bootp 192.168.0.128 192.168.0.254;   #動態IP地址範圍
        default-lease-time 21600;                             #默認IP租約時間,單位秒
        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;
        }
}

可以修改爲
ddns-update-style interim;
ignore client-updates;
 
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers     192.168.2.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.2.1;
option domain-name "haha.com";
range dynamic-bootp 192.168.2.20 192.168.2.250;
default-lease-time 21600;
max-lease-time 43200;
}
 
啓動服務;
/etc/init.d/dhcpd start
 
查看日誌/var/log/messages,出現如下,表示服務成功啓動。
Dec 23 19:57:33 mailsvr1 dhcpd: Internet Systems Consortium DHCP Server V3.0.5-RedHat
Dec 23 19:57:33 mailsvr1 dhcpd: Copyright 2004-2006 Internet Systems Consortium.
Dec 23 19:57:33 mailsvr1 dhcpd: All rights reserved.
Dec 23 19:57:33 mailsvr1 dhcpd: For info, please visit [url]http://www.isc.org/sw/dhcp/[/url]
Dec 23 19:57:33 mailsvr1 dhcpd: Wrote 1 leases to leases file.
Dec 23 19:57:33 mailsvr1 dhcpd: Listening . LPF/eth0/00:0c:29:16:82:ba/192.168.2/24
Dec 23 19:57:33 mailsvr1 dhcpd: Sending .   LPF/eth0/00:0c:29:16:82:ba/192.168.2/24
Dec 23 19:57:33 mailsvr1 dhcpd: Sending .   Socket/fallback/fallback-net
 
需要注意:
每行必須以分號結尾
局部配置必須包含在一對中括號之間
如果希望實現保留功能,比如有些FTP,共享服務器,
 
如果配置有錯誤,請查看日誌。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章