文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>RHEL5下dhcp简单服务器配置实例

RHEL5下dhcp简单服务器配置实例

时间:2009-05-14  来源:Aramis

dhcp 简单配置实例

主要架设流程
1,更改配置文件
2,建立租约文件
3,重启服务

下边是详细操作
1,首先检查dhcp包是否有安装
[root@mylab ~]# rpm -qa | grep dhcp
dhcpv6-client-1.0.10-16.el5     #ip6客户端可以不用安装
dhcp-3.0.5-18.el5                     #服务器软件,一定要装
dhcp-devel-3.0.5-18.el5          #开发包,可以不装

如果没有查到,需要单独安装,用rpm或者yum的方式都可以

2,更改配置文件/etc/dhcpd.conf,可以参考/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample文件
这里假设IP地址范围为192.168.0.100 192.168.0.200,
网关为192.168.0.1,子网掩码为255.255.255.0
详细配置文件如下
ddns-update-style none;
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;
        range dynamic-bootp 192.168.0.100 192.168.0.200;
        default-lease-time 43200;
        max-lease-time 86400;
}

3,建立租约文件,如果有了就不用理会,没有需要手动建立,最开始里边是不会有内容的
[root@mylab ~]#touch /var/lib/dhcpd/dhcpd.leases

4,重启dhcp服务
[root@mylab ~]# service dhcpd restart

5,客户端释放IP



重启获取IP地址



6,查看租约文件,现在有内容了
[root@mylab ~]# cat /var/lib/dhcpd/dhcpd.leases
# All times in this file are in UTC (GMT), not your local timezone.   This is
# not a bug, so please don't ask about it.   There is no portable way to
# store leases in the local timezone, so please don't request this as a
# feature.   If this is inconvenient or confusing to you, we sincerely
# apologize.   Seriously, though - don't ask.
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-V3.0.5-RedHat

lease 192.168.0.200 {
starts 5 2009/05/08 14:56:00;
ends 5 2009/05/08 15:01:24;
tstp 5 2009/05/08 15:01:24;
binding state free;
hardware ethernet 00:19:d2:09:68:36;
uid "\001\000\031\322\011h6";
}

7,现在将客户机的IP地址进行绑定,希望每次开机都能得到同样的IP 192.168.0.188,需要添加额外的host设置
首先查看客户机MAC地址ipconfig /all



然后更改配置文件为如下
ddns-update-style none;
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;
        range dynamic-bootp 192.168.0.100 192.168.0.200;
        default-lease-time 43200;
        max-lease-time 86400;

        host ns {
        hardware ethernet 00:19:D2:09:68:36;
        fixed-address 192.168.0.188;
                }
}

8,释放IP地址 ipconfig/release

9,再次更新IP地址ipconfig/renew

这时就会发现MAC地址为 00:19:D2:09:68:36的客户端实现和要指定IP的绑定

相关阅读 更多 +
排行榜 更多 +
儿童学英语

儿童学英语

学习教育 下载
今天开始生存

今天开始生存

动作格斗 下载
飞碟快闪

飞碟快闪

动作格斗 下载