DHCP服务:
DHCP,是进行IP地址等网络信息集中管理的服务.
1. 安装DHCP服务器软件
a) #cd /media/cdrom/RedHat/RPMS/
b) #ls �Cl dhcp*
c) #rpm �Cqa |grep dhcp
d) #rpm �Civh dhcp-3.0.1-12_EL.i386.rpm
e) #rpm �Cql dhcp
2. Dhcpd.conf 配置文件解析
a) Dhcpd的配置文件是dhcpd.conf,位于/etc子目录下,但是该文件并没有包括在DHCP软件包中,需要管理员手工创建.(提供了配置样例/usr/share/doc/dhcp-3.0.1/目录中)
#rpm �Cql dhcp |grep dhcpd.conf
/usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample
/usr/share/man/man5/dhcpd.conf.5.gz
b) 建立配置文件
#cp /usr/share/doc/dhcp-3.0.1/dhcp.conf.sample /etc/dhcpd.conf
#vi /etc/dhcpd.conf
c) 配置文件基本格式:
在dhcp.conf配置文件中可以包括声明,参数和选项3种基本格式
Subnet 192.168.1.0 netmask 255.255.255.0{
range 192.168.1.100 192.168.1.200;
…….
}
Default-lease-time 21600;
Max-lease-time 43200;
Option routers 192.168.1.1;
Option subnet-mask 255.255.255.0;
d) 全局设置
Ddns-update-style interim;
Default-lease-time 21600;
Max-lease-time 43200;
Option domain-name “test.com”;
Option domain-name-servers 192.168.1.1,202.106.46.151;
e) 使用subnet生命子网属性
Subnet 192.168.1.0 netmask 255.255.255.0{
Range 192.168.1.128 192.168.1.200;
Option subnet-mask 255.255.255.0;
Option routers 192.168.1.1;
}
f) 使用host声明设置主机属性
Host server01{
Hardware Ethernet 0:c0:c4:33:23:81;
Fixed-address 192.168.1.1;
Option subnet-mask 255.255.255.0;
Option routers 192.168.1.1;
}
g) 多网络接口时需要的配置的文件:
#vi /etc/sysconfig/dhcpd
#cat /etc/sysconfig/dhcpd
#command line options here
DHCPDARGS=eth0
h) dhcp服务的启动和停止:
dhcpd服务启动脚本位于/etc/init.d/目录中,名称为dhcpd,
#/etc/init.d/dhcpd start/stop/restart/configtest/status
#service dhcpd start/stop/status