When it comes to deploying IPv6 then just like ye olde traditional IPv4 we've got some choices. Pubic or private addresses, static or dynamic addresses, how to manage subnets and so on. This is the approach I've taken considering the different address types and allocation methods available an my needs. I'm not making any claims this is The Way to do it, but if it helps you to work out what will work best for you then it's been worth writing. I've gained some new insights myself.

IPv6 Address Scheme

Although at first glance IPv6 addresses look to be just bigger versions of IPv4 addresses, there's also a lot of differences especially with the way they're managed. Hopefully this isn't a surprise and you've already thought about this. I'm not going to go into all the details here - there's thousands of pages on this topic available - but as a quick primer to set the scene for what follows I hope this helps if you're venturing into IPv6 for the first time.

Address Structure

An IPv6 address is 128 bits long and it's written notation is different. Instead of the "dotted-quad" of IPv4 of four numbers separated by dots, IPv6 addresses when written out in full are 8 blocks of four hexadecimal digits separated by colon : characters (yes this causes other issues) but with a couple of shortening methods:

  1. Any leading zeros in a block can be ignored, so 2001:0DB8:0BAD:FEEF:0123:0045:000C:00D0 can be written as 2001:db8:bad:feef:123:45:c:d0
  2. Any single string of just zeros can be written as :: so fe80:0000:0000:0000:0023:4567:0000:CDEF can be written as fe80::23:4567:0:cdef

IPv6 addresses are not case sensitive, given they're numbers, but the recommendation is to use lowercase representation for the digits a - f.  (Extra homework: Find the RFC that says this)

There is no subnet mask as such either, but CIDR notation /n is used to indicate how many bits of an address - starting from the left - relate to the routing prefix at a given point. Address allocation is hierarchical and with many blocks reserved for specific uses. For the "real" internet the 2000::/3 block has been released to IANA who have split this into smaller blocks of between /12 down to /23 each for allocation to the regional registries who in turn split their blocks into smaller blocks of /19 down to /32 for the local registries (e.g. ISPs, large organisations) who in turn split into smaller blocks for their users / members / customers who typically receives a /48 down to a /56 but in same cases just a /64.

As a customer you may be able to create subnets for your network depending on the routing prefix (block size) you've been allocated, with each subnet being a /64. The part of the block you control is referred to as the subnet ID. As we've seen from how address blocks are allocated, the routing prefix and subnet ID can vary in length, but together must* total 64 bits - or 16 hexadecimal digits - and the interface ID is also 64 bits. If you get a /48  - which is the recommended allocation to a customer - you can split that into 65535 subnets. If you get a /56 then your subnet ID shrinks to 8 bits or 255 subnets and if you only get a /64 then you get just the one subnet. Ouch.

Routing PrefixSubnet IDInterface ID
48 bits 16 bits 64 bits
2001:0db8:0001 0123 0123:4567:89AB:CDEF

Like many ISPs Brsk are assigning a 48 bit routing prefix to customers, also known as a /48. This means we have the full 16 bits to use for our subnet ID so we have more subnets than we could ever need. And don't forget that with 64 bits for the interface ID then each subnet has enough addresses for 4 billion times the IPv4 internet so we're not running out of addresses.

*When I say must with regard to lengths of routing prefix, subnet ID and Interface ID this isn't entirely true. The routing prefix is fixed by your ISP and you need to configure the WAN interface as they expect. But if you decide internally you're going to use take their 48 bit routing prefix and use 32 bits for subnet ID and 48 bits for Interface ID of your hosts you are of course free to do that. You will break the SLAAC auto-addressing protocol and anything else that assumes Interface ID's are always 64 bits but you have the right to make stupid non-typical decisions to best meet your particular needs.

Address Scopes and Allocations

Another of the big differences is that unlike IPv4 each IPv6 interface is expected to have multiple addresses. Each interface will have at least a link-local unicast address and either a ULA or GUA address (or both!) and quite possibly more than one of each depending on what the interface is being used for.

TypeRangeExampleUsage
Link local unicast fe80::/10 fe80::0123:45FF:89AB:CDEF Internal usage on local subnet only.
Unique Local Addresses (ULA) fd00::/8 fd00:db8::123:4567:89AB:CDEF Internal usage within your site / organsation only
Global Unique Addresses (GUA) 2000::/3 2001:db8::123:4567:89AB:CDEF "Real" internet routable addresses

Interfaces will also be members of multicast groups too but for now we can ignore that as you don't get a specific address as such, but you do need to permit them if you enable firewalls.

Link-local Unicast

Every interface will have a link-local unicast address starting with fe80:: as the routing prefix and no subnet ID (or a subnet ID of zero if you prefer) and an automatically generated interface ID typically based on the MAC address. You can also assign specific addresses too - we'll see an example of this later

A link-local unicast is required for some of the IPv6 protocols such as neighbour discovery (NDP) and DHCPv6 to work so it's effectively mandatory and certainly on Linux, Android and Windows an fe80:: address will typically be shown for all network interfaces unless IPv6 has been explicitly disabled.

This is not something you really have to worry about unless you're setting up a network or messing with IPv6 firewall rules - which we'll look at later. Within a subnet I use certain addresses for specific types of host so were link-local unicast addresses appear in logs and traces it means a lot more effort is needed to work out which host they are.

Unique Local Addresses (ULA)

These have had a convoluted history and there are ongoing arguments about their usage. The intention is to have a block of addresses that you can use internally without having to worry what your ISP allocates to you and unlike the link-local unicast these can also be routed between your internal subnets too. This very similar to the RFC 1918 address ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.

The recommendation from IETF is to use 10 randonly generated digits (or 40 bits) after the fd prefix to give a /48 routing prefix and then a 16 bit subnet ID of your choosing. This means if you ever need to directly link your IPv6 network with another organisation you almost certainly won't not have to renumber unless you've been incredibly unlucky. Needless to say a lot of people ignore this advice and chose a prefix that's simple to type and just hope it'll do. For a personal GeekLab that's probably fine but if doing this for real then cheating like that might bite you later.

Just like the RFC 1918 addresses used in IPv4, the ULA address are not routable across the public internet. While there are address translation techniques such as NAT66 and NPT which can allow a network that only uses ULA to connect to the internet it's fair to say their use is controversial and can cause as many problems as they solve. While the Draytek and Linux routers support ULAs - there's nothing magic in them as such - it's not something I've had a proper play with yet, Maybe if all internal hosts used an HTTPS proxy for getting updates so they'd never have need to connect to the internet it might make more sense for me.

Use Cases
  • Your ISP doesn't support IPv6 and you want to have a play then using ULA addresses is ideal as even if you allocate global addresses later you won't have to renumber your hosts since you can have multiple addresses on each interface.
  • You have hosts that will never need to access the IPv6 internet so you don't need GUA addresses on them.
  • You want to ensure that internal communication will not be affected if
    • you change ISP
    • your ISP ever decides to change your GUA routing prefix
    • your ISP regularly changes your routing prefix as they don't believe in long DHCPv6 lifetimes. Or they're just mean.
    • You're using a failover on your internet link with a different ISP and don't have provider-independent address space. Which means you have one helluva GeekLab setup for sure.

My most likely scenario for using ULA would be if my ISP changed and forced a renumber on me then I might make the effort, but given that I'll still have IPv4 deployed for several years (decades?) yet it's not exactly critical if IPv6 gets interrupted.

The one big problem that I'm seeing is reports that due to the process of selecting which source address to use to reach a target system an IPv4 address will be preferred over a ULA address, which mean if you're using both IPv4 and IPv6 then ULA addresses will never actually get used. I need to do do a bit more reading and some testing to determine if this is still the case or if this is maybe a per-OS things.

Global Unicast Addresses (GUA)

I also think of these as "real IPv6" addresses. These are routable onto the public internet so any two hosts using global unicast addresses should be able to communicate subject to firewall rules. And without having to mess around with NAT either, which is nice.

Unless you can obtain a provider-independent block your global addresses will be partly determined by your ISP and the routing prefix they allocate to you. Hopefully that routing prefix will be a /48 and also either permanently assigned to you or at least on a very long lifetime so that it might as well be permanent. If your routing prefix changes then all your GUA addresses change too which may well cause problems if you use them in firewall rules, static addresses on interfaces, static DNS entries etc as you'll need to update all of those with your new prefix to restore full connectivity.

Use Cases
  • Any host that needs to communicate directly via the IPv6 internet needs a GUA address.
  • You have a sensible ISP and have stable addressing from them
  • You don't have proxies for outbound HTTPS (browsing, updates etc)
  • You quite sensibly want to avoid address translation tools like NAT66 or NPT

Address Allocation

And just as we've seen there's three parts to an IPv6 address and three types of IPv6 address to consider there's also three ways of allocating IPv6 addresses. The Rule of Three is strong here - as in there's three main ways to do this and they can also be combined so a host could have a link-local, static ULA and GUA addresses, ULA and GUA addresses allocated on multiple prefixes allocated via SLAAC plus a DHCPv6 address (ULA or GUA) and with the host also generating temporary addresses via privacy extension for each routing prefix too.

While having multiple IPv4 addresses on a host is considered routine in my day job (we use an address per application instance and can stack several instances on any given host) with IPv6 this can be taken to a whole new level of crazy and with it just considered normal day-to-day use.

Static Allocation

IPv6 addresses can be statically allocated the same way as IPv4 addresses can using NetworkManager or Netplan, which in turn can be manually configured or we can use tools like Ansible to do this.

Static addresses have a number of advantages:

  • Simple to allocate
  • Reliable - no dependence on other components such as DHCP servers
  • Initial allocation can easily be automated
  • Can assign as many link-local unicast, ULA and GUA addresses as needed.
  • Ideal for permanent hosts such as VMs and PCs that pretty much stay in one place

The big drawback to using static addresses is they're static. If you want to change the address allocated to a host then you need to connect to it an perform the reconfiguration and if you're looking to make this change as the result of a change of routing prefix and IPv6 is already disrupted then you've got got a bit of a problem. This can be mitigated by also having alternative addresses such as IPv4, using a link-local address from another local host or as I've had to do when something interesting has happened with IPv4 using the the ESXi console so this is not insurmountable. They're also unsuitable for laptops and mobile devices which could reasonably be expected to connect to different networks on demand and impracticable for short-duration hosts such as experimental VMs or containers.

You also need to manage the address allocation yourself - bad things happen if you have the same address on two different interfaces at the same time. The traditional tool is a simple spreadsheet which is well proven but only really effective if you're meticulous in keeping it up to date.

DHCPv6

The Dynamic Host Configuration Protocol has also sprouted a new version for IPv6 with the imaginative name of DHCPv6. There's also three strands of consideration for this as well.

DHCPv6 for Address Allocation and Options

IPv6 addresses can also be allocated on demand using DHCPv6 in a similar way to IPv4 addresses can be allocated on demand by DHCP. This requires a DHCPv6 server and since I already have DNSmasq deployed to handle this in most subnets and the Vigor router can also handle this for its own subnets this shouldn't be a problem.

The big advantage of DHCPv6 is I can allocate an IPv6 address to any host that needs one just by configuring the range to allocate the address from and optionally setting a specific address for known hosts and even having this automatically registered into DNS. For a simple one-address-per-host config this is ideal, scalable and does everything we need.

But... this doesn't work for Android as Google had decided DHCPv6 is bad and no matter how many organisations point out that it works for them they're not going to do it and I find it a little suspicious that nobody else has either, almost as if they're being blocked from doing so. Apparently the main excuses are effect on battery life and privacy concerns, the latter I find rather comical given the number of ways Google have been found to be spying n their own customers and users..

Another issue with DHCPv6 is it only allocates a single address so if you wanted to allocate a GUA and a ULA address you're out of luck. Pick one or the other to work with DHCPv6

DHCPv6 for Options Only

DHCPv6 can also be used just for supplying configuration options such as NTP server, DNS servers and search paths while hosts use some other method to get an IPv6 address. This is particularly useful with SLAAC autoconfiguration given that untill recently the SLAAC protocol didn't support options and even now only supports a few.

DHCPv6 Prefix Delegation

This is used by ISPs to allocate the routing prefix and you can also use it internally to allocate subnets if needed. Or at least in theory as I've not yet managed to get this working in a test subnet.

Autoconfiguration

So this might be a bit of a cheat only only SLAAC is capable of generating a complete ULA or GUA address by itself, but the other methods are used in creating IPv6 addresses.

Stateless Address Auto-Configuration (SLAAC)

With SLAAC the router announces an address prefix, which has to be a /64. and maybe some options to allow a host to construct its own IPv6 address and join the network. The process is based in ICMPv6 and includes checking the address it has concocted is not in use elsewhere and this can be used with GUA and ULA address prefixes. The router that provides the responses is also set as the default gateway.

By itself SLAAC does not provide any other info so an administrator can also set options to indicate if DHCPv6 should be used to just obtain option settings such as DNS server and search path, NTP servers etc and also if the host should obtain an additional address from DHCPv6 too.

SLAAC is stateless in that no server allocates or controls the node part of the address so it's difficult to use firewall rules to permit or deny access based on the IPv6 address if it's allocated using SLAAC. It's also the only address allocation method supported by Android so this makes network control of Android devices extremely difficult.

There is now an extension for SLAAC called RDNSS which allows the sharing of DNS config information, providing both the router and host support it - there's plenty of older devices still in use where this is lacking so for then you'll be reliant on IPv4 and DHCP to correctly configure them.

EIU-64

This generates a node id from the MAC address and is used in both SLAAC and also for link-local unicast where the network prefix fe80:: is well known. It can't be used by itself to generate an IPv6 address since it ignore the routing prefix.

Privacy Extensions / Temporary Addresses

Like the EIU-64 process these also seek to generate a node ID for use with routing prefix & subnet id obtained via DHCPv6 or SLAAC to create a GUA address but unlike EIU-64 the node iD id random and although the MAC address may be used as part of the generation process the final address does not reveal the MAC or any other hardware identifier. The idea is these addresses are used as source address for outbound connections and prevent the target or any eavesdropper being able to track a device over time or as it moves across different networks based solely on network properties.

This also makes it difficult to create firewall rules for individual hosts IPv6 address if it's going to keep changing, and while there may be concern about being able to track the hardware address there are plenty of other identifiers and device fingerprinting techniques that can be used for tracking devices and their users.

Subnet Plan

Assuming you already have an IPv4 network up and running then you should already know where all your subnets are and how they're connected. While a small GeekLab is not going to put any strain on a router one of the principle behind IPv6 is route aggregation. In allocating you a routing prefix your ISP is enabling all traffic to you to be routed to you just by knowing the prefix, which in turn is based on the prefix allocated to your ISP. You don't have to mess about with routing protocols as it all just works.

It would help at this point to know how big a routing prefix you will get from your ISP. In my case I'm using Brsk and they publish this on their website and we can also check by either doing a quick test using the Draytek or plugging in their own router and seeing what it does. At this point it really doesn't matter what the actual prefix is.

Internally you can allocate whatever subnet ID you like to each network but internal routing will then become your problem. You could have a simple list starting at 0000, or It may help if you continue the same principles with your subnet IDs and if you can arrange your internal networks into a tree structure then with a 16 bit subnet ID you will get four tiers of subnets with 16 child subnets off each parent. Each tier then maps onto a digit (or 4 bits) of your subnet ID. If you only have a /56 then you'd only have two tiers which woujdl work out as only have LAN and SubLAN+1 - unless you want to get a bit crafty and thinking binary rather than hex will give you some clue.

The Draytek router has up to 8 internal LAN interfaces, labelled LAN1 to LAN8. So I will use the first digit / 4 bits of the subnet ID for the LAN and leave the remaining 12 bits for each LAN to decide.

I use LAN1 as backbone to which the internal routers for each GeekLab subnet connects (SubLAN+1 as they're the first level below the Draytek LAN), so the next digit / 4 bits of the subnet ID will be used for those subnets as I doubt I'll have more than 16. Within each of those subnets there's still 2 digits / 8 bits to play with and at most I've only ever split a one of those subnets into two to separate off dedicated application severs so my subnet address plan works out something like this

Routing PrefixSubnet IDUsage
  LAN SubLAN+1 SubLAN+2 SubLAN+3  
 2001:db8:1:0 1       Backbone LAN
1 0   Main
1   Main Applications
2 0   Test
1   Test Applications
3     Sandpit
4     Lab
5     Lab
5       Guest Wifi LAN
7 1 0   IPv6 Lab
1   DHCPv6 PD trial sub
8       Public LAN

Where a SubLAN is entry is blank read that as 0 - I've omitted them for clarity. At the moment SubLAN+3 is not used but the capability exists if needed.

While I could simply number these 1 to 12, this is a bit more structured and hopefully more flexible for any future needs. This would give all my test networks a prefix of 2001:db8:1:1200::/56 so I could have that router just advertise that single prefix rather than both 2001:db8:1:1200/64 and 2001:2b8:1:1210/64 separately. If I was working on something with others it's also only a single rule to allow them access to the entire test network too.  While that's not a big issue on a lab scale, if you have hundreds of internal subnets then being able to aggregate routes is quite useful. It also lets you do things like prefix delegation as well - although I've yet to find the correct combinations of incantations, charms and curses to get the Draytek to play nicely with that.

With some clue about IPv6 addresses and a plan on how we can best deploy IPv6 we can now start configuring.

Address Plan

So with all this theory revisited it's time to confirm what were going to do.

Immediate Goals

My immediate desire is to enable IPv6 for as many devices as possible to enable internet access for them both outbound and inbound.

  1. Deploy IPv6 for outbound internet access for all hosts using static or DHCPv6 in a similar way as is currently done for IPv4 addresses.
  2. Enable inbound IPv6 for public-facing hosts using static addresses to similar to how it is currently done for IPv4 process

Future Intention

Once the immediate need for IPv6 has been satisfied we can then look to refine the deployment. Since these all require additional work to validate and test before deployment can begin these are longer term strategic goals

  1. Generate and deploy ULA addresses for all hosts for internal purposes so we're not dependent on retaining a constant routing prefix. If it makes sense.
  2. Deploy an HTTPS proxy and remove GUA addresses from hosts that don't need internet access. Using a proxy also addresses a few other things as well and has been on my todo list for some time.
  3. Retire IPv4 addresses from hosts that no longer need it.
  4. Find a way to enable SLAAC addresses for Android devices while still being able to subject them to firewall rules and other access controls and identify them - and their users - in logs.

And while retiring IPv4 is the ultimate goal for the evolution of the internet, at the current rate of progress that's not going to happen in my lifetime.

Deployment Plan Update

After working through the process in more detail we can see the original deployment plan in IPv6 Deployment Plans still holds true and is valid. We can now add the following guidance

  • GUA addresses as supplied by ISP routing prefix to be used
  • Hosts with a static IPv4 address will be assigned a static IPv6 address
  • Hosts using DHCP to get an IPv4 address will use DHCPv6 to get an IPv6 address
  • SLAAC will not be enabled at this time

The deployment plan itself does not need an update as this will deliver on both immediate goals. The future intentions will be separate projects to investigate, test and deliver.

While I could break down each of the steps further to reference tasks such as external firewall config, updates to FRRouting, DNSmasq and nftables, this is a GeekLab project and there is a single team consisting of just one person (me!) doing everything and that level of detail is just overkill. It might make a good exercise if you're into project planning or estimating so don't let me stop you.