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,如需转载请自行联系原作者