采用dhcp的Failover协议实施dhcp的热备份
一、目前的备份方案及缺陷
现在的DHCP服务器采用冷备方案,平时只有一台提供服务,只有在主用服务器宕机时才会启用备份服务器。这种方案的缺点是:
1、 主用服务器故障时切换延迟大。此时需要将主用从网络上断开,将备用服务器的IP更改为主用的IP。
2、 部分用户可能会出现短暂中断。因为lease文件不同步导致重复分配ip而造成用户ip冲突。
3、 单台服务器有性能瓶颈。正常情况下一台服务器尚可以承担目前深圳1万多用户的IP申请,当出现特殊情况比如用户突增、dhcp攻击等时一台服务器就不能提供正常的服务了。
二、新方案的优势
采用dhcp的Failover协议实施dhcp的热备份,有下面的优点:
1、 一台服务器故障不影响正常的dhcp服务,可以将故障机下线维修好后再上线。
2、 单台服务器故障对用户没有任何影响。
3、 此方案采用双机热备,负载相对可以均衡地分布在两台服务器上,因此可以更好地应对严重的dhcp攻击等突发事件。
三、部署
1、两台服务器安装SuSe10、dhcp-3.0.3,并确保两台服务器时间一致。
2、配置
主DHCP服务器配置:
dhcpd.conf
ddns-update-style none;
one-lease-per-client true;
option domain-name "szgwbn.net.cn";
option domain-name-servers 211.162.78.1, 211.162.78.2;
default-lease-time 7200;
max-lease-time 7200;
authoritative;
failover peer "dhcp" {
primary;
address 211.162.78.3;
port 519;
peer address 211.162.78.4;
peer port 520;
max-response-delay 60; //监测对端是否失效的时间间隔
max-unacked-updates 10; //
mclt 600; //peer之间未联系时自动更新lease的时间
split 128;
load balance max seconds 3;
}
include "/etc/dhcpd.master";
副DHCP服务器配置:
dhcpd.conf
ddns-update-style none;
one-lease-per-client true;
option domain-name "szgwbn.net.cn";
option domain-name-servers 211.162.78.1, 211.162.78.2;
default-lease-time 7200;
max-lease-time 7200;
authoritative;
failover peer "dhcp" {
secondary;
address 211.162.78.4;
port 520;
peer address 211.162.78.3;
peer port 519;
max-response-delay 60;
max-unacked-updates 10;
}
include "/etc/dhcpd.master";
主配置文件:
dhcpd.master:
subnet 10.254.0.0 netmask 255.255.255.0 {
option routers 10.254.0.254;
option broadcast-address 10.254.0.255;
pool {
failover peer "dhcp";
range 10.254.0.10 10.254.0.253;
deny dynamic bootp clients;
}
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步