DHCP 2012 r2 static reservations replication not working

So, we updated our DHCP Servers to 2012 R2.

We setup DHCP Failover, which was easy to setup and seems very nice.
But, we don’t see our static reservations migrating.

Did I miss that leases are not part of the cluster, or is there a setting somewhere to have the reservations automatically replicated on the failover server?

Well actually, you need to right-click on IPv4 and/or IPv6 or the individual scope and select Replicate Failover Scopes.
You have to do it every time you make a new reservation.

Well that’s a pain, surely there is a check box? err nope!

Ok  a quick google found this:

Automatic syncing of configuration changes between 2 DHCP failover servers

It is for 2012, does not look like it has been tested on 2012 R2.

Code looks a bit epic and R2 brings some good Powershell cmdlets for DCHP….. lets have a look at the new cmdlets available

hmm here we go…

Invoke-DhcpServerv4FailoverReplication cmdlet looks a winner!

a  het-help Invoke-DhcpServerv4FailoverReplication   -full gives us some examples!

Well the answer is pretty simple in R2 Powershell does it for you in the one command.

 

BUT NOTE: This is replication, not syncing, so whatever server you replicate the scopes from will fully overwrite the other servers scopes on the target server.

So if you edit stuff on each server, then replicate one server, the other one’s changes will be overwritten.

Probably best practice is to use one server as the primary server and do all your changes there, then replicate the changes over to the secondary server

anyhow, if you want to replicate, you have options for:

Everything on the server

InvokeDhcpServerv4FailoverReplication ComputerName dhcpserver.contoso.com

This example replicates all of the failover scopes on the DHCP server service running on the computer named dhcpserver.contoso.com to one or more respective partner DHCP server services based on one or more failover relationships in which the DHCP server services are included.

A failover relationship

InvokeDhcpServerv4FailoverReplication ComputerName dhcpserver.contoso.com Name SFOSINFailover

This example replicates the configuration of all scopes which are part of the failover relationship named SFO-SIN-Failover on the DHCP server service running on the computer named dhcpserver.contoso.com to the partner DHCP server service

A Particular Scope or  Scopes

InvokeDhcpServerv4FailoverReplication ComputerName dhcpserver.contoso.com ScopeId 10.10.10.0,20.20.20.0

This example replicates the configuration of the scopes 10.10.10.0 and 20.20.20.0 to the respective partner computers running the DHCP server services of the failover relationships in which the scopes are included.

Ok so can I schedule this?

No reason why not. but please see note above about replication!

All you need to do is on the “primary” server to:

  1. Run once on each DHCP server the Add-DhcpServerSecurityGroup to create the local security groups and Add the account to the DHCP Administrators Security Group you want to use in the scheduled task.
  2. Create a PowerShell file with the command you want
  3. Schedule a task to run that PowerShell file at whatever interval you want
  4. Ensure the task runs with the account mentioned in 1.

Additional Reading

Invoke-DhcpServerv4FailoverReplication

Add-DhcpServerSecurityGroup

Bringing PowerShell to DHCP Server

Bulk load DHCP Reservations using DHCP PowerShell

 

 

7 thoughts on “DHCP 2012 r2 static reservations replication not working

  1. Does the replication also kill the Leased IPs?

    So if the client obtained lease from DHCP-B, but Primary DHCP-A then replicated scope to it, then what happens with this client?

    • In Load balanced mode the two servers share the leases and they know what the other has. When one of the DHCP server goes off line any new leases granted are only granted for an hour (by default) using the MCLT setting. Once the server is back on line, the leases are converted to normal leases. See https://blogs.technet.microsoft.com/teamdhcp/2012/08/06/dhcp-failover-load-balance-mode/ and https://technet.microsoft.com/en-us/library/dn338985.aspx

      If you have two existing servers set up as a split scope then creating a DHCP failover will mean on of the servers will have to have the scope deleted, the other modified to have the full scope, then the failover created. In most cases this would be find, but if you want to transfer over the leases, you would have to use powershell for that to get the existing leases of the old server and create them on the new server

  2. That was a nice answer to a question that was not asked…
    Already existing failover setup (load balance, done from scratch), which works fine.
    But I noticed that a client can get IP from ANY DHCP server, it can get dynamic IP from DHCP-B, but static reservations for this client was created on DHCP-A !

    Does any sync/replication of that info happens by default between servers in failover relationship??

    If manual replication of whole scope is executed (as per above) from DHCP-A –> DHCP-B, then any leases on DHCP-B are gone instantly (right?) from DHCP-B

    So client that obtained IP from DHCP-B suddenly can not renew it (which is neither good or bad, just strange)

    • Eh, you had reservation for the client only on the other DHCP server? Doesn’t that already answer your question. Your setup was inconsistent.

      As answered, the lease data is shared between the servers, and when you use replication the configuration will be the same on both servers.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.