# [SOLVED] dhcp server refuses longer than 30 min leases.

## drescherjm

In the last year I have decided to implement dhcp failover because our dhcp server box was having a hardware problem and I like having as redundancy in as many essential services as I can. However after adding the failover it seems my clients are all renewing their leases every 30 minutes. Since the clients are pretty static and we definitely have enough addresses I want to extend this to at minimum a day and more reasonable 1 week. I have both edited the files by hand and used webmin and in all cases the 30 minute leases persist (on both dhcp servers). Here is the config of the primary:

```
# less /etc/dhcp/dhcpd.conf

ddns-updates on;

ddns-domainname "radimg.pitt.edu";

#server-identifier 192.168.1.5;

default-lease-time 604800;

max-lease-time 2592000;

authoritative;

ddns-update-style interim;

failover peer "dhcp-failover" {

  secondary;

  address 192.168.1.230;

  port 647;

  peer address 192.168.1.40;

  peer port 647;

  max-response-delay 30;

  max-unacked-updates 10;

  load balance max seconds 3;

  mclt 3600;

}

subnet 192.168.0.0 netmask 255.255.0.0 {

        default-lease-time 604800;

        option domain-name "radimg.pitt.edu";

        # option routers 192.168.1.1;

        option subnet-mask 255.255.0.0;

        option domain-name-servers 192.168.1.2 , 192.168.1.3;

        option broadcast-address 192.168.1.255;

        pool {

                failover peer "dhcp-failover";

                range 192.168.2.32 192.168.2.252;

                max-lease-time 2592000;

                default-lease-time 604800;

                }

        }

```

Any ideas what I am doing wrong?

----------

## think4urs11

Did you configure mclt on both primary and secondary server or only on the primary? (Should be on the primary only)

Normally (i'm not the 105% DHCP-Guru though) the 30 minutes you see could be caused by the mclt/2 but that should only occur when the secondary hands out addresses while the primary is in PARTNER-DOWN state. This is done so that as soon as the primary comesup again it can takeover again pretty quickly - so it is not a good idea to increase mclt.

----------

## drescherjm

 *Quote:*   

> Did you configure mclt on both primary and secondary server or only on the primary? 

 

I do have it on both. Fixing now.

Here is the secondary file (after commenting mclt out):

```

ddns-updates on;

ddns-domainname "radimg.pitt.edu";

#server-identifier 192.168.1.5;

default-lease-time 604800;

max-lease-time 2592000;

authoritative;

ddns-update-style interim;

failover peer "dhcp-failover" {

  secondary;

  address 192.168.1.230;

  port 647;

  peer address 192.168.1.40;

  peer port 647;

  max-response-delay 30;

  max-unacked-updates 10;

  load balance max seconds 3;

  #mclt 3600;

}

subnet 192.168.0.0 netmask 255.255.0.0 {

  option domain-name "radimg.pitt.edu";

  default-lease-time 604800;

  #option routers 192.168.1.1;

  option subnet-mask 255.255.0.0;

  option domain-name-servers 192.168.1.2, 192.168.1.3;

  option broadcast-address 192.168.1.255;

  pool {

        failover peer "dhcp-failover";

        range 192.168.2.32 192.168.2.252;

        default-lease-time 604800;

        max-lease-time 2592000;

  }

}

```

----------

## drescherjm

After restarting both servers and renewing the address I windows XP still has a 30 minute lease:

```

Ethernet adapter Network Bridge:

        Connection-specific DNS Suffix  . : radimg.pitt.edu

        Description . . . . . . . . . . . : MAC Bridge Miniport

        Physical Address. . . . . . . . . : 02-1E-8C-64-29-CD

        Dhcp Enabled. . . . . . . . . . . : Yes

        Autoconfiguration Enabled . . . . : Yes

        IP Address. . . . . . . . . . . . : 192.168.2.214

        Subnet Mask . . . . . . . . . . . : 255.255.0.0

        Default Gateway . . . . . . . . . : 192.168.1.1

        DHCP Server . . . . . . . . . . . : 192.168.1.40

        DNS Servers . . . . . . . . . . . : 192.168.1.2

                                            192.168.1.3

        Lease Obtained. . . . . . . . . . : Wednesday, January 28, 2009 5:02:27 PM

        Lease Expires . . . . . . . . . . : Wednesday, January 28, 2009 5:32:27 PM
```

but now this time it was taken from the primary instead of the secondary and I got an new ipaddress..

----------

## think4urs11

Seems you've both failover peers configured as secondary?

Did you start with a clean leases file on both members?

----------

## drescherjm

The first one I posted was supposed to be the primary. 

192.168.1.40

I believe the secondary 192.168.1.230 was added as a fresh system but the 192.162.1.40 had leases at that time.

BTW, I really appreciate your help.

----------

## drescherjm

I used this guide to set things up. 

http://www.madboa.com/geek/dhcp-failover/

However it looks like the setup is now out of whack as I remember following it very closely. I may have sftpd the config from one to the other...

I will fix the obvious mistakes and report back..

----------

## drescherjm

Thank you . Fixed.

```
Ethernet adapter Network Bridge:

        Connection-specific DNS Suffix  . : radimg.pitt.edu

        Description . . . . . . . . . . . : MAC Bridge Miniport

        Physical Address. . . . . . . . . : 02-1E-8C-64-29-CD

        Dhcp Enabled. . . . . . . . . . . : Yes

        Autoconfiguration Enabled . . . . : Yes

        IP Address. . . . . . . . . . . . : 192.168.2.214

        Subnet Mask . . . . . . . . . . . : 255.255.0.0

        Default Gateway . . . . . . . . . : 192.168.1.1

        DHCP Server . . . . . . . . . . . : 192.168.1.40

        DNS Servers . . . . . . . . . . . : 192.168.1.2

                                            192.168.1.3

        Lease Obtained. . . . . . . . . . : Wednesday, January 28, 2009 5:33:13 PM

        Lease Expires . . . . . . . . . . : Wednesday, February 04, 2009 5:33:13 PM

```

Here is the new primary config:

```
ddns-updates on;

ddns-domainname "radimg.pitt.edu";

#server-identifier 192.168.1.5;

default-lease-time 604800;

max-lease-time 2592000;

authoritative;

ddns-update-style interim;

failover peer "dhcp-failover" {

  primary;

  address 192.168.1.40;

  port 647;

  peer address 192.168.1.230;

  peer port 647;

  max-response-delay 30;

  max-unacked-updates 10;

  load balance max seconds 3;

  mclt 3600;

  split 128;

}

subnet 192.168.0.0 netmask 255.255.0.0 {

        default-lease-time 604800;

        option domain-name "radimg.pitt.edu";

        # option routers 192.168.1.1;

        option subnet-mask 255.255.0.0;

        option domain-name-servers 192.168.1.2 , 192.168.1.3;

        option broadcast-address 192.168.1.255;

        pool {

                failover peer "dhcp-failover";

                range 192.168.2.32 192.168.2.252;

                max-lease-time 2592000;

                default-lease-time 604800;

        }

}
```

----------

## think4urs11

There're at least two additional bugs in the config.

a) the lease-range and the broadcastadress for the subnet don't match (both should be .1.xyz probably?)

b) the broadcast address and the netmask for the pool don't match (either nm should be /24 or brd 192.168.255.255)

----------

## drescherjm

 *Quote:*   

> a) the lease-range and the broadcastadress for the subnet don't match (both should be .1.xyz probably?) 

 

192.168.0.X are static ip development  machines and test boxes (not many there any more)

192.168.1.X are static ip linux servers 

192.168.2.X are dhcp (windows and linux) clients

 *Quote:*   

> b) the broadcast address and the netmask for the pool don't match (either nm should be /24 or brd 192.168.255.255)

 

I think that should be 

192.168.255.255

----------

