Monday, March 14, 2016

failover dhcp server, isc-dhcp-server

**info**
primary server ip: 192.168.202.24
secondary server ip: 192.168.202.23
dhcp range: 192.168.202.100 - 192.168.202.254

1- installation on both server
$ sudo apt-get intall isc-dhcp-server

2- on primary server change the configure to the following (/etc/dhcp/dhcpd.conf)

failover peer "failover-partner" {
        primary;
        address 192.168.202.24;
        port 519;
        peer address 192.168.202.23;
        peer port 520;
        max-response-delay 60;
        max-unacked-updates 10;
        mclt 3600;
        split 128;
        load balance max seconds 3;
}

omapi-port 7911;
omapi-key omapi_key;

key omapi_key {
     algorithm hmac-md5;
     secret Offffkkkkageieybauewej==;
}

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.202.0 netmask 255.255.255.0 {
     option routers             192.168.202.5;
     option domain-name-servers 192.168.202.1;
     option subnet-mask         255.255.255.0;
     default-lease-time         21600;
     max-lease-time             43200;
     pool {
       failover peer "failover-partner";
       range 192.168.202.100 192.168.202.254;
       }

}


3- on secondary server change the configure to the following (/etc/dhcp/dhcpd.conf)

failover peer "failover-partner" {
        secondary;
        address 192.168.202.23;
        port 519;
        peer address 192.168.202.24;
        peer port 520;
        max-response-delay 60;
        max-unacked-updates 10;
        load balance max seconds 3;
}

omapi-port 7911;
omapi-key omapi_key;

key omapi_key {
     algorithm hmac-md5;
     secret Offffkkkkageieybauewej==;
}

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.202.0 netmask 255.255.255.0 {
     option routers             192.168.202.5;
     option domain-name-servers 192.168.202.1;
     option subnet-mask         255.255.255.0;
     default-lease-time         21600;
     max-lease-time             43200;
     pool {
       failover peer "failover-partner";
       range 192.168.202.100 192.168.202.254;
       }

}


4- restart the dhcp service on both server.
$ sudo /etc/init.d/isc-dhcp-server restart

now both dhcp server will backup each other when either of them fail

No comments:

Post a Comment