ISC DHCP Server 3.0.4 Tips
Author: Hagen.GoO 转载请联系作者
MSN_contact: wantm009@hotmail.com
Keyword: ISC DHCP SERVER,dhcpd.conf
Quote: 
01、ISC DHCP Server 的配置文件中可分配IP是如何声明的?
答:
    对拥有多个IP网段的DHCP服务器,可以用 shared-network 声明;
             shared-network shared-network-name1 {
                        subnet 10.17.224.0 netmask 255.255.255.0 {
                        }
                        subnet 10.0.29.0 netmask 255.255.255.0 {
                        }
                        pool {
                                   allow members of "CLASSNAME1";
                                   range 10.17.224.10 10.17.224.250;
                        }
                        pool {
                                   deny members of "CLASSNAME2";
                                   range 10.0.29.10 10.0.29.230;
                        }
             }
    对于只有单个网段,又不需要特别管理的 DHCP Server,可以使用 subnet + range 声明;
             subnet 192.168.0.0 netmask 255.255.255.0 {
                        range 192.168.0.20 192.168.0.99;
                        range 192.168.0.200 192.168.0.250;
             }
    对于只有单个网段,但需要进行IP分配管理的 DHCP Server,可以使用 subnet + pool + range 声明;
             subnet 192.168.0.0 netmask 255.255.255.0 {
                         range 192.168.0.20 192.168.0.99;
                         range 192.168.0.200 192.168.0.250;
                         pool {
                                   allow members of "CLASSNAME3";
                                   range 192.168.0.100 192.168.0.149;
                         }
             }
    对单个MAC和IP绑定的单个主机,可以使用 Host 声明;
             host YOUR-HOSTNAME {
                                                      hardware ethernet 00:22:D6:6B:EA:11;
                                                      fixed-address 192.168.0.11;
             }
02、上述几种可用IP的声明,哪种优先级最高?
答:
    优先级最高的是 Host 声明;
    接下来是 带有 allow deny 关键字的 Pool (subnet + pool + range)声明,
    如果 allow deny 许可冲突,DHCP Server 只执行 allow 操作;
    再是不带allow deny关键字的普通 Pool;
    最次是 Subnet 或 Shared-network声明。
03、group 标签有什么用途?
答:
    group可以包含Shared-network,Subnet,Pools,Hosts的声明,可以分组管理,简化配置文件。比如:
               host host-name2 {
                                             hardware ethernet 01:02:DD:7B:E3:53;
                                             option routers 192.168.0.1;
                                             fixed-address 192.168.0.12;
               }
               host host-name3 {
                                             hardware ethernet 00:12:DC:0B:E3:A3;
                                             option routers 192.168.0.1;
                                             fixed-address 192.168.0.13;
               }
可以简化为
               group { 
                           option routers 192.168.0.253;
                           host host-name2 {
                           hardware ethernet 01:02:DD:7B:E3:53;
                           fixed-address 192.168.0.12;
                           }
                           host host-name3 {
                           hardware ethernet 00:12:DC:0B:E3:A3;
                           fixed-address 192.168.0.13;
                           }
                }
04、什么时候需要使用 class 标签?
答:
    对DHCP客户端进行分组,在IP Pools中,利用 Allow Deny 关键词进行不同地址池的分配,例如:
               class "class-name1" {
                                                   match if option user-class = "用户自定义ClassID";
                }
               class "class-name2" {
                                                   match if option user-class = "用户自定义ClassID2";
               }
               pool {
                         allow members of "class-name1";
                         range 192.168.0.100 192.168.0.149;
               }
               pool {
                         allow members of "class-name2";
                         range 192.168.0.150 192.168.0.199;
               }
05、if条件语句的使用方法?
答:
    ISC DHCP Server 的配置文件,支持 if…… elsif……的条件转向语句,比如针对 UserClassID 的信息,配置不同的生存时间和域名后缀:
               if option dhcp-user-class = "accounting" {
                                       max-lease-time 36000;
                                       option domain-name "accounting.example.org";
               } elsif option dhcp-user-class = "sales" {
                                       max-lease-time 17600;
                                       option domain-name "sales.example.org";
               }
更多DHCP选项,请参考 man dhcp-options 。
06、如何配置Windows系统的 UserClassID?
答:
    使用 ipconfig /setclassid adapter-NAME [classid];(启动了Windows的DHCP Client服务以后,才能执行)
    也可以修改注册表 HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\YOUR-NIC\ 下的 DhcpClassId (REG_SZ)。
没有评论:
发表评论