DHCP实验报告

--杨冬

1.     实验环境

服务器:Red Hat Enterprise Linux 5.3ip192.168.0.20

服务器:Red Hat Enterprise Linux 5.3ip192.168.0.10192.168.1.10

客户端:windows xp

 

 

01.安装好软件包

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

 

 

3.     实验目标一:配置一台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.客户端测试

 

 

                     测试成功 

4.     实验目标二:配置实现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   

                             [确定]

 .客户端测试

 

                            测试成功

 

 

 

 

 

 

 

 

 

2.     实验前的准备