2019-06-27 安装配置DHCP集群服务器

DHCP集群搭建工作安排

安装配置DHCP集群服务器

安装配置两台Linux7.6操作系统做为dhcp集群服务器,已完成

DHCP服务器配置,主DHCP服务器配置 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个小时
max-lease-time 64800;## 18个小时

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; ### 验证时,地址池是5个,则取中间数量做分割
}

subnet 172.19.58.0 netmask 255.255.255.0 { ##使用位置: 玉柴大厦7楼,内部使用
  option routers 172.19.58.1;   #修改网关
  pool {
     failover peer "ycfailover";
     range 172.19.58.20 172.19.58.24; ## 5 IP自动分配
     authoritative;    #申明权威子网
  }
}

新DHCP服务器IP地址,172.16.0.241、172.16.0.242,不影响现有用户

验证新DHCP集群环境效果

在玉柴大厦汇聚三层交换机,修改网段172.19.58(内部使用,不影响业务部门使用)的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

测试验证 把主节点关机


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.

客户端拔插网线,在dhcp节点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

后续工作

梳理终端使用的网段DHCP信息

网段DHCP地址池分配原则

  1. 网段第一个IP地址为VLAN网关,不可分配
  2. 网段多少有一些需要固定IP的设备,统一为网段最后20个
  3. 建议用于DHCP自动分配的地址段为 10 - 230
  4. 租约时间建议

配置格式如下:

### 终端网段1
subnet 172.19.58.0 netmask 255.255.255.0 { ##使用位置: 玉柴大厦7楼,内部使用
  option routers 172.19.58.1;   #修改网关
  pool {
     failover peer "ycfailover";
     range 172.19.58.20 172.19.58.24; ## 5 IP自动分配
     authoritative;    #申明权威子网
  }
}

### 终端网段2
subnet 172.16.11.0 netmask 255.255.255.0 { ##使用位置: 玉柴大学2楼201、202、203教室
  option routers 172.16.11.1;   #修改网关
  pool {
     failover peer "ycfailover";
     range 172.16.11.11 172.16.11.200; ##可分配的IP区域 11-200 ,共190可以自动分配
  }
}

### 终端网段3
subnet 172.16.13.0 netmask 255.255.255.0 { ##使用位置: 动力大厦12楼、13楼、14楼
  option routers 172.16.13.1;   #修改网关
  pool {
     failover peer "ycfailover";
     range 172.16.13.11 172.16.13.200; ##可分配的IP区域 11-200 ,共190可以自动分配
  }
}

在新DHCP集群服务器上逐个网段配置DHCP

分次在各个三层交换机上配置DHCP relay信息或者ip dhcp helper,验证各个网段的终端是否正常获取IP地址

ip dhcp relay address 172.16.0.241
ip dhcp relay address 172.16.0.242

跟踪排除异常

你可能感兴趣的:(2019-06-27 安装配置DHCP集群服务器)