DHCP集群搭建工作安排
安裝配置DHCP集群服務(wù)器
安裝配置兩臺(tái)Linux7.6操作系統(tǒng)做為dhcp集群服務(wù)器冲甘,已完成
DHCP服務(wù)器配置,主DHCP服務(wù)器配置 dhcpd.conf
option domain-name "yuchai.com";
option domain-name-servers 172.16.0.101, 172.16.0.110;
option ntp-servers 172.16.0.101;
#default-lease-time 600;
#max-lease-time 7200;
default-lease-time 43200;## 12個(gè)小時(shí)
max-lease-time 64800;## 18個(gè)小時(shí)
failover peer "ycfailover" {
primary; # declare this to be the primary server
address 172.16.0.241;
port 647;
peer address 172.16.0.242;
peer port 647;
max-response-delay 30;
max-unacked-updates 10;
load balance max seconds 3;
mclt 1800;
split 3; ### 驗(yàn)證時(shí)墙歪,地址池是5個(gè)蹬刷,則取中間數(shù)量做分割
}
subnet 172.19.58.0 netmask 255.255.255.0 { ##使用位置: 玉柴大廈7樓钠怯,內(nèi)部使用
option routers 172.19.58.1; #修改網(wǎng)關(guān)
pool {
failover peer "ycfailover";
range 172.19.58.20 172.19.58.24; ## 5 IP自動(dòng)分配
authoritative; #申明權(quán)威子網(wǎng)
}
}
新DHCP服務(wù)器IP地址虱岂,172.16.0.241屯伞、172.16.0.242违帆,不影響現(xiàn)有用戶
驗(yàn)證新DHCP集群環(huán)境效果
在玉柴大廈匯聚三層交換機(jī),修改網(wǎng)段172.19.58(內(nèi)部使用莽鸭,不影響業(yè)務(wù)部門(mén)使用)的dhcp配置
interface Vlan58
description TO-7F-ITSYS
no shutdown
ip access-group deny_blj in
no ip redirects
ip address 172.19.58.253/24
no ipv6 redirects
ip router ospf 10 area 0.0.0.0
hsrp 58
preempt
priority 10
ip 172.19.58.1
ip dhcp relay address 172.16.0.241
ip dhcp relay address 172.16.0.242
測(cè)試驗(yàn)證 把主節(jié)點(diǎn)關(guān)機(jī)
Jun 27 13:01:36 yc-itbase-dhcp-0-241 dhcpd: DHCPOFFER on 172.19.58.22 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-241 dhcpd: DHCPDISCOVER from 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-241 dhcpd: DHCPOFFER on 172.19.58.22 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-241 dhcpd: DHCPREQUEST for 172.19.58.22 (172.16.0.241) from 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-241 dhcpd: DHCPACK on 172.19.58.22 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-241 dhcpd: Unable to add forward map from ycithp1.yuchai.com to 172.19.58.22: not found
Jun 27 13:02:43 yc-itbase-dhcp-0-241 dhcpd: DHCPREQUEST for 172.16.133.14 from 00:50:56:b1:d3:4f (w2016-tst001) via eth0
Jun 27 13:02:43 yc-itbase-dhcp-0-241 dhcpd: DHCPACK on 172.16.133.14 to 00:50:56:b1:d3:4f (w2016-tst001) via eth0
Jun 27 13:02:43 yc-itbase-dhcp-0-241 dhcpd: Unable to add forward map from w2016-tst001.yuchai.com to 172.16.133.14: not found
Jun 27 13:03:30 yc-itbase-dhcp-0-241 dhcpd: DHCPREQUEST for 172.16.133.15 from 00:50:56:b1:60:0d via eth0
Jun 27 13:03:30 yc-itbase-dhcp-0-241 dhcpd: DHCPACK on 172.16.133.15 to 00:50:56:b1:60:0d via eth0
^C
You have new mail in /var/spool/mail/root
[root@yc-itbase-dhcp-0-241 dhcpd-webui]# init 0
Connection closing...Socket close.
客戶端拔插網(wǎng)線吗伤,在dhcp節(jié)點(diǎn)2上,可以看到成功分配到IP地址
Jun 27 13:00:01 yc-itbase-dhcp-0-242 systemd: Started Session 75 of user root.
Jun 27 13:01:01 yc-itbase-dhcp-0-242 systemd: Started Session 76 of user root.
Jun 27 13:01:01 yc-itbase-dhcp-0-242 systemd: Started Session 77 of user root.
Jun 27 13:01:29 yc-itbase-dhcp-0-242 dhcpd: DHCPINFORM from 172.19.58.12 via 172.19.58.254: not authoritative for subnet 172.19.58.0
Jun 27 13:01:29 yc-itbase-dhcp-0-242 dhcpd: If this DHCP server is authoritative for that subnet,
Jun 27 13:01:29 yc-itbase-dhcp-0-242 dhcpd: please write an `authoritative;' directive either in the
Jun 27 13:01:29 yc-itbase-dhcp-0-242 dhcpd: subnet declaration or in some scope that encloses the
Jun 27 13:01:29 yc-itbase-dhcp-0-242 dhcpd: subnet declaration - for example, write it at the top
Jun 27 13:01:29 yc-itbase-dhcp-0-242 dhcpd: of the dhcpd.conf file.
Jun 27 13:01:31 yc-itbase-dhcp-0-242 dhcpd: DHCPDISCOVER from 00:0e:c6:c1:eb:88 via 172.19.58.254
Jun 27 13:01:32 yc-itbase-dhcp-0-242 dhcpd: DHCPOFFER on 172.19.58.20 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:33 yc-itbase-dhcp-0-242 dhcpd: DHCPINFORM from 172.19.58.12 via 172.19.58.254: not authoritative for subnet 172.19.58.0
Jun 27 13:01:35 yc-itbase-dhcp-0-242 dhcpd: DHCPDISCOVER from 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:35 yc-itbase-dhcp-0-242 dhcpd: DHCPOFFER on 172.19.58.20 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-242 dhcpd: DHCPDISCOVER from 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-242 dhcpd: DHCPOFFER on 172.19.58.20 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
Jun 27 13:01:43 yc-itbase-dhcp-0-242 dhcpd: uid lease 172.19.58.20 for client 00:0e:c6:c1:eb:88 is duplicate on 172.19.58.0/24
Jun 27 13:03:51 yc-itbase-dhcp-0-242 dhcpd: peer ycfailover: disconnected
Jun 27 13:03:51 yc-itbase-dhcp-0-242 dhcpd: failover peer ycfailover: I move from normal to communications-interrupted
Jun 27 13:04:59 yc-itbase-dhcp-0-242 dhcpd: DHCPREQUEST for 172.19.58.22 from 00:0e:c6:c1:eb:88 via 172.19.58.254
Jun 27 13:04:59 yc-itbase-dhcp-0-242 dhcpd: DHCPACK on 172.19.58.22 to 00:0e:c6:c1:eb:88 (ycithp1) via 172.19.58.254
后續(xù)工作
梳理終端使用的網(wǎng)段DHCP信息
網(wǎng)段DHCP地址池分配原則
- 網(wǎng)段第一個(gè)IP地址為VLAN網(wǎng)關(guān)硫眨,不可分配
- 網(wǎng)段多少有一些需要固定IP的設(shè)備足淆,統(tǒng)一為網(wǎng)段最后20個(gè)
- 建議用于DHCP自動(dòng)分配的地址段為 10 - 230
- 租約時(shí)間建議
配置格式如下:
### 終端網(wǎng)段1
subnet 172.19.58.0 netmask 255.255.255.0 { ##使用位置: 玉柴大廈7樓,內(nèi)部使用
option routers 172.19.58.1; #修改網(wǎng)關(guān)
pool {
failover peer "ycfailover";
range 172.19.58.20 172.19.58.24; ## 5 IP自動(dòng)分配
authoritative; #申明權(quán)威子網(wǎng)
}
}
### 終端網(wǎng)段2
subnet 172.16.11.0 netmask 255.255.255.0 { ##使用位置: 玉柴大學(xué)2樓201礁阁、202巧号、203教室
option routers 172.16.11.1; #修改網(wǎng)關(guān)
pool {
failover peer "ycfailover";
range 172.16.11.11 172.16.11.200; ##可分配的IP區(qū)域 11-200 ,共190可以自動(dòng)分配
}
}
### 終端網(wǎng)段3
subnet 172.16.13.0 netmask 255.255.255.0 { ##使用位置: 動(dòng)力大廈12樓姥闭、13樓丹鸿、14樓
option routers 172.16.13.1; #修改網(wǎng)關(guān)
pool {
failover peer "ycfailover";
range 172.16.13.11 172.16.13.200; ##可分配的IP區(qū)域 11-200 ,共190可以自動(dòng)分配
}
}
在新DHCP集群服務(wù)器上逐個(gè)網(wǎng)段配置DHCP
分次在各個(gè)三層交換機(jī)上配置DHCP relay信息或者ip dhcp helper棚品,驗(yàn)證各個(gè)網(wǎng)段的終端是否正常獲取IP地址
ip dhcp relay address 172.16.0.241
ip dhcp relay address 172.16.0.242