Skip to content

Push to Windows

A push makes one Windows server match NetBox. It is a reconcile, not a replay of the change log: it reads the whole Windows configuration, compares it with what NetBox holds for the server, and creates, updates and deletes what differs, in dependency order. So a push started for one changed reservation also fixes anything else that drifted, within the safety rules.

When a push runs

Setup What queues a push
With netbox-branching Merging or reverting a branch: one push per Windows server the branch touched. Edits made directly in main push as without branching, even while an unrelated branch is being merged or reverted. Edits inside a branch push nothing until it is merged
With change control as well The same; change control only allows a merge once its change request is approved, so a push always follows an approved change
Without branching Every save or delete of a DHCP object: one push per affected server, push_debounce seconds (10) after the change is committed, so a burst of edits becomes one push
Always Sync now on the Windows server page, or the REST action
flowchart LR
    save(["Save or delete in main<br/>(no branching, or a direct edit)"]) --> debounce["Wait for the commit,<br/>then push_debounce (10 s)"]
    merged(["Branch merged<br/>or reverted"]) --> perserver["One push per server<br/>the branch touched"]
    syncnow(["Sync now<br/>or REST action"]) --> enabled
    debounce --> enabled{"Sync enabled<br/>on the server?"}
    perserver --> enabled
    enabled -- "yes" --> job(["Push job"])
    enabled -- "no" --> skip(["Nothing pushed"])

A push job (and a dry run, which stops after planning) then does this:

flowchart TD
    lock{"Server free?"} -- "import or push<br/>running" --> retry["Push: queued again in a minute,<br/>for up to two hours.<br/>Dry run: fails"]
    lock -- "free" --> read["Read the whole<br/>Windows server"]
    read --> plan["Plan: compare with NetBox,<br/>refuse unsafe changes<br/>(not_pushed)"]
    plan -- "dry run" --> report(["Sync run lists planned<br/>and refused changes"])
    plan -- "push" --> write["One change at a time:<br/>deletes first, then creates<br/>and updates, parents first"]
    write --> state["Record what NetBox<br/>manages (sync state)"]
    state --> replicate["Failover primary:<br/>replicate changed scopes<br/>to the partner"]
    replicate --> run(["Sync run: applied,<br/>failed, not pushed"])

Nothing is pushed while Sync enabled is off on the Windows server. Turning it on does not push the changes made in the meantime by itself: run a dry run to see them, then Sync now.

A change affects a server when it touches one of its DHCP objects (scopes, reservations, option values and the rest), or a prefix, IP range, IP address or MAC address one of its scopes or reservations points at. Moving a scope from one server to another pushes both, provided the move does not leave dependent options, policies or failover memberships attached to the wrong server. Unsafe moves are refused rather than silently dropping their configuration. Applying import proposal items does not push.

A push queued while another for the same server is still waiting to start is not queued twice: the waiting one reads the latest NetBox data anyway.

Only the fields Windows receives count for the core objects: editing an IP address's description or a prefix's status directly queues no push (a branch merge still queues one per server it touches). Changing the fields that do count needs the plugin's permission on the scopes or reservations concerned, see Permissions.

Triggered by (see Following a change from NetBox to Windows). Each push's sync run lists what queued it: every edit it carries (user, and a Changes link to the change log entries of that request), a Sync now click, or a branch merge or revert. Edits made while a push is still waiting to start are added to that push, so several people's edits can share one sync run. Edits made once a push has started are listed on the next push, even when the running one already carried them (it reads NetBox after it starts), and a push that fails keeps its list: nothing retries it, so the push that later applies the change (Sync now, or the next edit's push) lists only its own trigger. The same list is in the REST API as the sync run's triggers.

With netbox-branching, edit inside a branch, then merge it (after approval, with change control). The merge queues the push, and its sync run names the branch:

sequenceDiagram
    actor Admin
    participant Branch as Branch
    participant CR as Change request
    actor Reviewer
    participant Main as NetBox main
    participant Worker as Push job
    participant Win as Windows DHCP

    Admin->>Branch: edit scopes, reservations, options
    Note over Branch,Win: nothing is pushed while the change sits in a branch
    Admin->>CR: submit for review
    Reviewer->>CR: approve
    Admin->>Main: merge the branch
    Main-->>Worker: after the merge commits: one push per server touched
    Worker->>Win: read everything
    Worker->>Win: create, update, delete what differs
    Worker-->>Admin: sync run and notification

Here the branch rename-nas renames the reservation app01 to nas01:

Editing reservation 198.18.50.101 inside the branch rename-nas: the branch selector at the top shows the active
branch

Merging the branch rename-nas: one pending update, commit ticked

The push the merge queued: branch rename-nas, one reservation updated

Dry run

Dry run on the Windows server page plans a push without writing anything. Its sync run summary lists the planned changes (planned, with the Windows key and values of each) and the refused ones (not_pushed, with the reason). It works with sync disabled, so it is the way to check a server before turning sync on.

Example: a new scope from NetBox

A Windows scope is a plugin Scope pointing at a prefix and, for IPv4, an IP range, as How objects map describes. To add one to dhcp01:

  1. IPAM: the prefix (198.18.70.0/24) and the IP range the scope hands out (198.18.70.100 to 198.18.70.200). Create them in IPAM first, or from the scope form in the next step: the + button next to the prefix and IP range fields opens NetBox's own form in a pop-up and selects the new object. The pop-up does not know the prefix chosen in the scope form, so type the range's start and end with the prefix's mask; a range outside the prefix is refused when the scope is saved.
  2. Windows DHCP > Scopes > Add: the server, the prefix and the IP range. The name is the Windows scope name (VLAN70-Office), the description its Windows description, and the lease duration (seconds) its lease duration; state, type and the other settings default to what Windows gives a new scope.

    A new scope for dhcp01: name VLAN70-Office, prefix 198.18.70.0/24, IP range 198.18.70.100-200, description,
lease duration 691200 seconds (8 days)

  3. Windows DHCP > Option values > Add for scope options: the server, the scope, the code and the value, for example the router (code 3, value ["198.18.70.1"]: the value is a list).

    A new option value: server dhcp01, IPv4, code 3, value ["198.18.70.1"], set on the scope
dhcp01/198.18.70.0

  4. Windows DHCP > Reservations > Add for reservations: the scope, the IP address and MAC address objects (the + buttons create them in place), and the name, which is the Windows reservation name.

    A new reservation in the scope: IP address 198.18.70.20, name printer02, MAC address
02:4E:42:70:00:20

  5. Windows DHCP > Exclusion ranges > Add for what Windows should not hand out.

    A new exclusion range in the scope: 198.18.70.150 to 198.18.70.159

  6. Dry run on the Windows server shows what the push will create; then Sync now (or, with sync enabled, just wait: each save queues a push).

    The dry run: the scope, the exclusion range, the reservation and two scope options (router and DNS servers)
to create

    The push: completed, the same five changes applied

    If Windows refuses a change, the push applies the others and the sync run names the refused one (see Troubleshooting); fix it in NetBox and the next push sends it.

Order

Creates and updates run parents first: classes, option definitions, scopes, superscopes, exclusion ranges, reservations, policies, option values, failover relationships, MAC filters, list switches (IPv4 and DHCPv6 kinds side by side). Deletes run before them, in the reverse order (children before parents). Changes run one at a time.

Policies are created and updated level by level (the server, then each scope) in ascending processing order, whatever their names. Windows numbers the policies of a level 1, 2, 3... without gaps: it refuses a number past the end (error DHCP 20110, for example order 2 when the scope has no policy yet), and a policy given a number already in use moves the others down. A policy NetBox did not change that an insert moves down (one below a policy created by hand, for example) is set back to its number in the same push, so it shows as a processing order update in the plan.

NetBox does not renumber the other policies when one is deleted, but Windows closes the gap: delete order 1 of three and Windows holds the other two as 1 and 2 while NetBox still says 2 and 3. Order 3 no longer fits, and moving the other policy alone would put it below the third one, so the push leaves every policy at that level as it is (the delete itself still runs) and lists them under Not pushed until you renumber them 1, 2, 3... in NetBox. An import proposes the same renumbering. That Windows closes the gap on a delete, and renumbers on an update the way it does on a create, was checked in the lab (Windows Server 2022).

A reservation update keeps the reservation's option values. Windows Server 2025 was seen dropping them when a description change was sent with the client ID and type (#42), so the push sends the client ID and type (DHCPv6: DUID and IAID) only when they change, and after each reservation update it puts back any of the reservation's option values that went missing. This adds no line to the plan or the dry run. If a value cannot be put back, the reservation update counts as failed and names each option it lost. The next push recreates a lost value only if NetBox holds it. Values NetBox does not hold, such as DHCPv6 vendor class values, option codes the plugin does not sync, or values added on Windows since the last import, never come back by themselves (an import cannot see them either, once Windows has dropped them): put them back by hand. The error says which kind each lost value is.

When a change fails, the push goes on with the others but skips the children of an object it could not create, and keeps the parents of an object it could not delete. The run then ends failed, with one line per error. A lost connection stops the run; the changes not attempted are listed.

Managed objects

A push only deletes Windows objects that NetBox manages. The plugin keeps a record (sync state) of each Windows object it manages, with a fingerprint of its values when it was last pushed (for a policy, everything but its processing order, which Windows changes by itself when another policy is added or removed). An object becomes managed when:

  • a push creates or updates it;
  • a push finds it identical on both sides (it adopts it, which is how objects merged from an import branch become managed);
  • an import proposal item for it is applied.

Objects created by hand on Windows are not managed: a push leaves them alone (they count as unmanaged in the summary), and they come into NetBox with the next import.

This is how a push decides about an object Windows holds and NetBox does not:

flowchart LR
    obj(["On Windows, not in NetBox"]) --> managed{"Recorded as managed<br/>(sync state)?"}
    managed -- "no: made by hand" --> keep(["Left alone, counted as unmanaged<br/>the next import brings it in"])
    managed -- "yes" --> drift{"Changed on Windows<br/>since the last push?"}
    drift -- "yes" --> refuse1(["Not pushed: delete it on Windows<br/>or import it back"])
    drift -- "no" --> children{"Would the delete take<br/>unmanaged objects with it?"}
    children -- "yes" --> refuse2(["Not pushed: those objects<br/>would be lost"])
    children -- "no" --> delete(["Deleted"])

Option fingerprints recorded before type-aware comparison are not trusted for deletion: their old normalization could hide a change to a string value. A push that finds the option identical on both sides, or an accepted import, refreshes its fingerprint. Until then, a deletion is refused rather than assuming the old hash proves no drift.

A scope added to a failover relationship by hand on Windows stays in it on later pushes too, including when a push changes other relationship settings: the push records the relationship as NetBox left it, without that scope. Scopes NetBox put in the relationship can still be taken out next to it. Add the scope to the relationship in NetBox (or import it) to manage it from NetBox. If the relationship's settings were also changed on Windows, the push cannot tell which scopes are NetBox's and keeps every scope; import the relationship to settle it.

What a push will not do

A push never touches Windows objects NetBox does not manage: it leaves them alone and only counts them (unmanaged). Other refusals happen at two moments.

Refused when the push is planned

These show in not_pushed, with the reason, in the dry run as well as the push. The push goes on with the rest and the Windows object is kept as it is. What hangs off a left-out object is left out with it ("waits for scope ..."): the reservations and option values of a left-out scope, the option values of a left-out reservation, a failover relationship holding a left-out scope, and so on.

The delete pause. While anything in a family cannot be pushed, nothing in that family is deleted; the dry run lists what is waiting and why. There are three families: the IPv4 scopes (scopes, superscopes, reservations, exclusion ranges, scope and reservation option values, scope policies with their values and IP ranges, failover relationships), the DHCPv6 scopes (DHCPv6 scopes, reservations and their option values), and the server-level policies with the option values set through them. Classes, option definitions, plain server option values and MAC filters are in none and are deleted as usual. NetBox objects have no identity a push can follow: a scope is known by its network, a reservation by its address, a policy by its name, so a scope whose prefix moved in IPAM, a reservation that changed address or a renamed policy looks like a new object plus a deleted one. When the new one cannot be pushed, deleting the old one would leave nothing on Windows; rather than guess which delete belongs to which refusal, every delete of the family waits. A failover relationship that would lose scopes waits too, since leaving the relationship removes a scope from the partner, and so does a create that could only work once a waiting delete is done (the same client's new reservation in the scope, an exclusion range over the old one's addresses, a renamed failover relationship). Creates and updates that need nothing left out still go ahead. Each waiting change is listed first under not_pushed (and counted in waiting_count) with a reason starting waiting: that names up to three of the objects holding it up. The objects stay managed, so the first push with nothing left out in their family deletes them. A policy refused for its processing order holds deletes back only when it is new on Windows (a new name, or a renamed policy): then a delete may be what it replaces. A policy already on Windows refused for its number holds nothing back, so deleting order 1 of 3 without renumbering the others still deletes it, and the others wait for the renumbering. The job log's last line counts what waits.

Deletes that could lose data:

  • a managed object whose Windows values changed since the last push (someone edited it by hand). Delete it on Windows, or import it back;
  • an object whose removal would take unmanaged objects with it: a scope holding a reservation, policy, vendor class value or option value made by hand on Windows, or anything the plugin does not sync (for example DHCPv6 exclusions).

NetBox data Windows cannot hold:

  • an IPv4 scope whose subnet mask changes (a split or a merge: Windows only allows it by deleting the scope with its reservations, options and leases; do it on Windows by hand, then import), and a new scope that would share addresses with the old scope Windows still has;
  • an IPv4 scope without an IP range, or a DHCPv6 scope whose prefix is not a /64 (NetBox refuses to save one, so this only happens when the prefix length was changed in IPAM afterwards);
  • a reservation without a MAC address or client ID, or a DHCPv6 reservation without an address, a DUID or an IAID;
  • objects that no longer fit their scope, typically after an edit of the prefix, IP range or IP address in IPAM (the plugin's forms refuse these, but IPAM edits do not go through them): an IPv4 scope whose range is outside its prefix, ends before it starts, or holds the network or broadcast address; a scope policy IP range that runs backwards or leaves the scope's prefix; a reservation outside its scope's prefix (an IPv4 reservation outside the scope's IP range but inside the prefix is fine, as on Windows); an exclusion range outside the scope's prefix, or ending before it starts (one reaching past the IP range inside the prefix is fine);
  • two IPv4 scopes of one server sharing addresses (a /23 over a /24), including a scope made on Windows by hand that NetBox does not manage; two exclusion ranges of one scope sharing addresses, even a single one; two reservations of one scope for the same client (MAC address or client ID, compared without separators or case; for DHCPv6 the same DUID and IAID, while another IAID is fine). When one of them is already on Windows as NetBox has it, that one keeps being pushed and only the others are left out;
  • a reservation (new, or given another client) whose client Windows already holds in the scope at another address, under a reservation the push does not delete: one made on Windows outside NetBox, one changed on Windows since the last push, one still holding objects NetBox does not manage, or one whose own change cannot be pushed. The reason names the address and why it stays: import it, or delete it on Windows, and the next push writes the NetBox one. A reservation NetBox made and still manages simply moves (the old one is deleted first), and a client given up by another reservation in the same push is taken once that change is done (when that change waits, so does this one; when it fails at Windows, this one fails too). Two or more reservations swapping clients are all left out, as Windows cannot apply any of them first: change them over two pushes. A reservation left out keeps its other fields as Windows has them until it can be pushed. A new reservation left out this way pauses the deletes of its tree (IPv4 or DHCPv6), like any object that cannot be pushed; an update left out does not;
  • reservations and exclusion ranges of a second NetBox scope on one network address (two prefix lengths, or two VRFs), which Windows cannot hold;
  • a scope policy whose stored IP ranges are not a list of [start, end] IPv4 address pairs (only a raw save can store that: a branch merge, a script, nbshell). The rest of the server is still pushed, and an import proposes Windows' ranges for it;
  • options 1 and 51 (they come from the prefix and the scope's lease duration), values of codes Windows has no definition for, and a definition of a code Windows defines itself;
  • two NetBox objects for one Windows object (two classes or policies whose names differ only in case);
  • a policy without criteria, two policies with the same processing order, a policy whose processing order would leave a gap at its level (order 3 where Windows would only hold two policies, counting those made by hand), the other policies of that level when the policy is already on Windows (see above), or a policy option value whose policy NetBox does not hold at the same level;
  • a policy whose MAC address condition is not written the way Windows reads it (colons or other characters than hex digits and dashes, spaces around it, a full address without 12 digits or with a doubled or end dash, a prefix byte not written as two hex digits (a one-digit first byte followed by a dash is fine), half a byte before the wildcard, a prefix of 6 bytes or more). Saving a policy refuses these, so only a condition saved by an older version or written by a branch merge or a script gets here. The reason says how to write it; fix it in NetBox;
  • a superscope or new failover relationship without scopes, a failover relationship whose partner has no Windows server in NetBox, or a hot standby relationship without the primary server's role;
  • a failover relationship that would take a scope Windows already holds in another relationship NetBox does not manage, or one this push does not let go (a scope is in one relationship at most): import that relationship, or remove the scope from it on Windows. A simple move between two relationships NetBox manages goes through in one push; scopes swapped between relationships are refused (move one scope at a time). If the relationship taking the scope then fails at Windows, the push puts the scope back where it was and says so;
  • a failover relationship whose partner or hot standby role changes: Windows only allows it by deleting the relationship (delete it in NetBox and push, then create it again; see Failover);
  • DHCPv6 vendor classes, and a DHCPv6 option value with a policy (Windows has no DHCPv6 policies).

Refused while pushing

These are only found when the push reaches the change, so a dry run does not show them: it lists them as ordinary planned updates or deletes. The push refuses the change, goes on with the others, and the run ends failed with the reason in its errors.

  • Changes Windows only allows by removing the object with everything in it: an option definition's type or array flag, clearing an option definition's default value, removing a policy condition. Make them on Windows by hand, then import (for a default value: set another one, or delete the definition and create it again). A scope's subnet mask and a failover relationship's partner or hot standby role are refused earlier, when the push is planned (see above).
  • Policy conditions and contents Windows refuses: a wildcard anywhere but at the start or the end of a condition value, and IP ranges (DHCP 20135) or ordinary option values (DHCP 20136) on a policy with an FQDN condition.
  • Creating a failover relationship whose partner is outside the allowed_hosts of the primary server's credential profile: add the partner to that profile (see Configuration).
  • Sending the failover shared secret (creating a relationship with a shared secret profile, or setting one on a relationship whose authentication is off) when the profile holds no secret, its allowed_hosts does not cover both partners, or its other limits refuse the primary server's connection (see Failover). Without a shared secret profile, a push leaves authentication as Windows has it (on or off); to turn it off, do it by hand on Windows.
  • Deleting a scope with active leases: Windows refuses it (error DHCP 20007), and the plugin never forces it. Its managed reservations and values are removed first; the scope itself goes on a later push, once its leases have expired.

A scope range that moves one end out and the other in is set in two calls, since Windows refuses it in one (DHCP 20023): first the addresses both ranges share, then the new range. When the old and new ranges do not overlap at all, the scope covers both for a moment, so exclude any static addresses between them first. If the second call fails, the push tries to put the old range back.

Windows spelling

The push writes values back the way Windows expects them: Active and InActive, durations as d.hh:mm:ss, 4294967295 for "no BOOTP limit", MAC addresses as 00-15-5d-01-02-03. Values left empty in NetBox where Windows always has one (a lease time, DHCPv6 lifetimes) keep the Windows value, so they do not show as a change on every push.

Failover

After pushing to the primary server of a failover relationship, the push replicates the changed scopes to the partner, including the scope of a change inside it that failed after part of it may have reached Windows. A replication that fails is retried by the next push to the primary. A push that stopped early (lost connection, command timeout, unexpected error) does not try to replicate in that run: the scopes wait in replication_pending for the next push. A failed server-level change (a class, an option definition, a MAC filter, a server option) replicates nothing until it is applied, unless the push stopped on it: then all the relationship's scopes wait. A failed failover change triggers no replication. Replication, like the failover writes, goes through the server's Failover authentication when it sets one (see Failover). An existing relationship may be left empty: clearing its last membership keeps the scope on the primary and removes it from the partner, subject to the same ownership and drift protections as other membership removals. See Failover.