mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-19 00:58:48 +02:00
ipv6-update: support host addresses in address-list
This commit is contained in:
parent
a34d5d7141
commit
62707dc549
4 changed files with 22 additions and 5 deletions
|
@ -11,7 +11,7 @@ Description
|
||||||
|
|
||||||
With changing IPv6 prefix from ISP this script handles to update...
|
With changing IPv6 prefix from ISP this script handles to update...
|
||||||
|
|
||||||
* ipv6 firewall address-list
|
* ipv6 firewall address-list (prefixes (`/64`) and host addresses (`/128`))
|
||||||
* dns records
|
* dns records
|
||||||
|
|
||||||
Requirements and installation
|
Requirements and installation
|
||||||
|
@ -52,6 +52,11 @@ has to be associated to an interface in comment:
|
||||||
|
|
||||||
/ipv6/firewall/address-list/add address=2003:cf:2f0f:de01::/64 comment="ipv6-pool-isp, interface=br-local" list=local;
|
/ipv6/firewall/address-list/add address=2003:cf:2f0f:de01::/64 comment="ipv6-pool-isp, interface=br-local" list=local;
|
||||||
|
|
||||||
|
Updating address list entries with host addresses works as well, the new
|
||||||
|
prefix is combinded with given suffix then:
|
||||||
|
|
||||||
|
/ipv6/firewall/address-list/add address=2003:cf:2f0f:de01:e3e0:f8fa:8cd6:dbe1/128 comment="ipv6-pool-isp, interface=br-local" list=hosts;
|
||||||
|
|
||||||
Static DNS records need a special comment to be updated. Again it has to
|
Static DNS records need a special comment to be updated. Again it has to
|
||||||
start with "`ipv6-pool-`" and actual pool name, followed by a comma,
|
start with "`ipv6-pool-`" and actual pool name, followed by a comma,
|
||||||
"`interface=`" and the name of interface this address is connected to:
|
"`interface=`" and the name of interface this address is connected to:
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
91="Dropped check for CAP in 'check-routeros-update' to solve issues with wifiwave2 package.";
|
91="Dropped check for CAP in 'check-routeros-update' to solve issues with wifiwave2 package.";
|
||||||
92="Made qr-code url configurable for 'daily-psk'.";
|
92="Made qr-code url configurable for 'daily-psk'.";
|
||||||
93="Added support to backup global-config-overlay in 'backup-email' and 'backup-upload'.";
|
93="Added support to backup global-config-overlay in 'backup-email' and 'backup-upload'.";
|
||||||
|
94="Added support for host addresses in address-list for 'ipv6-update'.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Migration steps to be applied on script updates
|
# Migration steps to be applied on script updates
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
:local 0 "global-functions";
|
:local 0 "global-functions";
|
||||||
|
|
||||||
# expected configuration version
|
# expected configuration version
|
||||||
:global ExpectedConfigVersion 93;
|
:global ExpectedConfigVersion 94;
|
||||||
|
|
||||||
# global variables not to be changed by user
|
# global variables not to be changed by user
|
||||||
:global GlobalFunctionsReady false;
|
:global GlobalFunctionsReady false;
|
||||||
|
|
11
ipv6-update
11
ipv6-update
|
@ -41,11 +41,22 @@
|
||||||
:local Prefix [ /ipv6/address/find where from-pool=$Pool interface=($Comment->"interface") global ];
|
:local Prefix [ /ipv6/address/find where from-pool=$Pool interface=($Comment->"interface") global ];
|
||||||
:if ([ :len $Prefix ] = 1) do={
|
:if ([ :len $Prefix ] = 1) do={
|
||||||
:set Prefix [ /ipv6/address/get $Prefix address ];
|
:set Prefix [ /ipv6/address/get $Prefix address ];
|
||||||
|
|
||||||
|
:if ([ :typeof [ :find ($ListEntryVal->"address") "/128" ] ] = "num" ) do={
|
||||||
|
:set Prefix ([ :toip6 [ :pick $Prefix 0 [ :find $Prefix "/64" ] ] ] & ffff:ffff:ffff:ffff::);
|
||||||
|
:local Address ($ListEntryVal->"address");
|
||||||
|
:local Address ($Prefix | ([ :toip6 [ :pick $Address 0 [ :find $Address "/128" ] ] ] & ::ffff:ffff:ffff:ffff));
|
||||||
|
|
||||||
|
$LogPrintExit2 info $0 ("Updating IPv6 address list with new IPv6 host address " . $Address . \
|
||||||
|
" from interface " . ($Comment->"interface")) false;
|
||||||
|
/ipv6/firewall/address-list/set address=$Address $ListEntry;
|
||||||
|
} else={
|
||||||
$LogPrintExit2 info $0 ("Updating IPv6 address list with new IPv6 prefix " . $Prefix . \
|
$LogPrintExit2 info $0 ("Updating IPv6 address list with new IPv6 prefix " . $Prefix . \
|
||||||
" from interface " . ($Comment->"interface")) false;
|
" from interface " . ($Comment->"interface")) false;
|
||||||
/ipv6/firewall/address-list/set address=$Prefix $ListEntry;
|
/ipv6/firewall/address-list/set address=$Prefix $ListEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:foreach Record in=[ /ip/dns/static/find where comment~("^ipv6-pool-" . $Pool . ",") ] do={
|
:foreach Record in=[ /ip/dns/static/find where comment~("^ipv6-pool-" . $Pool . ",") ] do={
|
||||||
:local RecordVal [ /ip/dns/static/get $Record ];
|
:local RecordVal [ /ip/dns/static/get $Record ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue