IPv6 at Home with Ubuntu

Somewhere around December 2016 I realized that my ISP has changed my router settings form IPv4 only to dual stack and the era of IPv6 has come for me as well. It was not an easy beginning. Though there are a lot of tutorials on the internet, most of them is focusing on why IPv6 is required as IPv4 address space has been depleted and how to write IPv6 addresses in short.

Then I watched another ton of routing videos, and read about Global Addresses, Unique Local Address (ULA), Link Local Addresses, SLAAC, DHCPv6.

Setting my goals:

  1. Assign an ULA for my machines on the network including LXC containers.
  2. If possible add DNS names to these addresses.

I have a small box which provides me a lot of services, most important DHCP and DNS for my home network and virtual machines using dnsmasq.

Create an ULA and Assign it to Statically to an Interface

As a center of my infrastructure I would have liked to assign an ULA to my small server. I’ve used SixXS to generate mine based on my MAC address. Normally any random address is good from the fd::/8 address space, but I wanted something standard. You can register your ULA in SixXX as well, but I don’t feel that necessary for any home reason. It might count if you binding networks together, however chances of collision are little to none if you are using random addresses. So I’ve got something like fd47:e7a0:3e36::/48 here you have 16 bits (65536 possibilities) for subnets, to make a /64 network address. So I chose subnet 0 and  1 for the interface combining them together to a fd47:e7a0:3e36::1/64 IPv6 address.

I’ve tried several ways to add this statically to my interface, but nothing really worked until I tried to add it by hand which worked, so I crafted it into the /etc/network/interfaces file like (upon this source):

iface eth0 inet static
    <IPv4 suff>
    up modprobe ipv6 || true
    up ip -6 addr add 2001:0db8:bd23:e100::1/64 dev $IFACE
    up ip -6 addr add fd47:e7a0:3e36::1/64 dev $IFACE
    up ip -6 route add default via fe80::caf3:26ff:fed2:4bc9 dev $IFACE

Let’s brief what these up lines are doing:

  1. Loading ipv6 kernel module. I’m not sure that it is required, but it causes no harm either.
  2. Assigning a custom global IP to the interface. Well I get the first 56 bit from the ISP, then I left 8 bit for subnets (I chose subnet 0) then I still can choose from a 64 bit address space (1 for now).
  3. This is the ULA assignment.
  4. Define the default route using the link local address of the router.
    Note: It is required to specify the device for a link local address.

Distribute ULA on the Rest of the Network via SLAAC

First of all I had to switch off the DHCPv6 on my router, as it just caused some additional noise on my network.

I added the following configuration to dnsmasq:

enable-ra
dhcp-range=fd47:e7a0:3e36::, ra-names
dhcp-option=option6:dns-server,[fd00::]

Let’s brief what these up lines are doing:

  1. Enable router advertisement for subnets (not sure yet, that this is needed)
  2. Assign SLAAC names on fd47:e7a0:3e36::/64 network, the names are coming from IPv4 stack DHCP announcements using MAC binding. Quite a nice feature indeed!
  3. Advertise the DNS server (ourself) on any ULA address

From now I have Global and ULA IPv6 IP-s on my network, dnsmasq resolves local hostnames to ULA addresses.

 

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

One Response to IPv6 at Home with Ubuntu

  1. Pingback: Things I’ve Learned on IPv6 – Doki's Adventures on Build, NetBeans, etc…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s