Skip to content

How objects map

The plugin has one model for each Windows DHCP concept, under the Windows DHCP menu. Every DHCP object belongs to a Windows server, directly or through its scope, and keeps the name it has on Windows. Scopes and reservations point at core NetBox objects (prefix, IP range, IP address, MAC address), so DHCP addresses show up in IPAM like any other.

Summary

On Windows Plugin model Core NetBox objects it points at
DHCP server Windows server (name, connection settings, optional device or virtual machine)
IPv4 scope Scope Prefix (scope ID and mask), IP Range (start and end)
DHCPv6 scope Scope Prefix (a /64)
Superscope Superscope
Exclusion range Exclusion range (on a scope)
IPv4 reservation Reservation IP Address, MAC Address (or a client ID)
DHCPv6 reservation Reservation (DUID and IAID) IP Address
User or vendor class Class
Option definition (one the server adds, or of a vendor class) Option definition
Option value (server, scope or reservation; for a user class, vendor class or policy) Option value
Policy Policy
Failover relationship Failover relationship
MAC filter MAC filter
Allow and deny list switches MAC filter lists
Lease not stored read live on the scope's Leases tab

An import creates the core objects, or reuses the ones it finds, in the Windows server's import VRF (global when empty): the Prefix of each scope, the IP Range of each IPv4 scope, the IP Address of each reservation and the MAC Address of each IPv4 reservation identified by one. Failover partners share one IP range per scope this way. When a scope's prefix sits in another VRF (a scope made by hand, or an import VRF changed later), its first IP range and its reservations' IP addresses follow the prefix's VRF. A prefix, IP range, IP address or MAC address that a scope or reservation points at cannot be deleted while it does: deleting a device, virtual machine or interface that holds such an address is refused until the reservation is deleted or the address unassigned.

Parent edits must keep their existing children valid. A referenced class cannot change server, address family or class type while its definitions or values would become inconsistent; the same rule applies to a policy's server or scope and a superscope's server. Pointing a scope at another prefix is refused unless the new prefix still contains its reservations, exclusions and policy ranges and keeps the address family its options and other dependencies need. Changing the prefix itself, an IP range's start or end, an IP address or a MAC address needs change on the scopes or reservations that use it (see IPAM edits), but its children are not checked against it: a range or reservation that ends up outside its scope's prefix is left out of the next push, with a reason, until NetBox is fixed (see Limitations).

Names

Objects keep their Windows names. A scope's or a reservation's name is its Windows name, and its description is the Windows description. Two Windows servers can both have a scope called "LAN": names only need to be unique where Windows wants that too: classes per server and family (compared without case), superscopes per server, policies per level (the server or one scope), failover relationships per primary server. Windows compares these names without case, so two that differ only in case are one Windows object: a push refuses them and an import proposes deleting the extra copy (see Windows keys). Wherever another object names a scope (the scope column of reservation and option value lists, selectors), a scope with a prefix shows as <server>/<scope id>, for example dhcp01/10.1.0.0, so scopes of different servers are easy to tell apart. The Scopes list shows its name, server and prefix. Scope and reservation names retain all 255 characters supported by their model fields; they are not shortened to the 200-character limit used by some description fields.

Scopes (IPv4)

Windows Scope field
Scope ID and subnet mask Prefix
Start and end of the range IP range (inside the prefix)
Name, description Name, description
Lease duration Lease duration (seconds). Empty keeps the Windows value
State (Active, Inactive) State
Type (DHCP, BOOTP, Both) Type
Delay, max BOOTP clients, activate policies Offer delay (ms), max BOOTP clients, activate policies. "No BOOTP limit" (4294967295 on Windows) is empty in NetBox
Superscope Superscope
Option 3, 6, 15 ... Option values on the scope

A server has one scope per prefix. A new scope defaults to active, type DHCP, no delay, policies on.

A scope cannot move to another server while that would leave its option values, policies or failover memberships pointing at the old server. Remove or relocate those dependencies explicitly before moving the scope; they are never silently discarded or reassigned to similarly named classes on the destination.

Options 1 (subnet mask) and 51 (lease time) are never option values in NetBox: the prefix and the lease duration hold them. An option value with one of those codes is reported and not pushed.

A subnet mask cannot be changed in place on Windows (only by removing the scope with everything in it), so a push refuses a changed prefix length.

Superscopes

A Superscope belongs to a server and has the Windows superscope name. Member scopes name it in their Superscope field. On Windows, removing a superscope keeps its scopes, and so does deleting one in NetBox: its scopes simply leave it. Windows has no DHCPv6 superscopes.

Exclusion ranges

An Exclusion range belongs to a scope, with a start and an end address inside the scope's prefix. Windows has no way to change one, so a changed range is pushed as a remove and an add.

Reservations (IPv4)

Windows Reservation field
IP address IP address (an IPAM IP address inside the scope's prefix)
Client ID MAC address (an IPAM MAC address), or client ID when the client is identified by something else: hex bytes, stored as aa-bb-cc whatever separators were typed
Name, description Name, description
Type (DHCP, BOOTP, Both) Type (Both by default)

A scope has one reservation per IP address. A reservation without a name gets its IP address as its name, as Windows does. See Reservations for a walkthrough.

A reservation with option values cannot move to another scope until those values are removed (an option value on a reservation always belongs to that reservation's scope). This keeps the values' stored scope and server consistent with the reservation.

Option definitions and values

An Option definition belongs to a server and an address family, and optionally to a vendor class. It holds the code, name, exact Windows type (Byte, Word, DWord, DWordDWord, IPv4Address, String, BinaryData, EncapsulatedData, ...), the multi-valued flag and the default value. Windows' own definitions of the standard options (codes RFC 2132 and its successors assign) are not imported: Windows ships them, and a push never touches them. The type is compared without case and stored in Windows' spelling (string is saved as String). The type and the array flag of a definition cannot be changed in place on Windows, so a push refuses those changes.

Option-definition descriptions are stored in full; they are not subject to the 200-character limit used by some other models' description fields.

An Option value belongs to a server and an address family, and is set on the server, a scope or a reservation (its level): leave scope and reservation empty for a server value, set a scope for a scope value, set a reservation for a reservation value (its scope is filled in from the reservation). It names the option by its code, so standard options need no definition in NetBox; the plugin knows their names (3 routers, 6 domain-name-servers, 15 domain-name, ...) and shows them next to the code. A value can be restricted, as Windows allows, to:

  • a vendor class, for an option that vendor class defines;
  • a user class: only clients of that class get the value;
  • a policy: only clients matching the policy get the value (IPv4 only; not on reservations, and not together with a user class).

The value is a list of strings, one per Windows value, for example ["10.1.0.1"] or ["10.1.0.53", "10.1.0.54"]. Commas and leading or trailing spaces inside a value are kept as they are. Numbers compare equal in hex and decimal (0x1 and 1) only for numeric option types; string and binary values compare exactly, including numeric-looking strings such as "0010". A server holds one value per level, code, class and policy.

When NetBox manages a value without holding its custom or vendor definition, a push uses the definition read from Windows for comparison and fingerprints. An explicitly declared string or binary type is never inferred to be numeric from the value's contents.

Classes

A Class holds the class name, type (user or vendor), the ASCII data the client sends, and the address family (IPv4 or IPv6). Names compare without case, as on Windows. A vendor class's own options are option definitions and option values with that vendor class set: Windows ships several vendor classes that define the same codes, and their option codes 1 and 51 are ordinary vendor options, not the mask and lease time.

Policies

A Policy is server level (no scope) or scope level (a scope). It holds:

  • the processing order, enabled flag and description;
  • the condition (AND or OR) and the criteria, as JSON by kind: vendor_class, user_class, mac_address, client_id, relay_agent, circuit_id, remote_id, subscriber_id, fqdn. Each is a list starting with the operator, for example {"vendor_class": ["EQ", "MSFT"], "mac_address": ["EQ", "00-15-5d*"]};
  • the lease duration (seconds; empty keeps the Windows value);
  • for scope policies, the IP ranges, for example [["10.1.0.10", "10.1.0.50"]]: pairs of IPv4 addresses, as strings, inside the policy's scope. Anything else is refused on save.

Option values set for a policy name it in their Policy field, at the same level as the policy (a scope policy's values on its scope, a server policy's values on the server).

Windows takes a wildcard only at the start or the end of a condition value: *.example.com and 00-15-5d* are fine, host*.example.com is refused. A policy with an FQDN condition cannot hold IP ranges or ordinary option values on Windows (errors DHCP 20135 and 20136); use a MAC address or class condition for those.

Windows stores some criteria in its own spelling: a MAC prefix gets a separator before the wildcard (02-4e-42-ab* reads back 02-4e-42-ab-*, hex digits compared without case) and a host name (fqdn) is lowercased. The sync compares criteria the way Windows stores them, so either spelling in NetBox is no change. Other criteria (classes, client ID, relay agent fields) compare exactly.

Write a MAC condition as two hex digits per byte, with dashes or no separator: 02-4e-42-ab-cd-ef, or 02-4e-42-* for a prefix (at most 5 bytes). Windows refuses colons, dots and spaces, and needs all 12 digits without a wildcard (it ignores how dashes group them). For a prefix it ignores the dashes and pads an odd number of digits with a zero on the left, so 02-4e-42-a* would match 00-24-e4-2a-* and 02-4-42-* would match 00-24-42-*: other devices than the ones meant. Only a one-digit first group comes out as meant (2-4e-42-ab* is stored as 02-4e-42-ab-*). NetBox refuses the other spellings when a policy's conditions are saved (not while a branch merge or revert replays them), and a push names a policy that still holds one (saved by an earlier version, a branch, or a script) as not pushed until it is fixed; meanwhile the deletes of its part of the configuration wait, as for any policy that cannot be pushed.

A policy without criteria is not pushed (Windows requires at least one), nor are two policies with the same processing order at the same level. Windows numbers the policies of a level 1, 2, 3... without gaps, so give them consecutive processing orders: a push creates them in that order, and refuses a number past the end of the list. After deleting a policy, renumber the ones after it: until then the push leaves that level alone (see Push). Windows cannot clear a condition with an update, so a push refuses a removed condition; remove it on Windows and import.

Failover relationships

See Failover.

MAC filters

A MAC filter is a MAC address or pattern (00-15-5d-01-02-03, 00-15-5d-*) on the allow or deny list of a server. MAC filter lists holds the two switches that turn the lists on. The switches are only pushed when NetBox holds a MAC filter lists object for the server; delete it to stop managing them.

Windows keys

Each object has a Windows key, its identity on the server. Keys appear in sync runs, proposal items and sync state. Windows names are not case sensitive, so keys use lowercase.

Kind Example key
class user/printers, vendor/msft 5.0
optiondef 252, msft 5.0/1 (a vendor class definition)
scope 10.1.0.0
superscope campus
exclusion 10.1.0.0/10.1.0.200-10.1.0.254
reservation 10.1.0.0/10.1.0.20
policy server/printers, 10.1.0.0/printers
option server/6, 10.1.0.0/3, 10.1.0.0/10.1.0.20/12, ...;vendor=msft 5.0, ...;user=printers, ...;policy=printers
failover ha
macfilter 00-15-5d-01-02-03
filterlists server
class6, scope6, reservation6, option6 v6/user/lab, v6/2001:db8:1::, v6/2001:db8:1::/2001:db8:1::10, v6/server/23

When NetBox holds more than one object for one Windows object (two copies of a class that differ only in case, say), the extra ones get a #<id> suffix; an import proposes deleting them, and a push refuses them.