免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1093 | 回复: 0
打印 上一主题 下一主题

RHEL5下dhcp简单服务器配置实例 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-14 12:36 |只看该作者 |倒序浏览

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的绑定


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17896/showart_1928242.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP