redhat5 DHCP服务器配置

DHCP服务器配置:

动态主机设置协议(Dynamic Host Configuration Protocol, DHCP)是一个局域网的网络协议,使用UDP协议工作,主要有两个用途:给内部网络或网络服务供应商自动分配IP地址,给用户或者内部网络管理员作为对所有计算机作中央管理的手段。


 

1.检查是否已安装DHCP服务所需要的包:

[root@station252 ~]# rpm -qa | grep dhc
dhclient-3.0.5-31.el5
dhcp-devel-3.0.5-31.el5
dhcp-3.0.5-31.el5
DHCP服务器需要这三个包.

2.修改DHCP配置文件:

[root@station252 ~]# vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;

subnet 192.168.253.0 netmask 255.255.255.0 {
        option time-offset   -18000; # Eastern Standard Time
        range dynamic-bootp  192.168.253.2 192.168.253.8;
        default-lease-time   21600;
        max-lease-time       43200;
  ... 省略
  
#192.168.253.0 是准备分配的网段
#range dynamic-bootp  192.168.253.2 192.168.253.8; IP地址池.默认分配IP从192.168.253.2->192.168.253.8

给特定主机指定固定ip地址
host ns { 
        hardware ethernet 12:34:56:78:AB:CD;
        fixed-address 207.175.42.254;
}


3.DHCP服务启动方法:

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

<启动失败时请仔细检查DHCP配置文件.>

 

4.更改DHCP服务的默认启动方式:

[root@station252 ~]# chkconfig --list | grep dhcpd
dhcpd           0:关闭  1:关闭  2:关闭  3:关闭  4:关闭 5:关闭   6:关闭

[root@station252 ~]# chkconfig dhcpd --level 35 on

 

5.范本

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

subnet 192.168.159.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		"domain.org";
	option domain-name-servers	192.168.1.1;

	# 时间偏移量
	option time-offset		-18000;	# Eastern Standard Time
#	option ntp-servers		192.168.1.1;
#	option netbios-name-servers	192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#	option netbios-node-type 2;

	# 动态地址池
	range dynamic-bootp 192.168.159.1 192.168.159.254;
	# 租约时间 6个小时
	default-lease-time 21600;
	# 最大租约时间 12个小时
	max-lease-time 43200;

	# we want the nameserver to appear at a fixed address
	# 固定IP地址
	host ns {
		# 此句可注释
		next-server marvin.redhat.com;
		# MAX地址
		hardware ethernet 12:34:56:78:AB:CD;
		# 固定地址
		fixed-address 207.175.42.254;
	}
}


 

你可能感兴趣的:(redhat5 DHCP服务器配置)