Skip to content

mrjackyliang/pfsense-ipv6-prefix-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pfSense® Dynamic IPv6 Prefix Updater

GitHub Releases GitHub Top Languages GitHub License Become a GitHub Sponsor Donate via PayPal

This script is specifically crafted to run on pfSense® environments to help automatically update the configuration when your Internet Service Provider (ISP) changes your dynamic IPv6 prefix.

It assists in automatically updating global IPv6 addresses saved in firewall aliases, static IPs, and virtual addresses used in IPsec, OpenVPN, and WireGuard configurations.

To use this updater, here are three simple steps you need to follow:

  1. Download the Cron package from Package Manager.
  2. Choose an interface, and configure your system with the given global IPv6 address.
  3. Download the updater by following the setup instructions.

Setup Instructions

To download this updater, first login to pfSense® > Diagnostics > Command Prompt. Copy the provided command and then click the Execute button.

cd /root && fetch -o pfsense-ipv6-prefix-updater-install.sh https://raw.githubusercontent.com/mrjackyliang/pfsense-ipv6-prefix-updater/main/install.sh && sh pfsense-ipv6-prefix-updater-install.sh

Note: The script runs as root and will reside in the /root folder.

Setup Cron Scheduling

After downloading the script, go to Services > Cron > Add tab. Fill in the properties shown below (after determining the cron schedule, interface name, and prefix length) then click the Save button.

  • Minute: *
  • Hour: *
  • Day of the Month: *
  • Month of the Year: *
  • Day of the Week: *
  • User: root
  • Command: php /root/pfsense-ipv6-prefix-updater/update.php [INTERFACE NAME] [PREFIX LENGTH]

Note: DO NOT use wan for the INTERFACE NAME since that 100% a /128 address. The PREFIX LENGTH will be defined by your Internet Service Provider (ISP) and should be between 48 and 64.

Note 2: To calculate the cron schedule expression, visit the crontab guru website.

Note 3: When monitoring multiple interfaces, ensure that you run them at distinct time intervals, as only one instance is permitted to run simultaneously.

WireGuard Peer Configurations

Even though the script can streamline the process of updating configurations on your pfSense® system, manual updates to peer configuration files are required due to the design of WireGuard. This is necessary to maintain the proper functioning of IPv6.

If you wish to be notified everytime the prefix is changed, please set up notifications in System > Advanced > Notifications.

Root User Requirement

Typically, it is recommended to avoid running scripts under the root user. However, because of the root:wheel ownership of the configuration file (/conf/config.xml), the script requires execution under this user.

Rest assured, before applying any changes to the configuration file, the script will generate a backup of the config.xml file and store it in the /root/pfsense-ipv6-prefix-updater/backups folder.

Credits and Appreciation

If you find value in the ongoing development of this updater and wish to express your appreciation, you have the option to become my supporter on GitHub Sponsors!