DHCP伺服器配置:
動態主機設定協議(Dynamic Host Configuration Protocol, DHCP)是一個區域網路的網路通訊協定,使用UDP協議工作,主要有兩個用途:給內部網路或網路服務供應商自動分配IP地址,給使用者或者內部網路系統管理員作為對所有電腦作中央管理的手段。
1.檢查是否已安裝DHCP服務所需要的包:
[root@station252 ~]# rpm -qa | grep dhcdhclient-3.0.5-31.el5dhcp-devel-3.0.5-31.el5dhcp-3.0.5-31.el5DHCP伺服器需要這三個包.
2.修改DHCP設定檔:
[root@station252 ~]# vim /etc/dhcpd.confddns-update-style interim;ignore client-updates;subnet 192.168.253.0 netmask 255.255.255.0 { option time-offset -18000; # Eastern Standard Time range dynamic-bootp 192.168.253.2 192.168.253.8; default-lease-time 21600; max-lease-time 43200; ... 省略 #192.168.253.0 是準備分配的網段#range dynamic-bootp 192.168.253.2 192.168.253.8; IP位址集區.預設分配IP從192.168.253.2->192.168.253.8給特定主機指定固定ip地址host ns { hardware ethernet 12:34:56:78:AB:CD; fixed-address 207.175.42.254;}3.DHCP服務啟動方法:
[root@station252 ~]# /etc/init.d/dhcpd start啟動 dhcpd: [失敗][root@station252 ~]# service dhcpd start啟動 dhcpd: [失敗]<啟動失敗時請仔細檢查DHCP設定檔.>
4.更改DHCP服務的預設啟動方式:
[root@station252 ~]# chkconfig --list | grep dhcpddhcpd 0:關閉 1:關閉 2:關閉 3:關閉 4:關閉 5:關閉 6:關閉[root@station252 ~]# chkconfig dhcpd --level 35 on
5.範本
ddns-update-style interim;ignore client-updates;subnet 192.168.159.0 netmask 255.255.255.0 {# --- default gateway # 網關option routers192.168.0.1;option subnet-mask255.255.255.0;# 網域名稱option nis-domain"domain.org";option domain-name"domain.org";option domain-name-servers192.168.1.1;# 時間位移量option time-offset-18000;# Eastern Standard Time#option ntp-servers192.168.1.1;#option netbios-name-servers192.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.159.1 192.168.159.254;# 租約時間 6個小時default-lease-time 21600;# 最大租約時間 12個小時max-lease-time 43200;# we want the nameserver to appear at a fixed address# 固定IP地址host ns {# 此句可注釋next-server marvin.redhat.com;# MAX地址hardware ethernet 12:34:56:78:AB:CD;# 固定地址fixed-address 207.175.42.254;}}