快速业务通道

Linux下DHCP服务器基本配置

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-02

我的RHEL5.5是默认,然后选中所有软件安装的,这样当再安装软件时就不会报软件依赖性错误了.当然这样也有一个好处,就是dhcp默认安装了.现在就来配置一下默认安装的dhcp服务器.

,我们第一步还是来搜索下系统是否安装了dhcp:

rpm -qa | grep dhcp

显示结果:

[root@localhost ~]# rpm -qa | grep dhcp
dhcp-3.0.5-23.el5
sblim-cmpi-dhcp-devel-1.0-40.el5
dhcpv6-client-1.0.10-18.el5
dhcpv6-1.0.10-18.el5
sblim-cmpi-dhcp-1.0-40.el5

显然dhcp已经安装成功了,版本是dhcp-3.0.5-23.el5

第二步,查看一下dhcp相关文件都保存在文件系统的哪个位置:

rpm -ql dhcp

显示结果:

[root@localhost ~]# rpm -ql dhcp
/etc/dhcpd.conf
/etc/rc.d/init.d/dhcpd
/etc/rc.d/init.d/dhcrelay
/etc/sysconfig/dhcpd
/etc/sysconfig/dhcrelay
/usr/bin/omshell
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-3.0.5
/usr/share/doc/dhcp-3.0.5/IANA-arp-parameters
/usr/share/doc/dhcp-3.0.5/README
/usr/share/doc/dhcp-3.0.5/RELNOTES
/usr/share/doc/dhcp-3.0.5/api protocol
/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample
/usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-authentication-14.txt
/usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-dhcp-dns-12.txt
/usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-failover-07.txt
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient-script.8
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient.8
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient.conf.5
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient.leases.5
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhcp-eval.5
/usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhcp-options.5
/usr/share/doc/dhcp-3.0.5/rfc1542.txt
/usr/share/doc/dhcp-3.0.5/rfc2131.txt
/usr/share/doc/dhcp-3.0.5/rfc2132.txt
/usr/share/doc/dhcp-3.0.5/rfc2485.txt
/usr/share/doc/dhcp-3.0.5/rfc2489.txt
/usr/share/doc/dhcp-3.0.5/rfc951.txt
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/dhcp-eval.5.gz
/usr/share/man/man5/dhcp-options.5.gz
/usr/share/man/man5/dhcpd-eval.5.gz
/usr/share/man/man5/dhcpd-options.5.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/var/lib/dhcpd
/var/lib/dhcpd/dhcpd.leases

结果中用红线标出的是比较重要的文件路径.

默认情况下,dhcp服务器是无法启动成功的.

[root@localhost ~]# /etc/rc.d/init.d/dhcpd start
启动 dhcpd:[失败]

原因有两个,第一个是dhcp安装完成时,/etc/dhcpd.conf这个文件是空的,没有内容的.解决办法是把/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample拷贝覆盖/etc/dhcpd.conf.
[root@localhost ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y

另外一个原因是需要修改拷贝过来的/etc/dhcpd.conf文件.

源文件内容为:

[root@localhost ~]# vi /etc/dhcpd.conf

ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;

option nis-domain "domain.org";
option domain-name

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号