Skip to content
← All work
PHPpfSenseFreeBSD

pfsense-ipv6-prefix-updater

Keeps the IPv6 addresses saved in pfSense on your current prefix when your ISP hands out a new one.

The problem

Plenty of ISPs delegate an IPv6 prefix that can change without warning. pfSense keeps addresses built from that prefix in aliases, static interfaces, virtual IPs, VPN settings, firewall rules and more, and when the prefix changes they all go stale at once. Services break in ways that are hard to trace back to one routine ISP change.

What I built

IPv6 Prefix Updater for pfSense, a native package that watches the interfaces you choose. When the prefix changes, it rewrites the matching addresses in the fields you select and keeps each address's host portion, so every device keeps its suffix. A Fields tab lists every address inside your prefix with a switch per group, and things like remote VPN networks, gateways and routes stay off until you tick them.

How it works

It's PHP running on pfSense's own schedule, with no Cron package or root script. Each check compares the interface's global address with the last successful prefix and stops if nothing changed. On a change it builds a plan, saves a configuration backup, writes everything in one save, reloads only the services it touched, checks the values again, and sends a pfSense notification. Dry runs show the exact old and new address of each field first.

The outcome

A package that installs from its release, speaks all 18 pfSense languages, and turns a prefix change into one backed-up write with a clear record on the Status tab.

This started in January 2024 as update.php, a script you installed into the root home folder and ran from a Cron package entry with an interface name and a prefix length. It cached the last prefix, backed up config.xml, swapped the old prefix for the new one across aliases, static IPs and VPN addresses, and sent a notification. It worked, but installing and upgrading it was fragile.

Version 2.0 in November 2026 made it a real pfSense package. It has a settings page instead of Cron entries, several monitored interfaces checked in one run, a Backups tab, an Accept Current Prefix button, and updates for DHCPv6, router advertisements, DNS host overrides, firewall rules, NAT and NPt. Installing it over the old script picks up the saved prefixes and Cron entries and cleans up the leftovers.

The rule I held onto is targeted changes, not search-and-replace. It only touches fields it understands, and anything pfSense generates itself, like DHCPv6 or Track Interface addresses, is left alone.