routeros-scripts-main/doc/dhcpv6-client-lease.md
2026-04-15 10:46:35 +02:00

2.9 KiB
Raw Blame History

Run other scripts on IPv6 DHCP client lease

GitHub stars GitHub forks GitHub watchers required RouterOS version Telegram group @routeros_scripts donate with PayPal

⬅️ Go back to main README

Info: This script can not be used on its own but requires the base installation. See main README for details.

Description

This script is supposed to run from IPv6 DHCP client as lease script. On a DHCP leasse it runs each script containing the following line, where ## is a decimal number for ordering:

# provides: dhcpv6-client-lease, order=##

The lease script is started with some variables injected, but these are not available in child scripts. However this script makes these variables available with a global variable. This code is required in child script:

:global EitherOr;

:global DHCPv6ClientLeaseVars;

:local NaAddress [ $EitherOr $"na-address" ($DHCPv6ClientLeaseVars->"na-address") ];
:local NaValid [ $EitherOr $"na-valid" ($DHCPv6ClientLeaseVars->"na-valid") ];
:local PdPrefix [ $EitherOr $"pd-prefix" ($DHCPv6ClientLeaseVars->"pd-prefix") ];
:local PdValid [ $EitherOr $"pd-valid" ($DHCPv6ClientLeaseVars->"pd-valid") ];
:local Options [ $EitherOr $"options" ($DHCPv6ClientLeaseVars->"options") ];

The values are available under different name then, use $PdPrefix instead of $"pd-prefix", and so on. The resulting script supports both, being a lease script itself or being run as child.

Currently it runs if available, in order:

Requirements and installation

Just install the script:

$ScriptInstallUpdate dhcpv6-client-lease;

... and add it as lease-script to your dhcp client:

/ipv6/dhcp-client/set lease-script="dhcpv6-client-lease" [ find ];

See also


⬅️ Go back to main README
⬆️ Go back to top