DHCP服务器学习搭建练习

一、实验拓扑


RHEL5.9

--------------RHEL5.9(vmnet4)-------------------(vmnet4)

Win7

实验前提条件

1. 所有试验机在相同网络

2. DHCP服务器有固定IP


实验操作步骤:

1. 设置ip

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

HWADDR=00:0c:29:5d:a8:80

IPADDR=192.168.10.253

PREFIX=24

[root@localhost ~]# cat /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=dhcpser.tarena.com

GATEWAY=192.168.10.254

[root@localhost ~]# cat /etc/resolv.conf 

search tarena.com

nameserver 192.168.10.254

nameserver 202.106.0.20

[root@localhost ~]# service network restart

[root@localhost ~]# chkconfig network on

验证:

[root@dhcpser ~]# ifconfig eth0

[root@dhcpser ~]# route -n

[root@dhcpser ~]# hostname 

[root@dhcpser ~]# cat /etc/resolv.conf 

2. 安装软件包

[root@dhcpser ~]# rpm -q dhcp //

放入RHEL5.9 iso镜像

[root@dhcpser ~]# cd /misc/cd/Server //

[root@dhcpser Server]# ls *dhcp*

[root@dhcpser Server]# rpm -ivh dhcp-3(tab)

[root@dhcpser Server]# rpm -q dhcp

dhcp-3.0.5-31.el5_8.1

3. 修改配置文件

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               "domain.org";

        option domain-name              "domain.org";

        option domain-name-servers      192.168.1.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;

        }

}



4. 启动服务

[root@dhcpser ~]# rpm -ql dhcp | grep init.d

/etc/rc.d/init.d/dhcpd

/etc/rc.d/init.d/dhcrelay

[root@dhcpser ~]# service dhcpd restart

[root@dhcpser ~]# chkconfig dhcpd on

5. 验证

Linux:

# dhclient -d eth0 临时获取

# dhclient -r eth0 释放

Windows:

cmd>ipconfig /release 释放ip

cmd>ipconfig /renew 重新获取ip

周华飞(94DE8082C30E对话) 17:33:35

一、实验拓扑

                  

----------------RHEL5.9_A----(vmnet1)----RHEL5.9_B----------- 


RHEL5.9_A: 192.168.10.253/24

RHEL5.9_B: 192.168.10.20/24




实验总结:


    搭建DHCP服务器基本步骤和实验报告格式

    1.DHCP搭建环境准备

    a.启动三台虚拟机,一台用作DHCP服务器,一台Linux客户机,一台Win客户机,分别取名DHCP.Server.Tarena.com   LinuxClient WINClient

   b.为服务器配置IP 设置 设置配置文件  #vim  /etc/sysconfig/network  写网关

          /etc/sysconfig/network-scripts/ifcfg-eth0

     DEVICE=eth0

     BOOTPROTO=

  c.启动网关

     #server network restart   //开启服务 

     #chkconfig network  //确保随启动自启动

  2.安装软件

     #yum -y install dhcp 

   3.dhcp 主要配置文件 /etc/dhcp.conf

   /usr/share/doc/dhcp-*/dhcpd.sample

   执行程序:/usr/sbin/dhcpd

   4.服务脚本   /etc/init.d/dhcpd

   5.执行参数配置  /etc/sysconfig/dhcpd


   

本文出自 “奋斗从我开始” 博客,谢绝转载!

你可能感兴趣的:(初学者,练习,DHCP)