我的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 |