DHCP

1.dhcp服务器,是为了给网络中主机分配ip地址

2.安装dhcp服务器

1 [root@test4 named]# yum install dhcp -y

3.查找dhcp服务配置模板

 1 [root@test4 named]# rpm -ql dhcp| more
 2 /etc/dhcpd.conf
 3 /etc/rc.d/init.d/dhcpd
 4 /etc/rc.d/init.d/dhcrelay
 5 /etc/sysconfig/dhcpd
 6 /etc/sysconfig/dhcrelay
 7 /usr/bin/omshell
 8 /usr/sbin/dhcpd
 9 /usr/sbin/dhcrelay
10 /usr/share/doc/dhcp-3.0.5
11 /usr/share/doc/dhcp-3.0.5/IANA-arp-parameters
12 /usr/share/doc/dhcp-3.0.5/README
13 /usr/share/doc/dhcp-3.0.5/RELNOTES
14 /usr/share/doc/dhcp-3.0.5/api+protocol
15 /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample  //这是模板
16 /usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-authentication-14.txt
17 /usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-dhcp-dns-12.txt

4.修改配置文件

 1 [root@test4 named]# cat /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample > /etc/dhcpd.conf 
 2 [root@test4 named]# vim /etc/dhcpd.conf 
 3 ddns-update-style interim;
 4 ignore client-updates;
 5 subnet 192.168.0.0 netmask 255.255.255.0 {             //分配地址网段
 6 # --- default gateway
 7         option routers                  192.168.0.1;   //配置默认路由
 8         option subnet-mask              255.255.255.0; //配置掩码
 9         option nis-domain               "domain.org";    
10         option domain-name              "domain.org";
11         option domain-name-servers      192.168.1.1;   //配置域名服务器地址
12         option time-offset              -18000; # Eastern Standard Time
13 #       option ntp-servers              192.168.1.1;   //配置时间服务器
14 #       option netbios-name-servers     192.168.1.1;
15 # --- Selects point-to-point node (default is hybrid). Don't change this unless
16 # -- you understand Netbios very well
17 #       option netbios-node-type 2;
18         range dynamic-bootp 192.168.0.128 192.168.0.254;
19         default-lease-time 21600;
20         max-lease-time 43200;
21         # we want the nameserver to appear at a fixed address
22         host ns {                                      //根据mac地址绑定地址
23                 next-server marvin.redhat.com;
24                 hardware ethernet 12:34:56:78:AB:CD;
25                 fixed-address 207.175.42.254;
26         }
27 }

5.配置超级作用域

1 shared-network dhcpname { 
2 
3 配置多个作用域
4 
5 } ;
原文地址:https://www.cnblogs.com/sangmu/p/6624031.html