OpenWrt Forum Archive

Topic: DHCP Server that supports failover?

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi Guys, I am attempting to install two OpenWRT boxes each with its own internet connection.  The plan is to reduce the amount of single point failures that can occur.  One of my issues which can bring my network down, is if the main OpenWRT box died, and the dchp and dns services became unavailable.  So my question is, is there any DHCP server that is already packaged for OpenWRT that can support dhcp failover?

Thanks,

William

it already supports fail over.

# cat /tmp/resolv.conf.auto
nameserver 207.164.234.193
nameserver 67.69.184.199

They are tried in order

Hi Weedy, thanks for your reply.  I apologize if my question was a bit unclear, but my question is actually related more to having a dhcp server that can support the following directive: failover peer


An example of the usage of the directive would be as follows... Primary DHCP Server:
authoritative;
ddns-update-style none;

failover peer "dhcp-failover" {
  primary; # declare this to be the primary server
  address 192.168.200.2;
  port 520;
  peer address 192.168.200.3;
  peer port 520;
  max-response-delay 30;
  max-unacked-updates 10;
  load balance max seconds 3;
  mclt 1800;
  split 128;
}

subnet 192.168.200.0 netmask 255.255.255.0 {
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.200.255;
  option routers 192.168.200.1;
  option domain-name-servers 192.168.200.1;
  pool {
    failover peer "dhcp-failover";
    max-lease-time 1800; # 30 minutes
    range 192.168.200.100 192.168.200.254;
  }
}


Secondary DHCP Server:
authoritative;
ddns-update-style none;

failover peer "dhcp-failover" {
  secondary; # declare this to be the secondary server
  address 192.168.200.3;
  port 520;
  peer address 192.168.200.2;
  peer port 520;
  max-response-delay 30;
  max-unacked-updates 10;
  load balance max seconds 3;
}

subnet 192.168.200.0 netmask 255.255.255.0 {
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.200.255;
  option routers 192.168.200.1;
  option domain-name-servers 192.168.200.1;
  pool {
    failover peer "dhcp-failover";
    max-lease-time 1800; # 30 minutes
    range 192.168.200.100 192.168.200.254;
  }
}

The idea would be that my workstations/servers would get a dhcp ip from OpenWRT #1, and OpenWRT #1 would update the lease file on OpenWRT #2, so both lease files are identical.  If OpenWRT #1 where to die, OpenWRT #2 would become the DHCP Authoritive server, and start handing out dhcp leases until OpenWRT #1 was back online.

The discussion might have continued from here.