码迷,mamicode.com
首页 > 其他好文 > 详细

DHCP的配置

时间:2014-06-16 17:16:10      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:dhcp的配置

                                                       实验报告DHCP的配置

一.实验拓扑

服务器 ----------      客户机

 

二.实验条件。

  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                    //这个选项不用改

HWADDR=00:0C:29:6F:36:09

ONBOOT=yes

NETMASK=255.255.255.0

IPADDR=192.168.4.5         //服务器上固定的ip地址

TYPE=Ethernet

USERCTL=no

IPV6INIT=no

PEERDNS=yes

 

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

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=tarena.com    //修改用户名

 

[root@localhost ~]# service network restart    //重启网络配置

[root@localhost ~]# chkconfig network on       //重启配置

 

  1. 检查安装dhcp

[root@localhost ~]# rpm -q dhcp       //检查软件包是否安装

package dhcp is not installed                //没有安装包的意思

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

[root@localhost Server]# ls *dhcp*      //搜索dhcp软件包

[root@localhost Server]# rpm -ivh dhcp-3.0.5-31.el5_8.1.x86_64.rpm  //安装此包

[root@localhost Server]# rpm -q dhcp

dhcp-3.0.5-31.el5_8.1                     //再次检查代表本机器已安装此包

 

  1. 修改配置文件

[root@localhost Server]# vim /etc/dhcpd.conf

ddns-update-style interim;

 2 ignore client-updates;

 3 subnet 192.168.4.0 netmask 255.255.255.0 {   //前面的是网段,后面是的子网

 4         option routers                  192.168.4.254;   //网关

  5         option subnet-mask              255.255.255.0;   //子网

6         option domain-name              "tarena.com";     //名字自定义

  7         option domain-name-servers      202.203.204.200;   //DNS

  8         range dynamic-bootp 192.168.4.10 192.168.4.200;      //地址池网段

  9         default-lease-time 21600;        

 10         max-lease-time 43200;

 11         host ns {

 12                 next-server marvin.redhat.com;

 13                 hardware ethernet 12:34:56:78:AB:CD;   //固定获取ip的机器的MAC地址

 14                 fixed-address 207.175.42.254;    //固定ip地址

 15         }        

 16 }

[root@localhost Server]# service dhcpd restart

启动 dhcpd                                               [确定]

[root@localhost Server]# chkconfig dhcpd on                //两段全是重启服务服务的意思

  1. 验证:

[root@localhost ~]# service network restart     //重启服务器的网卡设置

[root@localhost ~]# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 00:0C:29:B8:B7:76      //本机MAC地址

          inet addr:192.168.4.200  Bcast:192.168.4.255  Mask:255.255.255.0    //dhcp获取得ip地址,一般以最大的开头,从大到小获取

          inet6 addr: fe80::20c:29ff:feb8:b776/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:135 errors:0 dropped:0 overruns:0 frame:0

          TX packets:94 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:20790 (20.3 KiB)  TX bytes:16392 (16.0 KiB)

[root@localhost ~]# ping 192.168.4.5

PING 192.168.4.5 (192.168.4.5) 56(84) bytes of data.

64 bytes from 192.168.4.5: icmp_seq=1 ttl=64 time=1.84 ms

64 bytes from 192.168.4.5: icmp_seq=2 ttl=64 time=0.291 ms

64 bytes from 192.168.4.5: icmp_seq=3 ttl=64 time=0.266 ms

64 bytes from 192.168.4.5: icmp_seq=4 ttl=64 time=0.280 ms

64 bytes from 192.168.4.5: icmp_seq=5 ttl=64 time=0.284 ms

 

--- 192.168.4.5 ping statistics ---

5 packets transmitted, 5 received, 0% packet loss, time 4003ms

rtt min/avg/max/mdev = 0.266/0.593/1.845/0.626 ms   //可以ping

  1. 实验验证成功.

 

本文出自 “英文差坚持走起” 博客,请务必保留此出处http://285206232.blog.51cto.com/9044488/1426709

DHCP的配置,布布扣,bubuko.com

DHCP的配置

标签:dhcp的配置

原文地址:http://285206232.blog.51cto.com/9044488/1426709

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!