{"id":204,"date":"2013-04-11T10:00:33","date_gmt":"2013-04-11T16:00:33","guid":{"rendered":"http:\/\/www.ipcalypse.ca\/?p=204"},"modified":"2013-05-08T13:32:42","modified_gmt":"2013-05-08T19:32:42","slug":"enabling-a-dhcpv6-client-with-prefix-delegation-ability-on-ubuntu-server","status":"publish","type":"post","link":"https:\/\/www.ipcalypse.ca\/?p=204","title":{"rendered":"Enabling a DHCPv6 client with Prefix Delegation ability on Ubuntu Server"},"content":{"rendered":"<p><strong>What is Prefix Delegation?<\/strong><br \/>\nPrefix Delegation (PD) is a mechanism for a DHCPv6 server to let a home networking router ask for an IPv6 prefix (subnet) that the router can then split up and delegate to the clients it serves.<\/p>\n<p><strong>Why?<\/strong><br \/>\nIn the (hopefully) not too distant future, ISPs will be offering native IPv6. Since there is no NAT in IPv6, and most people have at least a couple of computers sitting behind a hardware NAT box, they will need to get IPv6 addresses for every device they have. This is done via DHCPv6 and PD. When your ISP is ready (if it isn\u2019t already) you\u2019ll be able to use this to participate in the IPv6 world!<\/p>\n<p><strong>How?<\/strong><br \/>\nLet\u2019s just dig in then!<br \/>\nRequired software:<\/p>\n<ul>\n<li>wide-dhcp6c<\/li>\n<li>RADVD<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Why wide-dhcp6c, instead of ISC\u2019s dhclient with IPv6 options?<\/p>\n<ol>\n<li>IPv6 documentation on dhclient is lacking and almost non-existant.<\/li>\n<li>wide-dhcp6c has the ability to assign a block from the received PD block to an interface.<\/li>\n<li>ISC requires you to run a separate instance for v6 anyway.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>For this example network:<br \/>\neth0 = WAN (ISP facing) interface<br \/>\neth1 = LAN (home network) interface<\/p>\n<p>in \/etc\/sysctl.conf add\/set:<\/p>\n<blockquote><p>net.ipv6.conf.all.forwarding = 1<br \/>\nnet.ipv6.conf.eth0.accept_ra=2<\/p><\/blockquote>\n<p>This makes the server a router (forwarding = 1) and allows eth0 to continue accepting Router Advertisements to get it\u2019s default route. (by default, it will no longer accept Router Advertisements when forwarding is set.)<\/p>\n<p>in \/etc\/network\/interfaces add\/set:<\/p>\n<blockquote><p>iface eth0 inet6 static<\/p><\/blockquote>\n<p>We set it to static because we will not be using the ISC DHCP client to obtain our IPv6 address and prefix, we will be using the wide dhcpv6 client.<\/p>\n<p>To install the wide dhcpv6 client run this on the command line:<\/p>\n<blockquote><p>sudo apt-get install wide-dhcpv6-client<\/p><\/blockquote>\n<p>On install, you will get a prompt like this:<br \/>\n<a href=\"https:\/\/www.ipcalypse.ca\/wp-content\/uploads\/2013\/04\/widedhcpv6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-208\" alt=\"click to embiggen!\" src=\"https:\/\/www.ipcalypse.ca\/wp-content\/uploads\/2013\/04\/widedhcpv6-300x170.png\" width=\"300\" height=\"170\" srcset=\"https:\/\/www.ipcalypse.ca\/wp-content\/uploads\/2013\/04\/widedhcpv6-300x170.png 300w, https:\/\/www.ipcalypse.ca\/wp-content\/uploads\/2013\/04\/widedhcpv6.png 794w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nEnter the WAN interface (eth0 in our case)<\/p>\n<p>Configure wide dhcp6c<\/p>\n<blockquote><p>cd \/etc\/wide-dhcp6c<br \/>\nsudo nano dhcp6c.conf<\/p><\/blockquote>\n<p>make it look like:<\/p>\n<blockquote>\n<pre>interface eth0 { # external facing interface (WAN)\r\n  send ia-na 1;\r\n  send ia-pd 1;\r\n  request domain-name-servers;\r\n  request domain-name;\r\n  script \"\/etc\/wide-dhcpv6\/dhcp6c-script\";\r\n};\r\n\r\nid-assoc pd 1 {\r\n  prefix-interface eth1 { #internal facing interface (LAN)\r\n    sla-id 0; # subnet. Combined with ia-pd to configure the subnet for this interface.\r\n    ifid 1; #IP address \"postfix\". if not set it will use EUI-64 address of the interface. Combined with SLA-ID'd prefix to create full IP address of interface.\r\n    sla-len 8; # prefix bits assigned. Take the prefix size you're assigned (something like \/48 or \/56) and subtract it from 64. In my case I was being assigned a \/56, so 64-56=8\r\n    };\r\n  };\r\n\r\n  id-assoc na 1 {\r\n  # id-assoc for eth1\r\n};<\/pre>\n<\/blockquote>\n<p>Install RADVD<\/p>\n<blockquote><p>sudo apt-get install radvd<\/p><\/blockquote>\n<p>Then change the default start from S20 to S98 and add a 10 second delay (to run *after* wide-DHCPv6 is done, otherwise it can\u2019t pick up the IPv6 prefix that has been assigned)<br \/>\n&#8211; get normal runlevel:<\/p>\n<blockquote><p>\/sbin\/runlevel<br \/>\nN 2<\/p><\/blockquote>\n<p>Go to the runlevel directory:<\/p>\n<blockquote><p>cd \/etc\/rc2.d<\/p><\/blockquote>\n<p>(replace the 2 with the number from previous command)<\/p>\n<blockquote><p>mv S20radvd S98radvd<\/p><\/blockquote>\n<p>Edit S98radvd and add<\/p>\n<blockquote><p>sleep 10<\/p><\/blockquote>\n<p>after the first set of comments.<br \/>\nWe move it to S98 so pretty much everything else is done starting and we\u2019re not delaying anything important by that 10 seconds.<\/p>\n<p>Configure the following in \/etc\/radvd.conf<br \/>\ninterface eth1 # LAN interface<br \/>\n{<br \/>\nAdvManagedFlag off; # no DHCPv6 server here.<br \/>\nAdvOtherConfigFlag off; # not even for options.<br \/>\nAdvSendAdvert on;<br \/>\nAdvDefaultPreference high;<br \/>\nAdvLinkMTU 1280;<br \/>\nprefix ::\/64 #pick one non-link-local prefix assigned to the interface and start advertising it<br \/>\n{<br \/>\nAdvOnLink on;<br \/>\nAdvAutonomous on;<br \/>\n};<br \/>\n};<\/p>\n<p>Restart radvd<br \/>\nsudo \/etc\/init.d\/radvd restart<\/p>\n<p>And if your ISP has a DHCPv6 server running, you should have a happy IPv6 address everywhere.<br \/>\nTo check if things are working:<br \/>\nifconfig eth0<br \/>\nifconfig eth1<br \/>\n(to see if IPv6 addresses are assigned.)<br \/>\nIf you don&#8217;t have an IPv6 address on these interfaces that doesn&#8217;t start with fe80::, then it&#8217;s likely (at this point) that your ISP doesn&#8217;t have IPv6 enabled.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Prefix Delegation? Prefix Delegation (PD) is a mechanism for a DHCPv6 server to let a home networking router ask for an IPv6 prefix (subnet) that the router can then split up and delegate to the clients it serves. Why? In the (hopefully) not too distant future, ISPs will be offering native IPv6. Since [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,7],"tags":[],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-ipv6","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=204"}],"version-history":[{"count":12,"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions"}],"predecessor-version":[{"id":215,"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions\/215"}],"wp:attachment":[{"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ipcalypse.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}