DHCP是Dynamic Host Configuration Protocol的缩写,它是TCP/IP协议簇中的一种,主要是用来给网络客户机分配动态的IP地址,它的前身是BOOTP.
DHCP是Dynamic Host Configuration Protocol的缩写,它是TCP/IP协议簇中的一种,主要是用来给网络客户机分配动态的IP地址,它的前身是BOOTP,BOOTP 原本是用于无磁盘主机连接的网络上面的。
(1) DHCP服务器发现阶段。DHCP客户机向广播地址255.255.255.255发送DHCPDiscover消息。
(2) DHCP服务器响应阶段。DHCP服务器从尚未出租的IP地址池中择一个分配给DHCP客户机,向DHCP客户机发送一个包含出租的IP地址和其他设置的DHCPoffer提供信息。
(3) IP地址择阶段。DHCP客户机择某个DHCP服务器提供的IP地址,以广播方式回答一个DHCPrequest请求信息.
(4) IP地址确认阶段。服务器回应包含它所提供的IP地址和其他设置的DHCPack确认信息。然后客户机将其与TCP/IP协议与网卡绑定。
(5) 客户机重新登录。再次发送前次分配的IP地址的DHCPRequest请求请求信息,DHCP服务器检查是否可以继续让客户机使用,然后发回DHCPack确认信息或者DHCPnck否认信息。如果IP已不能用,客户机需从(1)开始重新申请。
(6) 更新租约。IP地址租借期限到了,如果DHCP客户机要延长其租约,必须更新。DHCP客户机启动时和IP租约期限过一半时,都会向服务器发送更新期IP租约的信息。
    # dhcpd.conf  
    # Sample configuration file for ISC dhcpd  
    # option definitions common to all supported networks...  
    option domain-name "";  
    option domain-name-servers,;  
    default-lease-time 600;  
    max-lease-time 7200;  
    # Use this to enble / disable dynamic dns updates globally.  
    #ddns-update-style none;  
    # If this DHCP server is the official DHCP server for the local  
    # network, the authoritative directive should be uncommented.  
    # Use this to send dhcp log messages to a different log file (you also  
    # have to hack syslog.conf to complete the redirection).  
    log-facility local7;  
    # No service will be given on this subnet, but declaring it helps the   
    # DHCP server to understand the network topology.  
    subnet netmask {  
    # This is a very basic subnet declaration.  
    subnet netmask {  
      option routers,;  
    # This declaration allows BOOTP clients to get dynamic addresses,  
    # which we don't really recommend.  
    subnet netmask {  
      range dynamic-bootp;  
      option broadcast-address;  
      option routers;  
    # A slightly different configuration for an internal subnet.  
    subnet netmask {  
      option domain-name-servers;  
      option domain-name "";  
      option routers;  
      option broadcast-address;  
      default-lease-time 600;  
      max-lease-time 7200;  
    # Hosts which require special configuration options can be listed in  
    # host statements.   If no address is specified, the address will be  
    # allocated dynamically (if possible), but the host-specific information  
    # will still come from the host declaration.  
    host passacaglia {  
      hardware ethernet 0:0:c0:5d:bd:95;  
      filename "vmunix.passacaglia";  
      server-name "";  
    # Fixed IP addresses can also be specified for hosts.   These addresses  
    # should not also be listed as being available for dynamic assignment.  
    # Hosts for which fixed IP addresses have been specified can boot using  
    # BOOTP or DHCP.   Hosts for which no fixed address is specified can only  
    # be booted with DHCP, unless there is an address range on the subnet  
    # to which a BOOTP client is connected which has the dynamic-bootp flag  
    # set.  
    host fantasia {  
      hardware ethernet 08:00:07:26:c0:a5;  
    # You can declare a class of clients and then do address allocation  
    # based on that.   The example below shows a case where all clients  
    # in a certain class get addresses on the 10.17.224/24 subnet, and all  
    # other clients get addresses on the 10.0.29/24 subnet.  
    class "foo" {  
      match if substring (option vendor-class-identifier, 0, 4) = "SUNW";  
    shared-network 224-29 {  
      subnet netmask {  
        option routers;  
      subnet netmask {  
        option routers;  
      pool {  
        allow members of "foo";  
      pool {  
        deny members of "foo";  
DHCP配置文件通常包括3部分:declarations, parameters, options。
shared-network 告知DHCP服务器是否为一些子网络分享相同网络
subnet 描述一个IP是否属于子网
range 提供动态分配IP地址的起始和结束范围
host 为特定的主机提供网络参数
group 为一组参数提供声明
ddns-update-style 配置DHCP-DNS互动更新模式
default-lease-time 指定默认租赁时间的长度,单位为秒
max-lease-time 指定最大租赁时间长度,单位为秒
hardware 指定网卡接口类型和MAC地址
server-name 告知DHCP客户服务器名称
fixed-address 为客户端指定一个固定的IP地址
domain-name 为客户端指定域名
host-name 为客户端指明主机名称
routers 为客户端指明默认网关
broadcast-address 为客户端设定广播地址
subnet-mask 为客户端设定子网掩码
ntp-server 为客户端设定格林威治时间的偏移时间,单位为秒
    # Server configuration file example for DHCPv6  
    # From the file used for TAHI tests.  
    # IPv6 address valid lifetime  
    #  (at the end the address is no longer usable by the client)  
    #  (set to 30 days, the usual IPv6 default)  
    default-lease-time 2592000;  
    # IPv6 address preferred lifetime  
    #  (at the end the address is deprecated, i.e., the client should use  
    #   other addresses for new connections)  
    #  (set to 7 days, the  usual IPv6 default)  
    preferred-lifetime 604800;  
    # T1, the delay before Renew  
    #  (default is 1/2 preferred lifetime)  
    #  (set to 1 hour)  
    option dhcp-renewal-time 3600;  
    # T2, the delay before Rebind (if Renews failed)  
    #  (default is 3/4 preferred lifetime)  
    #  (set to 2 hours)  
    option dhcp-rebinding-time 7200;  
    # Enable RFC 5007 support (same than for DHCPv4)  
    allow leasequery;  
    # Global definitions for name server address(es) and domain search list  
    option 3ffe:501:ffff:100:200:ff:fe00:3f3e;  
    option dhcp6.domain-search "","";  
    # Set preference to 255 (maximum) in order to avoid waiting for  
    # additional servers when there is only one  
    ##option dhcp6.preference 255;  
    # Server side command to enable rapid-commit (2 packet exchange)  
    ##option dhcp6.rapid-commit;  
    # The delay before information-request refresh  
    #  (minimum is 10 minutes, maximum one day, default is to not refresh)  
    #  (set to 6 hours)  
    option 21600;  
    # The path of the lease file  
    dhcpv6-lease-file-name "/usr/local/var/db/dhcpd6.leases";  
    # Static definition (must be global)  
    host myclient {  
        # The entry is looked up by this  
        host-identifier option  
            dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;  
        # A fixed address  
        fixed-address6 3ffe:501:ffff:100::1234;  
        # A fixed prefix  
        fixed-prefix6 3ffe:501:ffff:101::/64;  
        # Override of the global definitions,  
        # works only when a resource (address or prefix) is assigned  
        option 3ffe:501:ffff:100:200:ff:fe00:4f4e;  
        # For debug (to see when the entry statements are executed)  
        #  (log "sol" when a matching Solicitation is received)  
        ##if packet(0,1) = 1 { log(debug,"sol"); }  
    # The subnet where the server is attached  
    #  (i.e., the server has an address in this subnet)  
    subnet6 3ffe:501:ffff:100::/64 {  
        # Two addresses available to clients  
        #  (the third client should get NoAddrsAvail)  
        range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::11;  
        # Use the whole /64 prefix for temporary addresses  
        #  (i.e., direct application of RFC 4941)  
        range6 3ffe:501:ffff:100:: temporary;  
        # Some /64 prefixes available for Prefix Delegation (RFC 3633)  
        prefix6 3ffe:501:ffff:100:: 3ffe:501:ffff:111:: /64;  
    # A second subnet behind a relay agent  
    subnet6 3ffe:501:ffff:101::/64 {  
        range6 3ffe:501:ffff:101::10 3ffe:501:ffff:101::11;  
        # Override of the global definitions,  
        # works only when a resource (address or prefix) is assigned  
        option 3ffe:501:ffff:101:200:ff:fe00:3f3e;  
    # A third subnet behind a relay agent chain  
    subnet6 3ffe:501:ffff:102::/64 {  
        range6 3ffe:501:ffff:102::10 3ffe:501:ffff:102::11;  







« MariaDB数据库在Linux下的编译安装配置 Linux上安装dnsmasq教程 »


在Linux上添加字体  (2018/9/1 11:53:09)

购物网站支付宝付款后跳转回来报错  (2015/3/18 15:52:24)

centos下安装nmap、sqlmap、metasploit  (2014/8/22 9:18:40)

Linux上极具杀伤力的破坏指令  (2014/8/18 8:53:22)

三步骤测试Linux主机是否连通  (2014/5/20 9:33:18)

Linux查看路由信息  (2014/5/8 15:01:06)

RHEL6.4搭建FTP服务器  (2014/4/29 10:16:55)

linux系统下设置网站404错误页  (2014/4/21 12:45:26)

OpenSSL安全公告  (2014/4/15 9:01:51)

系统管理员命令:sudo  (2014/4/14 11:06:49)