Sometimes my ISP changes the WAN IP address and I'd like to track it. I have Dynamic DNS so the fact that the WAN IP changes has no impact, but still.
To solve it, I need :
- a script to update the WAN IP in a tracking file
- a new cron command available under OPNsense GUI
- Create script in
/usr/local/custom-scripts
(or where you want) :vi /usr/local/custom-scripts/track-public-ip.sh
- Add the content of the according file below (don't forget to change variables)
- Set permissions
chmod 700 /usr/local/custom-scripts/track-public-ip.sh
- Create a
.conf
file in/usr/local/opnsense/service/conf/actions.d/
(your file must start withactions_
) :vi /usr/local/opnsense/service/conf/actions.d/actions_track-wan-ip.conf
- Add the content of the according file below
- Restart and reload :
configctl reload : action must be the filename without the prefix "actions_"
service configd restart configctl track-wan-ip update-ip
- Go to
System
>Settings
>Cron
and add a Job - You can select your cron command in dropdown
Command
. It will show "Track WAN IP address and update a file in the root folder" since this is the content of themessage
variable in the rc file. - Plan your cron as like as you want.