DHCP服务配置之主服务器配置

1.DHCP简介:

DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)通常被应用在大型的局域网络环境中,主要作用是集中的管理、分配IP地址,使网络环境中的主机动态的获得IP地址、Gateway地址、DNS服务器地址等信息,并能够提升地址的使用率。

2.DHCP服务器简介:

DHCP服务器指的是由服务器控制一段IP地址范围,客户端登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。

3.安装DHCP软件

[root@localhost Server]# rpm -ivh dhcp-3.0.5-21.el5.x86_64.rpm

4.安装后DHCP生成的软件文件路径(部分)

[root@localhost Server]# 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/api+protocol
/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample(重点文件)
/var/lib/dhcpd/dhcpd.leases (租约文件)

5.配置文件说明

说明:CentOS 5.X以前的配置文件路径 是/etc/dhcpd.conf     新版的配置文件路径 是/etc/dhcp/dhcpd.conf

[root@localhost Server]#cat /etc/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample (说明配置文件的模版路径 )
[root@localhost Server]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample   /etc/dhcpd.conf

[root@localhost Server]# cat /etc/dhcpd.conf

#这部分是全局设置

default-lease-time 259200;   租约时间

max-lease-time 518400;   最大租约时间

option domain-name"zzhz.com"; 设置,/etc/resolv.conf

option domain-name-servers IP1, IP2;     DNS设置,会修改客户端的/etc/resolv.conf

ddns-update-style none;

ddns-update-style interim;

 ignore client-updates:

option routers IP;    默认路由:

#subnet :指定子网作用域(动态IP)

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 "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.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;

# 固定IP地址设置
  host ns {
  next-server marvin.redhat.com;
  hardware ethernet 12:34:56:78:AB:CD;
  fixed-address 207.175.42.254;
  }
}

猜你喜欢

转载自www.cnblogs.com/Yuanbangchen/p/9506854.html