zoukankan      html  css  js  c++  java
  • Linux平台搭建DHCP 服务器过程

    # rpm -aq | grep dhcp
    # cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample .
    # mv dhcpd.conf.sample dhcpd.conf
    
    # vi dhcpd.conf
    1. Arrange of single subnet 
    --------------------------------------------------------------------------------------------------------------------------------------
    ddns-update-style interim;  /*dhcp支持的dns动态更新方式*/
    ignore client-updates;   /*忽略客户端DNS动态更新*/
    
    # allow booting; 
    # allow bootp; 
    
    subnet 192.168.0.0 netmask 255.255.255.0 {  /*作用域网段*/
    
    # --- default gateway 
        option routers          192.168.0.1;  /*网关地址*/
        option subnet-mask      255.255.255.0;  /*子网掩码*/
    
        option nis-domain       "domain.org"; 
        option domain-name      "domain.org";  /*域名*/
        option domain-name-servers  192.168.1.1;  /*dns IP*/
    
        option time-offset      -18000; # Eastern Standard Time 
    #   option ntp-servers      192.168.1.1; 
    #   option netbios-name-servers 192.168.1.1; 
    # --- Selects point-to-point node (default is hybrid). Don't change this unless 
    # -- you understand Netbios very well 
    #   option netbios-node-type 2; 
    
        range dynamic-bootp 192.168.0.128 192.168.0.130;   /*ip地址段范围*/
        default-lease-time 21600;  /*租期,秒数*/
        max-lease-time 43200; 
    
        # we want the nameserver to appear at a fixed address 
        host ns { 
            next-server marvin.redhat.com; 
            hardware ethernet 12:34:56:78:AB:CD;  /*绑定客户机MAC地址*/
            fixed-address 207.175.42.245; 
        } 
    }
    --------------------------------------------------------------------------------------------------------------------------------------
    2. Arrange of multi-subnet
    --------------------------------------------------------------------------------------------------------------------------------------
    ddns-update-style interim;
    ignore client-updates;
    
    # allow booting;
    # allow bootp;
    
    shared-network broadnet {
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.1.255;
    
        #option domain-name "domain.org";
        #option domain-name-servers 192.168.1.1;
    
        default-lease-time 86400;
        max-lease-time 172800;
    
        subnet 192.168.0.0 netmask 255.255.255.0 {
        # --- default gateway
            option routers          192.168.0.1;
            range dynamic-bootp 192.168.0.128 192.168.0.128;
    
            #option subnet-mask     255.255.255.0;
            #option nis-domain      "domain.org";
            #option domain-name     "domain.org";
            #option domain-name-servers 192.168.1.1;
    
            option time-offset      -18000; # Eastern Standard Time
        #   option ntp-servers      192.168.1.1;
        #   option netbios-name-servers 192.168.1.1;
        # --- Selects point-to-point node (default is hybrid). Don't change this unless
        # -- you understand Netbios very well
        #   option netbios-node-type 2;
    
            #default-lease-time 21600;
            #max-lease-time 43200;
    
        # we want the nameserver to appear at a fixed address
            #host ns {
                #next-server marvin.redhat.com;
                #hardware ethernet 12:34:56:78:AB:CD;
                #fixed-address 207.175.42.245;
            #}
        }
    
        subnet 192.168.2.0 netmask 255.255.255.0 {
            range 192.168.2.10 192.168.2.10;
            option routers 192.168.2.1;
        }
    }
    --------------------------------------------------------------------------------------------------------------------------------------
    # service dhcpd start
    # cat /var/lib/dhcpd/dhcpd.leases
    
    Client重新获取IP:
    > ipconfig /release
    > ipconfig /renew
    > ipconfig /all
    
     Note:
    1)DHCP server的IP地址一定要和IP Range中的某个子网在同一网段,即,有相同的子网掩码和网关
    2)即使所有的DHCP Client在同一个LAN中,若它们获取到的IP地址不在同一网段,则不能相互Ping通
    3)同样适用Window2008上搭建DHCP Server:
        ​a. Start->Administrative Tools->Server Manager->Role add->wizard
        ​​b. Start->Administrative Tools->DHCP
  • 相关阅读:
    SPOJ 1812 Longest Common Substring II(后缀自动机)(LCS2)
    HDU 4441 Queue Sequence(优先队列+Treap树)(2012 Asia Tianjin Regional Contest)
    HDU 4433 locker(DP)(2012 Asia Tianjin Regional Contest)
    HDU 4431 Mahjong(枚举+模拟)(2012 Asia Tianjin Regional Contest)
    NavigationBar的简单设置
    Android如何设置标题栏的高度
    android 在标题栏加上按钮
    MediaRecorder类介绍
    Android ADB server didn't ACK * failed to start daemon * 简单有效的解决方案
    2016/1/7 改 百文百鸡 水仙花数 百马百担
  • 原文地址:https://www.cnblogs.com/qianggezhishen/p/7349506.html
Copyright © 2011-2022 走看看