mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-04-16 18:19:36 +00:00
66 lines
2.9 KiB
Markdown
66 lines
2.9 KiB
Markdown
|
|
Run other scripts on IPv6 DHCP client lease
|
|||
|
|
===========================================
|
|||
|
|
|
|||
|
|
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
|||
|
|
[](https://github.com/eworm-de/routeros-scripts/network)
|
|||
|
|
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
|||
|
|
[](https://mikrotik.com/download/changelogs/)
|
|||
|
|
[](https://t.me/routeros_scripts)
|
|||
|
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
|||
|
|
|
|||
|
|
[⬅️ Go back to main README](../README.md)
|
|||
|
|
|
|||
|
|
> ℹ️ **Info**: This script can not be used on its own but requires the base
|
|||
|
|
> installation. See [main README](../README.md) 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:
|
|||
|
|
|
|||
|
|
* [ipv6-update](ipv6-update.md)
|
|||
|
|
|
|||
|
|
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
|
|||
|
|
--------
|
|||
|
|
|
|||
|
|
* [Update configuration on IPv6 prefix change](ipv6-update.md)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
[⬅️ Go back to main README](../README.md)
|
|||
|
|
[⬆️ Go back to top](#top)
|