[MikroTik] / WAN側がDHCPv6の環境で各LANに任意のSLA IDを使用する

Prefixは/48で貰い、各LANに/64で割り当てる想定。

IPv6のアドレスに識別用のコメントを仕込んでおく。

/ipv6 address
add address=::1 comment=dhcpv6-home interface=vlan-home
add address=::1 comment=dhcpv6-work interface=vlan-work

DHCPv6 ClientのScriptに、下記のようなスクリプトを書く。

:if ($"pd-valid"=1) do={
  :local prefix [:pick $"pd-prefix" 0 [:find $"pd-prefix" "::/48" -1]];
  /ipv6 address set [find where comment="dhcpv6-home"] address=($prefix . ":xxxx::1/64") disabled=no;
  /ipv6 address set [find where comment="dhcpv6-work"] address=($prefix . ":yyyy::1/64") disabled=no;
} else={
  /ipv6 address set [find where comment="dhcpv6-home"] disabled=yes;
  /ipv6 address set [find where comment="dhcpv6-work"] disabled=yes; 
}

以上

この記事が気に入ったらサポートをしてみませんか?