|
本帖最后由 call58 于 2025-5-24 11:08 编辑
关于前缀一段时间就会变动,需要写个脚本刷新才可以的,
IPv6 地址更新脚本
用于当 RouterOS IPv6 更新时,主动向客户端广播旧地址过期
#======
:local poolname "Local-IPv6-Pool"
:local ifname "bridge1"
:global oldprefix;
:local newprefix;
:set newprefix [/ipv6 pool used get [find info=$ifname] prefix];
:if ([ :typeof $oldprefix ] = "nothing") do {
:set $oldprefix $newprefix
}
:if ($newprefix != $oldprefix) do {
:log info "Kill IPv6 prefix, old prefix: $oldprefix, new prefix: $newprefix";
:ipv6 nd prefix add prefix=$oldprefix interface=$ifname on-link=yes autonomous=yes preferred-lifetime=0s valid-lifetime=0s;
:delay 5;
:ipv6 nd prefix remove [/ipv6 nd prefix find prefix=$oldprefix];
:set $oldprefix $newprefix;
}
#======
上面是征对所有设备都有一个IPV6才需要。
但现在用的是ipv6 nat方式,就不需要那个自动更新前缀脚本,
只需要写一个
IPv6 DHCP Rebinding 脚本,3分钟运行一次就好
用于修复当 PPPoE 重新拨号时 IPv6 DHCP 卡在 Rebinding 状态
#========
:local wan "pppoe-telecom"
:if ( [ /ipv6 dhcp-client get [ find interface=$wan ] status ] = "rebinding..." ) do={
/ipv6 dhcp-client release [ find interface=$wan ]
}
#======
|
|