文章索引 聚合服务页

工 具 文 档

您现在的位置: 创作设计空间 >> 站长教程 >> 服务器 >> Linux >> 正文
站内文章搜索:

Linux系统下架设DHCP服务器的方法

作者:编辑整理    文章来源:网上收集    点击数:2365    更新时间:2009/2/9
1、OS系统版本
 
[root@server~]#more/etc/redhat-release
 
RedHatEnterpriseLinuxASrelease4(NahantUpdate4)
 
2、查看系统是否已经安装DHCP服务端软件
 
[root@server~]#rpm-qa|grepdhcp
 
dhcpv6_client-0.10-14_EL4
 
3、将光盘mount上去,然后安装DHCP服务端软件
 
[root@server~]#mount/media/cdrom
 
mount:blockdevice/dev/hdciswrite-protected,mountingread-only
 
[root@serverRPMS]#find/media/cdrom-name"dhcp*"
 
/media/cdrom/RedHat/RPMS/dhcpv6-0.10-14_EL4.i386.rpm
 
/media/cdrom/RedHat/RPMS/dhcpv6_client-0.10-14_EL4.i386.rpm
 
/media/cdrom/RedHat/RPMS/dhcp-3.0.1-58.EL4.i386.rpm
 
/media/cdrom/RedHat/RPMS/dhcp-devel-3.0.1-58.EL4.i386.rpm
 
[root@serverRPMS]#rpm-ivh/media/cdrom/RedHat/RPMS/dhcp-3.0.1-58.EL4.i386.rpm
 
[root@serverRPMS]#rpm-qa|grepdhcp
 
dhcp-3.0.1-58.EL4
 
dhcpv6_client-0.10-14_EL4
 
到这儿已经安装成功了,哈哈
 
4、查看一下,都有那些文件
 
[root@serverRPMS]#rpm-qlgrepdhcp
 
……
 
/etc/dhcpd.conf——dhcp配置文件
 
/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.1
 
/usr/share/doc/dhcp-3.0.1/README
 
/usr/share/doc/dhcp-3.0.1/RELNOTES
 
/usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample——dhcp配置文件的模板
 
/usr/share/man/man1/omshell.1.gz
 
/usr/share/man/man5/dhcp-eval.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/dhcp
 
/var/lib/dhcp/dhcpd.leases——分配IP的那个日志文件
 
5、[root@serverRPMS]#more/etc/dhcpd.conf
 
这儿有没有什么东东的,还是把模板文件COPY过来吧
 
[root@serverRPMS]#cp/usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample/etc/dhcpd.conf
 
6、查看配置文件,并根据自己的要求更改
 
[root@serverRPMS]#more/etc/dhcpd.conf
 
ddns-update-styleinterim;
 
ignoreclient-updates;
 
subnet192.168.0.0netmask255.255.255.0{
 
#——defaultgateway
 
optionrouters192.168.0.1;
 
optionsubnet-mask255.255.255.0;
 
#optionnis-domain"domain.org";
 
optiondomain-name"wiscom.com.cn";
 
optiondomain-name-servers219.141.136.10,211.147.6.3;
 
optiontime-offset-18000;#EasternStandardTime
 
#optionntp-servers192.168.1.1;
 
#optionnetbios-name-servers192.168.1.1;
 
#——Selectspoint-to-pointnode(defaultishybrid)。Don'tchangethisunless
 
#——youunderstandNetbiosverywell
 
#optionnetbios-node-type2;
 
rangedynamic-bootp192.168.0.128192.168.0.254;
 
default-lease-time21600;
 
max-lease-time43200;
 
#wewantthenameservertoappearatafixedaddress
 
hostns{
 
next-servermarvin.redhat.com;
 
hardwareethernet12:34:56:78:AB:CD;
 
fixed-address207.175.42.254;
 
}
 
}
 
上面都已经很明了,该配置的都配置了
 
7、启动DHCP服务器啦
 
[root@serverRPMS]#servicedhcpdstart
 
Startingdhcpd:[OK]
 
8、查看日志,看看是否有错
 
[root@serverRPMS]#tail-20/var/log/messages
 
Dec918:05:19serverdhcpd:Wrote0deletedhostdeclstoleasesfile.
 
Dec918:05:19serverdhcpd:Wrote0newdynamichostdeclstoleasesfile.
 
Dec918:05:19serverdhcpd:Wrote0leasestoleasesfile.
 
Dec918:05:19serverdhcpd:InternetSystemsConsortiumDHCPServerV3.0.1
 
Dec918:05:19serverdhcpd:
 
Dec918:05:19serverdhcpd:Copyright2004InternetSystemsConsortium.
 
Dec918:05:19serverdhcpd:Allrightsreserved.
 
Dec918:05:19serverdhcpd:Forinfo,pleasevisithttp://www.isc.org/sw/dhcp/
 
Dec918:05:19serverdhcpd:Wrote0deletedhostdeclstoleasesfile.
 
Dec918:05:19serverdhcpd:Wrote0newdynamichostdeclstoleasesfile.
 
Dec918:05:19serverdhcpd:ListeningonLPF/eth0/00:0c:29:c5:06:fc/192.168.0/24
 
Dec918:05:19serverdhcpd:Wrote0leasestoleasesfile.
 
Dec918:05:19serverdhcpd:ListeningonLPF/eth0/00:0c:29:c5:06:fc/192.168.0/24
 
Dec918:05:19serverdhcpd:SendingonLPF/eth0/00:0c:29:c5:06:fc/192.168.0/24
 
Dec918:05:19serverdhcpd:SendingonLPF/eth0/00:0c:29:c5:06:fc/192.168.0/24
 
Dec918:05:19serverdhcpd:
 
Dec918:05:19serverdhcpd:SendingonSocket/fallback/fallback-net
 
Dec918:05:19serverdhcpd:SendingonSocket/fallback/fallback-net
 
Dec918:05:19serverdhcpd:
 
Dec918:05:20serverdhcpd:dhcpdstartupsucceeded
 
文章录入:文章录入:zhangmao    责任编辑:zm