linux-dhcp作用域和类

安装dhcp server

[root@myhost ~]# hostname dhcp

[root@myhost ~]# Last login: Wed Oct  5 11:38:14 2011 from 192.168.100.1

[root@dhcp ~]# mkdir /mnt/cdrom

[root@dhcp ~]# mount /dev/cdrom /mnt/cdrom

mount: block device /dev/cdrom is write-protected, mounting read-only

[root@dhcp ~]# cd /mnt/cdrom/Server/

[root@dhcp Server]# rpm -ivh dhcp-3.0.5-18.el5.i386.rpm

 

[root@dhcp Server]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth0

BOOTPROTO=static

BROADCAST=192.168.100.255

HWADDR=00:0C:29:14:B3:4D

IPADDR=192.168.100.70

NETMASK=255.255.255.0

NETWORK=192.168.100.0

ONBOOT=yes

~

[root@dhcp etc]# vim /etc/resolv.conf

nameserver 192.168.100.70

超级作用域、空作用域、绑定

[root@dhcp Server]# vim /etc/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

shared-network zzu {

subnet 192.168.20.0 netmask 255.255.255.0 {

        option routers                  192.168.20.254;

        option subnet-mask              255.255.255.0;

 

        option nis-domain               "domain.org";

        option domain-name              "tec.com";

        option domain-name-servers      192.168.100.70;

 

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.20.128 192.168.20.254;

        default-lease-time 21600;

        max-lease-time 43200;

        host tec {      ---ipmac的绑定,保证每

 

次分配的地址都是固定的。

                next-server marvin.redhat.com;

                hardware ethernet 12:34:56:78:AB:CD;

                fixed-address 192.168.20.100;

        }

}

subnet 192.168.30.0 netmask 255.255.255.0 {

        option routers                  192.168.30.254;

        option subnet-mask              255.255.255.0;

 

        option nis-domain               "domain.org";

        option domain-name              "mkt.com";

        option domain-name-servers      192.168.100.70;

 

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.30.128 192.168.30.254;

        default-lease-time 21600;

        max-lease-time 43200;

        host mkt {               

                next-server marvin.redhat.com;

                hardware ethernet 00:0C:29:F4:CD:0F;

                fixed-address 192.168.30.100;

        }

}

subnet 192.168.100.0 netmask 255.255.255.0 {

}

}

# DHCP Server Configuration file.

#   see /usr/share/doc/dhcp*/dhcpd.conf.sample

#

~

~

~

"/etc/dhcpd.conf" 45L, 1209C written

[root@dhcp Server]#

[root@dhcp Server]#

[root@dhcp Server]#

[root@dhcp Server]# service dhcpd configtest

Syntax: OK

[root@dhcp Server]#       

 

类别

--根据不同的用户群分配不同的地址

 [root@dhcp etc]# vim dhcpd.conf

ddns-update-style interim;

ignore client-updates;

�D�D作用域 和服务器选项的 小区域优先选项

 

subnet 192.168.20.0 netmask 255.255.255.0 {

--定义类

class "vm" {

     match if substring (hardware,1,3) = 00:0C:29; --mac地址前三位匹配的分配的类

}

--基于厂商的分类

class  “microsoft-client”  {

    match if substring (option  vendor-class-identifier) =MSFT;

    option  网关;

    option   dns

}

        option routers                  192.168.20.254;

        option subnet-mask              255.255.255.0;

        option domain-name              "tec.com";

        option domain-name-servers      192.168.100.70;

--引用类

pool {

        allow members of "vm";

        range 192.168.20.1 192.168.20.50;

}

--如果不是vm类的mac分配下面的地址

pool {

        deny members of "vm";

        range 192.168.20.100 192.168.20.150;

}

        default-lease-time 21600;

        max-lease-time 43200;

}

"dhcpd.conf" 23L, 547C written                               

[root@dhcp etc]# service dhcpd configtest

Syntax: OK

[root@dhcp etc]#

 

 

Client

Linuxclient

#ifconfig eth0 down

#dhclient -d eth0

--Linux从大到小分的

--Windows相反

 

windows client

ipconfig /release

ipconfig /renew

 

 

更改动态dns指向

#vim /etc/resolv.conf

nameserver 222.88.88.88

nameserver 222.85.85.85

--DNS是动态产生的nameserver 更改的会被动态产生的覆盖,不想

 

被覆盖需要在

client 设置:

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

--设置添加参数

PEERDNS=NO

你可能感兴趣的:(类,linux,作用域,休闲,linux-dhcp)