rhel5下配置dhcp伺服器
dhcp 動态配置設定ip位址伺服器
優點:配置設定的ip位址不會重複,可以減輕管理者的負擔
開始配置:
yum install -y dhcp
//安裝軟體包
# cat /etc/dhcpd.conf
DHCP Server Configuration file.
see /usr/share/doc/dhcp*/dhcpd.conf.sample
//提示去找dhcpd.conf.sample
# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp: overwrite `/etc/dhcpd.conf'? y
//将檔案複制過去
vim /etc/dhcpd.conf
1 ddns-update-style interim; //DDNS
2 ignore client-updates; //不允許client更新DNS
3
4 subnet 192.168.0.0 netmask 255.255.255.0 { //要配置設定的網段、子網路遮罩
5
6 # --- default gateway
7 option routers 192.168.0.1; //路由器ip位址
8 option subnet-mask 255.255.255.0; //子網路遮罩
9
10 option nis-domain "domain.org";//nis伺服器域名現在已經不使用nis伺服器是以要注釋
11 option domain-name "domain.org";//為客戶設定域名
12 option domain-name-servers 192.168.1.1; //DNS伺服器的ip位址
13
14 option time-offset -18000; # Eastern Standard Time
15 # option ntp-servers 192.168.1.1;
16 # option netbios-name-servers 192.168.1.1;
17 # --- Selects point-to-point node (default is hybrid). Don't change this unl ess
18 # -- you understand Netbios very well
19 # option netbios-node-type 2;
20
21 range dynamic-bootp 192.168.0.128 192.168.0.254; //配置設定ip位址的範圍
22 default-lease-time 21600; //預設租約時間
23 max-lease-time 43200; //最大租約時間
24
25 # we want the nameserver to appear at a fixed address
26 host ns {
27 next-server marvin.redhat.com;
28 hardware ethernet 12:34:56:78:AB:CD;
29 fixed-address 207.175.42.254;
30 }
31 }
配置結束,啟動服務
service dhcpd start
使用用戶端測試,将ip獲得方式改為自動獲得,得到ip位址,完成!
本文轉自 周新宇1991 51CTO部落格,原文連結:http://blog.51cto.com/zhouxinyu1991/1269439,如需轉載請自行聯系原作者