Jump to content

GSTN - DHCP HA Configuration

From TetraWiki


DHCP HA Configuration:[edit]

The Servers:[edit]

Primary IP address: 172.18.101.12




Secondary IP address: 172.18.101.13


How HA is working?


With DHCP failover, DHCPv4 scopes can be replicated from a primary DHCP server to a secondary DHCP server, enabling redundancy and load balancing of DHCP services.


Both server are configured in HA. Given below the configuration file of both DHCP servers. They communicate on port number 519 and 520 as defined in dhcpd.conf file.




Primary DHCP server:



# Failover specific configurations




[root@gd9101 ~]# cat /etc/dhcp/dhcpd.conf


ddns-update-style none;


one-lease-per-client true;


option domain-name "gstn.local";


option domain-name-servers 172.18.101.14, 172.18.101.15;


default-lease-time 28800;


max-lease-time 288000;


lease-file-name "/var/log/dhcpd/dhcpd.leases";


authoritative;


log-facility local5;


option option-242 code 242 = string;




failover peer "dhcp" {


primary;


address 172.18.101.12;


port 519;


peer address 172.18.101.13;


peer port 520;


max-response-delay 60;


max-unacked-updates 10;


mclt 600;


split 128;


load balance max seconds 3;


}




include "/etc/dhcpd.master";




==============================================================












Secondary Server:




# Failover specific configurations




[root@gd9102 ~]# cat /etc/dhcp/dhcpd.conf


ddns-update-style none;


one-lease-per-client true;


option domain-name "gstn.local";


option domain-name-servers 172.18.101.14, 172.18.101.15;


default-lease-time 28800;


max-lease-time 288000;


lease-file-name "/var/log/dhcpd/dhcpd.leases";


authoritative;


log-facility local5;


option option-242 code 242 = string;



failover peer "dhcp" {


secondary;


address 172.18.101.13;


port 520;


peer address 172.18.101.12;


peer port 519;


max-response-delay 60;


max-unacked-updates 10;


}

include "/etc/dhcpd.master";


=============================================================


When two DHCP servers are configured for failover, they will share scope information, including all active leases. This enables both DHCP servers to provide leases to the same subnet for load balancing or redundancy purposes. Scope settings are replicated when you first configure DHCP failover, and can be replicated again later if configuration changes are made.




To take advantage of failover, we need to create a pool. We have created pools in "/etc/dhcpd.master" on both servers as shown below:




Primary Server:




Output of "/etc/dhcpd.master"




subnet 172.18.101.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.101.216 172.18.101.217;


}


option routers 172.18.101.1;


}




shared-network data {


subnet 172.18.5.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.5.51 172.18.5.240;


}


option routers 172.18.5.1;


option broadcast-address 172.18.5.255;


}


}




shared-network voice {


subnet 172.18.2.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.2.51 172.18.2.240;


}


option routers 172.18.2.1;


option broadcast-address 172.18.2.255;


option option-242 "MCIPADD=172.18.102.16,MCPORT=1719,HTTPSRVR=172.18.102.16";


}


}




subnet 172.18.3.32 netmask 255.255.255.224 {


pool {


failover peer "dhcp";


range 172.18.3.41 172.18.3.62;


deny dynamic bootp clients;


}


option routers 172.18.3.33;


option broadcast-address 172.18.3.63;


}




subnet 172.18.4.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.4.51 172.18.4.240;


deny dynamic bootp clients;


}


option routers 172.18.4.1;


option broadcast-address 172.18.4.255;


}




subnet 172.18.6.0 netmask 255.255.255.192 {


pool {


failover peer "dhcp";


range 172.18.6.21 172.18.6.62;


deny dynamic bootp clients;


}


option routers 172.18.6.1;


option broadcast-address 172.18.6.63;


}




subnet 172.18.7.0 netmask 255.255.255.224 {


pool {


failover peer "dhcp";


range 172.18.7.11 172.18.7.30;


deny dynamic bootp clients;


}


option routers 172.18.7.1;


option broadcast-address 172.18.7.31;


}




subnet 172.18.8.0 netmask 255.255.255.224 {


pool {


failover peer "dhcp";


range 172.18.8.11 172.18.8.30;


deny dynamic bootp clients;


}


option routers 172.18.8.1;


option broadcast-address 172.18.8.31;


}






subnet 172.18.10.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.10.51 172.18.10.240;


deny dynamic bootp clients;


}


option routers 172.18.10.1;


option broadcast-address 172.18.10.255;


}




subnet 172.18.11.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.11.51 172.18.11.240;


deny dynamic bootp clients;


}


option routers 172.18.11.1;


option broadcast-address 172.18.11.255;


}






subnet 172.18.12.0 netmask 255.255.255.0 {


option broadcast-address 172.18.12.255;


pool {


failover peer "dhcp";


range 172.18.12.51 172.18.12.240;


deny dynamic bootp clients;


}


option routers 172.18.12.1;


}




shared-network gd-soft {


subnet 172.18.16.0 netmask 255.255.255.192 {


pool {


failover peer "dhcp";


range 172.18.16.11 172.18.16.62;


deny dynamic bootp clients;


}


option routers 172.18.16.1;


option broadcast-address 172.18.16.63;


}


}






subnet 172.18.20.0 netmask 255.255.255.0 {


option broadcast-address 172.18.20.255;


pool {


failover peer "dhcp";


range 172.18.20.51 172.18.20.240;


deny dynamic bootp clients;


}


option routers 172.18.20.1;


}




subnet 172.18.21.0 netmask 255.255.255.0 {


option broadcast-address 172.18.21.255;


pool {


failover peer "dhcp";


range 172.18.21.51 172.18.21.240;


deny dynamic bootp clients;


}


option routers 172.18.21.1;


}


===================================================================


Seconday Server:




Output of "/etc/dhcpd.master"




subnet 172.18.101.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.101.216 172.18.101.217;


}


option routers 172.18.101.1;


}




shared-network data {


subnet 172.18.5.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.5.51 172.18.5.240;


}


option routers 172.18.5.1;


option broadcast-address 172.18.5.255;


}


}










shared-network voice {


subnet 172.18.2.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.2.51 172.18.2.240;


}


option routers 172.18.2.1;


option broadcast-address 172.18.2.255;


option option-242 "MCIPADD=172.18.102.16,MCPORT=1719,HTTPSRVR=172.18.102.16";


}


}




subnet 172.18.3.32 netmask 255.255.255.224 {


pool {


failover peer "dhcp";


range 172.18.3.41 172.18.3.62;


deny dynamic bootp clients;


}


option routers 172.18.3.33;


option broadcast-address 172.18.3.63;


}




subnet 172.18.4.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.4.51 172.18.4.240;


deny dynamic bootp clients;


}


option routers 172.18.4.1;


option broadcast-address 172.18.4.255;


}




subnet 172.18.6.0 netmask 255.255.255.192 {


pool {


failover peer "dhcp";


range 172.18.6.21 172.18.6.62;


deny dynamic bootp clients;


}


option routers 172.18.6.1;


option broadcast-address 172.18.6.63;


}




subnet 172.18.7.0 netmask 255.255.255.224 {


pool {


failover peer "dhcp";


range 172.18.7.11 172.18.7.30;


deny dynamic bootp clients;


}


option routers 172.18.7.1;


option broadcast-address 172.18.7.31;


}




subnet 172.18.8.0 netmask 255.255.255.224 {


pool {


failover peer "dhcp";


range 172.18.8.11 172.18.8.30;


deny dynamic bootp clients;


}


option routers 172.18.8.1;


option broadcast-address 172.18.8.31;


}






subnet 172.18.10.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.10.51 172.18.10.240;


deny dynamic bootp clients;


}


option routers 172.18.10.1;


option broadcast-address 172.18.10.255;


}




subnet 172.18.11.0 netmask 255.255.255.0 {


pool {


failover peer "dhcp";


range 172.18.11.51 172.18.11.240;


deny dynamic bootp clients;


}


option routers 172.18.11.1;


option broadcast-address 172.18.11.255;


}






subnet 172.18.12.0 netmask 255.255.255.0 {


option broadcast-address 172.18.12.255;


pool {


failover peer "dhcp";


range 172.18.12.51 172.18.12.240;


deny dynamic bootp clients;


}


option routers 172.18.12.1;


}




shared-network gd-soft {


subnet 172.18.16.0 netmask 255.255.255.192 {


pool {


failover peer "dhcp";


range 172.18.16.11 172.18.16.62;


deny dynamic bootp clients;


}


option routers 172.18.16.1;


option broadcast-address 172.18.16.63;


}


}






subnet 172.18.20.0 netmask 255.255.255.0 {


option broadcast-address 172.18.20.255;


pool {


failover peer "dhcp";


range 172.18.20.51 172.18.20.240;


deny dynamic bootp clients;


}


option routers 172.18.20.1;


}




subnet 172.18.21.0 netmask 255.255.255.0 {


option broadcast-address 172.18.21.255;


pool {


failover peer "dhcp";


range 172.18.21.51 172.18.21.240;


deny dynamic bootp clients;


}


option routers 172.18.21.1;


}




=====================================================================






DHCP6 Configuration in HA:




In DHCPv6, the half of ipv6 range is given in Primary server and rest half of the ipv6 range is given in secondary server.


For example:


IPv6 range on primary server for below range is from


range6 2404:a800:1000:d:2000::b 2404:a800:1000:d:2000::85




and on secondary server it is from


range6 2404:a800:1000:d:2000::88 2404:a800:1000:d:2000::100


Primary Server:




DHCPv6 configuration file:




vi /etc/dhcp/dhcpd6.conf




default-lease-time 28800;


preferred-lifetime 28800;


option dhcp-renewal-time 3600;


option dhcp-rebinding-time 7200;


allow leasequery;


option dhcp6.name-servers 2404:a800:1000:d:7800::e, 2404:a800:1000:d:7800::f;


option dhcp6.domain-search "gstn.local";


##option dhcp6.preference 255;


##option dhcp6.rapid-commit;


option dhcp6.info-refresh-time 2160;


dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";


subnet6 2404:a800:1000:d:7800::/69 {


range6 2404:a800:1000:d:7800::90 2404:a800:1000:d:7800::91;


}


subnet6 2404:a800:1000:000d:2000::/69 {


range6 2404:a800:1000:d:2000::b 2404:a800:1000:d:2000::85;


}




subnet6 2404:a800:1000:000d:0800::/69 {


range6 2404:a800:1000:d:800::b 2404:a800:1000:d:800::85;


}




subnet6 2404:a800:1000:000d:1800::/69 {


range6 2404:a800:1000:d:1800::b 2404:a800:1000:d:1800::85;


}




subnet6 2404:a800:1000:000d:2800::/69 {


range6 2404:a800:1000:d:2800::b 2404:a800:1000:d:2800::85;


}




subnet6 2404:a800:1000:000d:3000::/69 {


range6 2404:a800:1000:d:3000::b 2404:a800:1000:d:3000::85;


}




subnet6 2404:a800:1000:000d:3800::/69 {


range6 2404:a800:1000:d:3800::b 2404:a800:1000:d:3800::85;


}




subnet6 2404:a800:1000:000d:4800::/69 {


range6 2404:a800:1000:d:4800::b 2404:a800:1000:d:4800::85;


}




subnet6 2404:a800:1000:000d:5000::/69 {


range6 2404:a800:1000:d:5000::b 2404:a800:1000:d:5000::85;


}




subnet6 2404:a800:1000:000d:5800::/69 {


range6 2404:a800:1000:d:5800::b 2404:a800:1000:d:5800::85;


}




subnet6 2404:a800:1000:000d:6000::/69 {


range6 2404:a800:1000:d:6000::b 2404:a800:1000:d:6000::85;


}




subnet6 2404:a800:1000:000d:6800::/69 {


range6 2404:a800:1000:d:6800::b 2404:a800:1000:d:6800::85;


}




subnet6 2404:a800:1000:000d:b800::/69 {


range6 2404:a800:1000:d:b800::b 2404:a800:1000:d:b800::85;


}






Secondary Server:




DHCPv6 configuration file:




vi /etc/dhcp/dhcpd6.conf




default-lease-time 28800;


preferred-lifetime 28800;


option dhcp-renewal-time 3600;


option dhcp-rebinding-time 7200;


allow leasequery;


option dhcp6.name-servers 2404:a800:1000:d:7800::e, 2404:a800:1000:d:7800::f;


option dhcp6.domain-search "gstn.local";


##option dhcp6.preference 255;


##option dhcp6.rapid-commit;


option dhcp6.info-refresh-time 2160;


dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";


subnet6 2404:a800:1000:d:7800::/69 {


range6 2404:a800:1000:d:7800::92 2404:a800:1000:d:7800::93;


}




subnet6 2404:a800:1000:000d:2000::/69 {


range6 2404:a800:1000:d:2000::88 2404:a800:1000:d:2000::98;




}


subnet6 2404:a800:1000:000d:0800::/69 {


range6 2404:a800:1000:d:800::88 2404:a800:1000:d:800::100;


}




subnet6 2404:a800:1000:000d:1800::/69 {


range6 2404:a800:1000:d:1800::88 2404:a800:1000:d:1800::100;


}




subnet6 2404:a800:1000:000d:2800::/69 {


range6 2404:a800:1000:d:2800::88 2404:a800:1000:d:2800::100;


}




subnet6 2404:a800:1000:000d:3000::/69 {


range6 2404:a800:1000:d:3000::88 2404:a800:1000:d:3000::100;


}




subnet6 2404:a800:1000:000d:3800::/69 {


range6 2404:a800:1000:d:3800::88 2404:a800:1000:d:3800::100;


}




subnet6 2404:a800:1000:000d:4800::/69 {


range6 2404:a800:1000:d:4800::88 2404:a800:1000:d:4800::100;


}




subnet6 2404:a800:1000:000d:5000::/69 {


range6 2404:a800:1000:d:5000::88 2404:a800:1000:d:5000::100;


}




subnet6 2404:a800:1000:000d:5800::/69 {


range6 2404:a800:1000:d:5800::88 2404:a800:1000:d:5800::100;


}




subnet6 2404:a800:1000:000d:6000::/69 {


range6 2404:a800:1000:d:6000::88 2404:a800:1000:d:6000::100;


}




subnet6 2404:a800:1000:000d:6800::/69 {


range6 2404:a800:1000:d:6800::88 2404:a800:1000:d:6800::100;


}




subnet6 2404:a800:1000:000d:b800::/69 {


range6 2404:a800:1000:d:b800::88 2404:a800:1000:d:b800::100;


}






















In HA, DHCP servers are in continuos syncronization with each other. You can get it from log file of

DHCP server




Primary server /var/log/messages












Secondary server /var/log/messages