07.02.2014 10:30

Building a local IPv6 network

IPv6 is still sligthly moving target. You may configure it once and it won't complay in a few month to valid RFC, as they change. Or your tunnel provider may change and tunnel stops to work too. If you want to get used to IPv6 and you do not have a global IPv6 addresses - either your own (pretty expensive) or from your ISP - you may try to test it on a unique local address range formely a site-local range.

While it may look like IPv6 is just an IPv4 with more addresses it is not that simple. It has some features not know in IPv4 world. Mainly - every interface with IPv6 enabled has "always" its link-local  address (in Linux based on device MAC, on Windows radnom, which is troublesome in some cases). This address looks like

ip -6 a s eth0
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 fe80::fad1:11ff:fe00:8a8a/64 scope link
valid_lft forever preferred_lft forever

The device MAC is

f8:d1:11:00:8a:8a

The lower part of link-local address is made with inserting fffe and inversion of bit 1 (2nd bit) in most left byte

fa:d1:11:ff:fe:00:8a:8a

Link local addresses are used for SLAAC (stateless address autoconfiguration) - this means the device may obtain further info about "more global" address based on its neighbor information. The neighbor has to support so called Router Advertisement.

The network works with link-local addresses, but if you try to ping a link-local address it fails - you have to use a device annotation

$ ping6 fe80::213:3bff:fe0c:1a5
connect: Invalid argument
$ ping6 fe80::213:3bff:fe0c:1a5%eth0
PING fe80::213:3bff:fe0c:1a5%eth0(fe80::213:3bff:fe0c:1a5) 56 data bytes
64 bytes from fe80::213:3bff:fe0c:1a5: icmp_seq=1 ttl=64 time=0.547 ms

To get it working you need any kind of a unique address.

There are several ways to do a RA on your router. Most common is using radvd, then you may use also quaggas zebra daemon or, what I cosider best so far, to use a dnsmasq. It has the advantage it is also able to construct its "dhcp" range from existing IP address on device and severs also as DNS. Enabling RA in dnsmasq is as easy as this

dhcp-range=ipv6,::1,::ff,constructor:eth0,ra-names,12h
enable-ra

Then all IPv6 enabled devices in range will recieve the address based on eth0 address.

To build a local IPv6 network you may use unique local address range

fc00::

i.e.

ip -6 addr add fc00::1/64 dev eth0

Do not forget to enable IPv6 forwarding on the router

sysctl -w net.ipv6.conf.all.forwarding = 1

Restart dnsmasq and you are done you may use a local IPv6. Of course if you want to make it permanent do not forget to write address and forwarding to your config files.

http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2012q3/006311.html


Email comment