Skip to content

Instantly share code, notes, and snippets.

@danielamkaer
Created October 2, 2016 07:00
Show Gist options
  • Save danielamkaer/cbe70816ee57da6f7bdaf18478b77cf7 to your computer and use it in GitHub Desktop.
Save danielamkaer/cbe70816ee57da6f7bdaf18478b77cf7 to your computer and use it in GitHub Desktop.
subnet6 2001:db8::/32 {
range6 2001:db8:0:1::129 2001:db8:0:1::254;
# Range for clients requesting a temporary address
range6 2001:db8:0:1::/64 temporary;
# Additional options
option dhcp6.name-servers fec0:0:0:1::1;
option dhcp6.domain-search "domain.example";
# Prefix range for delegation to sub-routers
prefix6 2001:db8:0:100:: 2001:db8:0:f00:: /56;
on commit {
if exists dhcp6.ia-na and exists dhcp6.ia-pd {
set route-pdexists = "yes";
set route-iana = binary-to-ascii(16,16,":",substring(suffix(option dhcp6.ia-na,24),0,16));
set route-iapd = binary-to-ascii(16,16,":", suffix(option dhcp6.ia-pd,16));
set route-pdsize = binary-to-ascii(10,8,":",substring(suffix(option dhcp6.ia-pd,17),0,1));
set route-pdnet = concat(route-iapd, "/", route-pdsize);
execute("/sbin/ip", "-6", "route", "add", route-pdnet, "via", route-iana);
}
}
on release {
if route-pdexists = "yes" {
execute("/sbin/ip", "-6", "route", "delete", route-pdnet, "via", route-iana);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment