最簡單的DHCP服務,簡單DHCP服務

來源:互聯網
上載者:User

最簡單的DHCP服務,簡單DHCP服務
 

   這幾天在準備網路安裝linux作業系統。最後決定用pxe + kickstart 的方式完成。原理、方案弄完了之後,開始搭建,結果被DHCP給擋住了。這不就得研究研究最簡單最實用的DHCP使用方法。

 

   * 紅色的是必須有

   * 綠色的是要注意

   * 藍色的是包安裝時,要有的程式包

 

           1. DHCP的實現

           2. 設定檔執行個體

               執行個體1

               執行個體2

   -----------------------------------------------------------------

1. DHCP的實現

DHCP服務必須給本網段提供一個位址集區。

# yum -y install dhcp-devel# rpm -aq | grep dhcp   dhcp-4.1.1-38.P1.el6.centos.i686   dhcp-devel-4.1.1-38.P1.el6.centos.i686# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf# vi dhcpd.conf   ddns-update-style interim;   default-lease-time 21600;   max-lease-time 43200;   option domain-name “test.com”;   option domain-name-servers 192.168.1.1,202.106.0.20;
subnet 192.168.1.0 netmask 255.255.2550 { range 192.168.1.128 192.168.1.254; option subnet-mask 255.255.255.0; option routers 192.168.1.1; } host server01 { hardware ethernet 0:c0:c3:22:46:81; fixed-address 192.168.1.11; option subnet-mask 255.255.255.0; option routers 192.168.1.1; } subnet 117.34.70.0 netmask 255.255.255.0 { default-lease-time 21600; max-lease-time 43200; option routers 117.34.70.1; option subnet-mask 255.255.255.0; }

 

一台主機有多塊網卡,需要在某個網卡上啟用DHCP服務時,需要配置如下:

# vi /etc/sysconfig/dhcpd   # Command line options here   DHCPDARGS="eth0"

 

------------------------------

2. 設定檔執行個體

簡單的範例:(紅色部分必須有)

 

# vi /etc/dhcp/dhcpd.conf   # dhcpd.conf   # Sample configuration file for ISC dhcpd   # option definitions common to all supported networks...   option domain-name "example.org";   option domain-name-servers ns1.example.org, ns2.example.org;   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.   #authoritative;   # 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 117.34.73.0 netmask 255.255.255.0 {   }   subnet 10.152.187.0 netmask 255.255.255.0 {   }   # vi /etc/dhcp/dhcpd.conf   default-lease-time 600;   max-lease-time 7200;   ddns-update-style none;   subnet 117.34.73.0 netmask 255.255.255.0 {   }

 

   -----------------------------------------------------------------

* 注意:

    ● 如果主機網卡比較多,可以選擇一塊作為服務網卡。

        vi /etc/sysconfig/dhcpd

        # Command line options here
        DHCPDARGS="em1:1"
    ● 提供服務的網卡必需是 非自動擷取 的地址。

        ifconfig eth0 172.16.40.129/25 up

    ● 服務提供的位址集區必需包含本地提供服務的地址在裡面。

    ● 位址集區(range)不能與範圍(subnet)衝突。

    ● 其他的參數、選項沒有也可以啟動的。所以可以不設定,因為這裡是為了網路安裝。

    ● 如果配置了這裡所說的最簡單的 dhcp 服務,卻無法啟動。就剩下一個原因,每句後面有沒有分號。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.