DHCP服务器使用单一的作用域,大部分时间能够满足网络的需求,但是有些特殊情况下,按照网络规划我们需要配置多作用域。
网络中如果计算机和其他设备数量增加,IP地址需要进行扩容才能满足需求。小型网络可以对所有设备重新分配IP地址,其网络内部客户机和服务器数量较少,实现起来比较简单。但如果是一个大型网络,重新配置整个网络的IP地址是不明智的,如果 *** 作不当,可能会造成通信暂时中断以及其他网络故障。我们可以通过多作用域的设置,即DHCP服务器发布多个作用域实现IP地址增容的目的。
公司IP地址规划为19216820/24网段,可以容纳254台设备,使用DHCP服务器建立一个19216820网段的作用域,动态管理网络IP地址,但网络规模扩大到500台机器,显然一个C类网的地址无法满足要求了。这时,可以再为DHCP服务器添加一个新作用域,管理分配19216830/24网段的IP地址,为网络增加254个新的IP地址,这样既可以保持原有IP地址的规划,又可以扩容现有的网络IP地址。
(1)简单实现DHCP多作用域
对于多作用域的配置,必须保证DHCP服务器能够侦听所有子网客户机的请求信息,下面将讲解配置多作用域的基本方法,为DHCP添加多个网卡连接每个子网,并发布多个作用域的声明。
注意:划分子网时,如果选择直接配置多作用域实现动态IP分配的任务,则必须要为DHCP服务器添加多块网卡,并配置多个IP地址,否则DHCP服务器只能分配与其现有网卡IP地址对应网段的作用域。
采用双网卡实现两个作用域
1)网卡配置IP地址
DHCP服务器有多块网卡时,需要使用ifconfig命令为每块网卡配置独立的IP地址,但要注意,IP地址配置的网段要与DHCP服务器发布的作用域对应哈~
ifconfig eth0 19216821 netmask 2552552550
ifconfig eth1 19216831 netmask 2552552550
2)编辑dhcpdconf主配置文件
当DHCP服务器网络环境搭建完毕后,我们可以编辑dhcpdconf主配置文件完成多作用域的设置。
ddns-update-style none;
ignore client-updates;
subnet 19216820 netmask 2552552550 {
# --- default gateway
option routers 19216821;
option subnet-mask 2552552550;
option nis-domain "domainorg";
option domain-name "domainorg";
option domain-name-servers 19216822;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 19216811;
# option netbios-name-servers 19216811;
# --- 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 192168250 1921682250;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server marvinredhatcom;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 20717542254;
}
}
subnet 19216830 netmask 2552552550 {
# --- default gateway
option routers 19216831;
option subnet-mask 2552552550;
option nis-domain "domainorg";
option domain-name "domainorg";
option domain-name-servers 19216822;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 19216811;
# option netbios-name-servers 19216811;
# --- 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 192168350 1921683250;
default-lease-time 21600;
max-lease-time 43200;
max-lease-time 43200;
}
保存退出哈~
3)测试验证
重启DHCP服务后检查系统日志,检测配置是否成功,使用tail命令动态显示日志信息。
tail -F /etc/log/messages
经过设置,对于DHCP服务器将通过eth0和eth1两块网卡侦听客户机的请求,并发送相应的回应。
Jan 19 16:02:51 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da via eth1
Jan 19 16:02:51 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da via eth0
Jan 19 16:02:52 rhel5 dhcpd: DHCPOFFER 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:52 rhel5 dhcpd: DHCPOFFER 1921682250 to 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:52 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:52 rhel5 dhcpd: DHCPACK 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:52 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative)
Jan 19 16:02:53 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:53 rhel5 dhcpd: DHCPOFFER 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:53 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:53 rhel5 dhcpd: DHCPOFFER 1921682250 to 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:53 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:53 rhel5 dhcpd: DHCPACK 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:53 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative)
Jan 19 16:02:54 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:54 rhel5 dhcpd: DHCPOFFER 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:54 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:54 rhel5 dhcpd: DHCPOFFER 1921682250 to 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:54 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:54 rhel5 dhcpd: DHCPACK 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:54 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative)
Jan 19 16:02:55 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:55 rhel5 dhcpd: DHCPOFFER 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:55 rhel5 dhcpd: DHCPDISCOVER from 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:55 rhel5 dhcpd: DHCPOFFER 1921682250 to 00:19:21:bd:a3:da (mis) via eth0
Jan 19 16:02:55 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:55 rhel5 dhcpd: DHCPACK 1921683250 to 00:19:21:bd:a3:da (mis) via eth1
Jan 19 16:02:55 rhel5 dhcpd: DHCPREQUEST for 1921683250 (19216831) from 00:19:21:bd:a3:da (mis) via eth0: ignored (not authoritative)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)