中国网管论坛's Archiver

死神司令 发表于 2008-4-12 22:28

DHCP服务器

[align=center][align=center][color=#000000][font=Times New Roman]DHCP[/font][font=宋体]服务器[/font][/color][/align][/align][color=#000000][font=Times New Roman]1、
[/font][font=宋体]安装[/font][font=Times New Roman]dhcp[/font][font=宋体]服务器软件[/font][/color]
[color=#000000][font=Times New Roman]Rhel4[/font][font=宋体]系统光盘中包含[/font][font=Times New Roman]rpm[/font][font=宋体]格式的[/font][font=Times New Roman]dhcp[/font][font=宋体]服务器软件包,包名称是[/font][font=Times New Roman]dhcp-3.0.1-12_EL.i386.rpm[/font][/color]
[table][tr][td=1,1,568][font=Times New Roman][size=3][color=#000000]#rpm –ivh dhcp-3.0.1-12_EL.I386.rpm[/color][/size][/font]
[/td][/tr][/table][font=Times New Roman][color=#000000]2、
[/color][color=#000000]dhcpd.conf[/color][/font][font=宋体][color=#000000]配置文件解析[/color][/font]
[color=#000000][font=宋体](1)
[/font][font=Times New Roman]dhcpd.conf[/font][font=宋体]配置文件[/font][/color]
[color=#000000][font=Times New Roman]dhcpd[/font][font=宋体]的配置文件名称为[/font][font=Times New Roman]dhcpd.conf[/font][font=宋体],应该位于“[/font][font=Times New Roman]/etc[/font][font=宋体]”子目录中,但是该文件并没有包括在[/font][font=Times New Roman]dhcp[/font][font=宋体]软件包中,需要手工建立,可是为了便于人们使用,它提供了配置样例文件[/font][font=Times New Roman]dhcpd.conf.sample[/font][font=宋体]位于“[/font][font=Times New Roman]/usr/share/doc/dhcp-3.0.1/[/font][font=宋体]”目录中[/font][/color]
[color=#000000][font=宋体](2)
[/font][font=宋体]建立配置文件[/font][/color]
[color=#000000][font=宋体]管理员对[/font][font=Times New Roman]dhcp[/font][font=宋体]服务器进行管理,首先需要建立[/font][font=Times New Roman]dhcpd.conf[/font][font=宋体],通常可以先复制样例文件[/font][font=Times New Roman]dhcpd.conf.sample[/font][font=宋体]到“[/font][font=Times New Roman]/etc[/font][font=宋体]”目录作为[/font][font=Times New Roman]dhcpd.conf[/font][font=宋体],然后使用[/font][font=Times New Roman]vi[/font][font=宋体]编辑器对配置文件进行修改[/font][/color]
[table][tr][td=1,1,568][font=Times New Roman][size=3][color=#000000]#cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample
/etc/dhcpd.conf[/color][/size][/font]
[font=Times New Roman][size=3][color=#000000]#vi /etc/dhcpd.conf[/color][/size][/font]
[/td][/tr][/table][color=#000000][font=宋体](3)
[/font][font=宋体]配置文件的基本格式[/font][/color]
[color=#000000][font=宋体]在[/font][font=Times New Roman]dhcp.conf[/font][font=宋体]配置文件中可以包括声明、参数和选项[/font][font=Times New Roman]3[/font][font=宋体]种基本格式。[/font][/color]
[color=#000000][font=宋体]声明用来描述[/font][font=Times New Roman]dhcpd[/font][font=宋体]服务器中对网络布局的划分,是网络设置的逻辑范围[/font][/color]
[table][tr][td=1,1,568][font=Times New Roman][size=3][color=#000000]Subnet
192.168.1.0
netmask
255.255.255.0
{[/color][/size][/font]
[size=3][color=#000000][font=Times New Roman]
ranga
192.168.1.2
192.168.1.128 [/font][font=宋体];[/font][/color][/size]
[font=Times New Roman][size=3][color=#000000]……..[/color][/size][/font]
[font=Times New Roman][size=3][color=#000000]}[/color][/size][/font]
[/td][/tr][/table][font=宋体][color=#000000]参数由设置项和设置值组成,根据参数所在位置的不同,参数的设置可作用于全局或制定的声明。参数总是以“;”结束的。[/color][/font]
[table][tr][td=1,1,568][size=3][color=#000000][font=Times New Roman]default[/font][font=宋体]—[/font][font=Times New Roman]lease[/font][font=宋体]—[/font][font=Times New Roman]time
21600[/font][font=宋体];[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]max[/font][font=宋体]—[/font][font=Times New Roman]lease[/font][font=宋体]—[/font][font=Times New Roman]time
43200[/font][font=宋体];[/font][/color][/size]
[/td][/tr][/table][color=#000000][font=宋体]选项总是由[/font][font=Times New Roman]option[/font][font=宋体]关键字引导,后面跟具体的选项和选项的设置值。选项根据所在的位置不同可作用于全局或某个声明中。选项也是以“;”结束的。[/font][/color]
[table][tr][td=1,1,568][size=3][color=#000000][font=Times New Roman]option routers 192.168.1.1[/font][font=宋体];[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]option subnet-mask 255.255.255.0[/font][font=宋体];[/font][/color][/size]
[/td][/tr][/table][font=Times New Roman][color=#000000]3、
[/color][/font][font=宋体][color=#000000]多网络接口是需要使用配置的文件[/color][/font]
[color=#000000][font=宋体]作为[/font][font=Times New Roman]dhcp[/font][font=宋体]服务器使用的主机通常拥有多个网络接口,而[/font][font=Times New Roman]dhcpp[/font][font=宋体]服务可能只需要在其中一个网络接口上提供服务,此时可以在“[/font][font=Times New Roman]/etc/sysconfig/dhcpd[/font][font=宋体]”文件中指定需要提供[/font][font=Times New Roman]dhcp[/font][font=宋体]服务的网络接口。[/font][/color]
[table][tr][td=1,1,568][font=Times New Roman][size=3][color=#000000]#cat /etc/sysconfig/dhcpd[/color][/size][/font]
[font=Times New Roman][size=3][color=#000000]#Command line options here[/color][/size][/font]
[font=Times New Roman][size=3][color=#000000]DHCPDARGS=[/color][/size][/font]
[/td][/tr][/table][color=#000000][font=Times New Roman]dhcpd[/font][font=宋体]文件中默认[/font][font=Times New Roman]DHCPDARGS[/font][font=宋体]设置项为空,可修改为指定的网络接口名称,例如[/font][font=Times New Roman]etch0[/font][font=宋体],这样[/font][font=Times New Roman]dhcpd[/font][font=宋体]将只在[/font][font=Times New Roman]eth0[/font][font=宋体]网络接口上提供[/font][font=Times New Roman]dhcpfuw[/font][/color]
[table][tr][td=1,1,568][font=Times New Roman][size=3][color=#000000]DHCPDARGD=eth0[/color][/size][/font]
[/td][/tr][/table][font=Times New Roman][color=#000000]4、
[/color][color=#000000]dhcpd[/color][/font][font=宋体][color=#000000]服务的启动与停止[/color][/font]
[color=#000000][font=Times New Roman]dhcpd[/font][font=宋体]服务的启动脚本位于“[/font][font=Times New Roman]/etc/init.d/[/font][font=宋体]”目录中,名称为[/font][font=Times New Roman]dhcpd[/font][font=宋体],[/font][font=Times New Roman]dhcpd[/font][font=宋体]服务的启动、停止和重新启动等功能都是由该脚本实现的。[/font][/color]
[color=#000000][font=宋体]启动[/font][font=Times New Roman]dhcpd[/font][font=宋体]服务[/font][/color]
[table][tr][td=1,1,568][font=Times New Roman][size=3][color=#000000]service dhcpd restart[/color][/size][/font]
[/td][/tr][/table][color=#000000][font=Times New Roman] [/font][/color]

zhzzhzzhz 发表于 2008-4-14 13:12

好文章

页: [1]

Powered by Discuz! Archiver 6.1.0  © 1999-2008 bbs.bitsCN.com