Linux DHCP服務實驗報告

來源:互聯網
上載者:User

DHCP實驗報告 --楊冬

  1. 實驗環境

伺服器:Red Hat Enterprise Linux 5.3(ip:192.168.0.20)

伺服器:Red Hat Enterprise Linux 5.3(ip:192.168.0.10、192.168.1.10)

用戶端:windows xp   

 

01.安裝好軟體包

   [root@yang ~]# rpm -ihv /media/Server/dhcp-3.0.5-18.el5.i386.rpm

 

  1. 實驗目標一:配置一台DHCP伺服器為區域網路使用者指派ip地址。

 

 01.修改設定檔.

[root@yang ~]# cp -rf /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

cp:是否覆蓋“/etc/dhcpd.conf”? y

[root@yang ~]# vim /etc/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {

        option routers                  192.168.0.1;

        option subnet-mask              255.255.255.0;

        option nis-domain               "yangdong.com";

        option domain-name             "yangdong.com";

        option domain-name-servers      61.147.37.1;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.0.128 192.168.0.254;

        default-lease-time 21600;

        max-lease-time 43200;

        host ns {

                next-server marvin.redhat.com;

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

                fixed-address 207.175.42.254;

        }

}

 

 

 

02.重啟伺服器.

 

 

   [root@yang ~]# service dhcpd restart

 

關閉dhcpd:                                     [確定]

啟動dhcpd:                                     [確定]

 

03.用戶端測試

 

                     測試成功

 

  1. 實驗目標二:配置實現DHCP中繼代理服務.

 

01.實驗環境:

主伺服器安裝:  [root@yang ~]# rpm -ihv /media/Server/dhcp-3.0.5-18.el5.i386.rpm

轉送伺服器安裝:[root@yang ~]# rpm -ihv /media/Server/dhcp-3.0.5-18.el5.i386.rpm

 

 

 

 02.主伺服器配置:

 

 

    ①.[root@yang ~]# vim /etc/dhcpd.conf                 

 

ddns-update-style interim;

ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {

        option routers                  192.168.0.1;

        option subnet-mask              255.255.255.0;

        option nis-domain               "yangdong.com";

        option domain-name              "yangdong.com";

        option domain-name-servers      61.147.37.1;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.0.128 192.168.0.254;

        default-lease-time 21600;

        max-lease-time 43200;

}

subnet 192.168.1.0 netmask 255.255.255.0 {

        option routers                  192.168.1.1;

        option subnet-mask              255.255.255.0;

        option nis-domain               "yangdong.com";

        option domain-name              "yangdong.com";

        option domain-name-servers      61.147.37.1;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.1.128 192.168.1.254;

        default-lease-time 21600;

        max-lease-time 43200;

}     

 

 

 

  ②.重啟伺服器.

 

 

   [root@yang ~]# service dhcpd restart

 

關閉dhcpd:                                     [確定]

啟動dhcpd:                                     [確定]

 

 

 

  03. 轉送伺服器配置

 

 

   ①.[root@hello ~]# rpm -ihv /media/Server/dhcp-3.0.5-18.el5.i386.rpm

 

warning: /media/Server/dhcp-3.0.5-18.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...          ########################################### [100%]

   1:dhcp              ########################################### [100%]

[root@hello ~]# service dhcpd start

啟動dhcpd:                                      [失敗]  

 

 

 

  ②.[root@hello ~]# vim /etc/sysctl.con

 

修改:net.ipv4.ip_forward = 1  //開啟路由功能

 [root@hello ~]# sysctl -p

net.ipv4.ip_forward = 1

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 4294967295

kernel.shmall = 268435456

 

 

 

  ③.[root@hello ~]# vim /etc/sysconfig/dhcrelay

 

     # Command line options here

INTERFACES="eth0 eth1"

DHCPSERVERS="192.168.0.20"

     [root@hello ~]# service dhcrelay start

啟動dhcrelay:   

                             [確定]

 ④.用戶端測試

 

                            測試成功

 

 

 

 

 

 

 

 

 

 

 

 

 

  1. 實驗前的準備

本文出自 “楊冬的部落格”

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.