In 2005 I sat my CCNP and part of one of the four exams dealt with IPv6. I had it pretty nailed down in my head at the time and passed no problems. Six years passed by and not a single IPv6 thought or packet crossed my path, well, not intentionally anyway. I pretty much forgot it all, until recently.
It’s been on my list of things to do for a while but I finally got around to making the switch to IPv6 on my home network and Internet connection.
There were a few reasons for this. The first, simple geek curiosity. There’s something to know about so I set about finding out. The second, attack vectors.
I feel like I’m late to a very cool party but I’m catching up quickly. I might have to neck a few shots to get level with some of the people who’ve been here from the beginning but it’s all good.
First step: Start using it
There’s no substitute for hands-on experience. I run a pretty normal home network. Fair amount of Apple gear, Cisco, Citrix XenServer, Linux and Windows VMs, Mikrotik and Synology. OK, maybe that’s normal if you fit a certain profile.
All of these devices, it transpires, play pretty nicely with IPv6. If anyone wants a specific HOWTO on any of these let me know but otherwise there are plenty of decent articles out there already.
Addresses: Dishing it out
The main thing to get your head around first with IPv6 is addressing. It’s all different, but all the same. Remember that IPv6 is only replacing one layer of the OSI so don’t panic if you don’t know anything about it, it’s just one bit. There are however, some crucial differences in behaviour between IPv4 and IPv6. The most noticeable one, at least on a small network, is Stateless Address Autoconfiguration. IPv4 actually has autoconfiguration but it’s not widely used. For most people their contact with autoconfiguration in IPv4 is “Oh, I’ve got an IP address 169.x.x.x, DHCP server is broken”. That 169 address is actually autoconfiguration doing its thing but in an IPv4 network it isn’t overly useful.
With IPv6 it becomes much more….useful.
My (now) favourite myth regarding IPv6 is that “no-one is using it”. Au contraire, nearly everyone with an OS from about 2005/6 on is using it, they just don’t realise. Windows Vista/7, Linux, OSX, iOS and BSD all include IPv6 support by default and, even better, if IPv6 is available in the network, prefer it.
If you have a bunch of nodes on the same network with IPv6 support (which you have, unless you turned it off) they’ve already configured themselves with a Link-Local address and can talk to each other. A whole network you might not have known about. Heh.
What am I talking about? The Link-Local scope is a mandatory part of the IPv6 implementation. The network fe:80::/10 is reserved for Link-Local addresses (though a /64 mask is used). There are two ways to assign addresses in the Link-Local scope, DHCPv6 and Stateless Address Autoconfiguration. First, some IPv6 addressing basics.
IPv6 uses 128-bit addresses. Woah, I hear you say, that’s big. Well, yeh, it is (with IPv6 we can assign an address to every grain of sand on earth and still have some spare), but in reality, you only have to worry about the first 64-bits for most things. For a lot of addresses it’s even easier. Take the Link-Local range for example, let’s expand that out from its shorthand notation fe:80::/10:
fe:80:00:00:00:00:00:00:00:00:00:00:00:00:00:00
Scary big right? Nah, the :: means consecutive octets of 00 so the whole thing can be written fe:80::, not too bad. Back to autoconfiguration, IPv6 makes use of something called the EUI-64 address. I’d never heard of that before but I was familiar, like most, with the 48-bit MAC address. This is the EUI-48 address. To get an EUI-64 address from the common EUI-48 addresses used by cards today there’s a simple algorithm to perform, well documented at http://packetlife.net/blog/2008/aug/4/eui-64-ipv6/ but summarised here.
Take the sample MAC address b6:9c:2a:31:1c:a9. To get from this 48-bit address to a 64-bit address we first split it in half and insert ff:fe in the middle. This gives us:
b6:9c:2a:ff:fe:31:1c:a9
We then flip the 7th bit, specifically the universal/local flag in the OUI part of the MAC address. In this case b6 converts to binary:
1011 0110
If we flip the 7th bit we will end up with:
1011 0100
Or b4. So our EUI-64 address is b4:9c:2a:ff:fe:31:1c:a9. Autoconfiguration dictates that the last 64-bits of the IPv6 address should use the EUI-64 address, which should be unique on a local subnet. So our Link-Local address will be:
fe:80::b49c:2aff:fe31:1ca9/64
All the other IPv6 enabled nodes on your network will have performed this same process and configured a Link-Local address. I touched on this in my hashdays post but if you want to discover nodes on your local IPv6 network from your Linux box there is a multicast “all nodes” address you can trying pinging:
ping6 ff02::1%eth0
Substituting eth0 for the appropriate IPv6 interface on your machine.
Going global
So, that’s great. All the IPv6 hosts on our network can talk to each other and always could, we just didn’t know. Now we want to start using IPv6 for something useful, like talking to other networks. These networks could be ours, such as a different VLAN or DMZ, or someone else’s, such as the Internet. Enter the Global scope. If you want to talk off your Local link you will need a Global address. How do you get one? Stateless Address Autoconfiguration can do this too. Say goodbye to DHCP unless you really need to track IP address use.
IPv6 uses Neighbor Discovery Protocol (NDP) to understand the network around it. Part of NDP includes listening for and processing Router Advertisements (RA). Guess what sends RAs? Routers of course. So in order to get our network talking global we need to turn our attention to our router.
Assuming your router talks IPv6 it should be possible to assign an IPv6 address to your router and have it advertise configuration information to connected subnets. Hosts on this network will receive the information through NDP (which works over ICMPv6) and configure a Global IP address accordingly.
This was all great but what the hell IP addresses would I assign? In IPv4 land we’re all very familiar with RFC1918 addresses which then get NATted by our router out to the Internet. Is there an equivalent in IPv6? Should we use it?
Throw off your NAT comfort blanket
Yes, there is an RFC1918 “equivalent” in IPv6. It’s called Unique Local Address (ULA). Should you use it? In my opinion, absolutely not. There are more than enough addresses to go around in IPv6, there is no need to concern oneself with private addressing. ULA’s, like RFC1918′s are not routable on the Internet so you’re going to need to translate them to something routable, a la IPv4, using NAT.
But NAT is evil right? Of course it’s not but it does cause problems for some protocols and it’s frankly unnecessary when there’s enough addresses. So ditch it. Get rid of the NAT comfort blanket, browse the Internet naked.
There’s another reason too. There are virtually no consumer grade routers which currently support IPv6 so you’ll probably be looking for something more specialised. Additionally, as NAT is largely considered superfluous in IPv6 many router vendors appear not to have implemented support for it. This is certainly the case in Mikrotik so you may not be able to do NAT even you wanted to. Bear this in mind as you design your new IPv6 network.
Assigning an address
Where then, do you get an address allocation for your new IPv6 network? I’m not going to get into dual-homing in this post as it does raise some issues in IPv6. I’ll assume this is a SOHO network and you don’t mind being tied to an ISP. So I kinda answered the question there, your ISP will give you an address allocation, usually a /48.
IPv6 Tunneling
That is assuming your ISP provides native IPv6 support which is, unlikely. If you can’t get native then your only option is a tunnel. A tunnel can come in a number of guises but essentially you’re encapsulating an IPv6 payload in an IPv4 packet that can be routed across the normal IPv4 Internet onto the IPv6 Internet where it is de-encapsulated and sent on its way.
Before I went native (more on that later) I used Hurricane Electric in order to provide this tunnel. In order to set up a tunnel you’ll need (ideally) a static IPv4 address on the Internet, a router/firewall capable of 6in4 tunnels and to allow the remote tunnel endpoint to send ICMP and protocol 41 (6in4) traffic to you.
All the details are provided on the HE website and there is a configuration tool which provides all the technical implementation steps required to set up the tunnel for various vendor devices. I was very impressed with the whole experience. You set up an account, which is free, on the HE website, then register a new Regular Tunnel with your static IPv4 address. You choose a tunnel endpoint, I chose London since I’m in the UK, and it spits out the config for your device. I was literally able to paste this into my Cisco device and the tunnel came straight up.
You will be given a /64 allocation which, if you run a typical home network with a single subnet will be fine. I don’t. Believe it or not a /64 is no good to you if you run multiple subnets. The reason is simply that, by default, the use of EUI-64 addresses in Stateless Address Autoconfiguration means you cannot further subnet the /64. It’s essentially the smallest IPv6 subnet you can use. So you need more.
Through your HE account you can request a /48 allocation. This is typical and makes use of the way IPv6 was designed. Essentially your provider is issued a /32, they then issue /48s and you, the end user, deploy multiple /64s. You don’t *have* to do it like this, but that’s the way it’s intended.
So why buck the trend? I’m not experienced enough to know better yet so I requested my /48 with a simple click and seconds later I had it. So this post can be specific I’ll tell you my allocation was 2001:470:68ba::/48. Something to be aware of, especially if you’re a privacy freak, HE are duty bound to enter details in WHOIS about the allocation. For me it doesn’t matter, I registered my allocation in my company name and those details are public anyway but if you signed up to HE with your personal address be aware that a whois query on your network allocation will turn up some of your personal details, if you supply the correct ones of course.
Going native
If you’re lucky, or clever, you’ll have an ISP who supports native IPv6. I recently switched mine in order to get this. If you’re in the UK and on ADSL I can recommend Goscomb who seem very switched on and are staffed by techies.
IPv6 comes as standard with them, just configure your ADSL router interface for autoconfiguration. Once you’re up and running a simple email to their support desk is all it takes to be allocated a /48.
Subnetting
What now then? You’ve got a /48 and you need to divide it up, sticking with tradition, into /64s. For simplicity’s sake let’s say you have two subnets, subnet A and subnet B at home and you want to assign a /64 to each. The easiest approach is to use “low number allocation”. Those are my quotes, it’s not an industry term as far as I’m aware. Let’s break that IP address allocation down for a second. The part in bold represents the first 64 bits:
20:01:47:00:68:ba:00:00:00:00:00:00:00:00:00:00
So you can see, fairly simply, that the /48 allocation prefix ends at the ba and then we have 00:00 to play with before the last 64 bits “reserved” for the EUI-64 address. This 00:00 equates to 65536 /64 subnets! Most people therefore take the easy route and say subnet A gets 20:01:47:00:68:ba:00:01/64 (or 2001:470:68ba:1::/64) and subnet B gets 20:01:47:00:68:ba:00:02/64 (or 2001:470:68ba:2::/64) – for the purist I’m aware this is not starting at zero.
Making it work
You’ve got your subnet allocation, now you need to assign addresses. Well, if you use autoconfiguration all you need to do is assign one address – your router. Hop on to your router and assign a static manual address, again, most people choose 1 so in our example, for subnet A the router is going to get the address 2001:470:68ba:1::1/64. By default all IPv6 routers, that I’m aware of, will perform RAs unless told otherwise so that is basically it. Your entire subnet will now automatically configure IPv6 Global addresses with a 2001:470:68ba:1::/64 prefix, use their EUI-64 address for the last 64 bits, set :1 as their default route and, providing your router knows to route IPv6 traffic out via the HE tunnel, you’re on the Internet using IPv6.
Testing it
ICMP is a fundamental part of IPv6. I won’t get into it here but the upshot of that means you can use ping again to test connectivity. Several major sites run an IPv6 version including Google and Facebook. I tend to use Google to test connectivity (actually, Google have always allowed ping to their sites, even on IPv4, but hey). From an OSX or Linux box try the command:
ping6 2a00:1450:8007::69
This is the IP address for ipv6.google.com. You should see replies. If you do, you’re over the hardest part.
The next step is DNS resolution. This is going to depend on your set up. If you use your upstream ISP for your DNS, as most people do, you will need to hope their DNS servers support IPv6. From your IPv6 enabled host, though you may not be aware, every time you look up an address it’s actually been asking for an AAAA record first. The AAAA record is the IPv6 address for a host. Often this address is not returned or is not routable so it falls back and requests the A record, IPv4 address. If your ISP does not support IPv6 in their DNS you have two alternatives.
1) Use an alternate, public DNS service such as OpenDNS or Google Public DNS
2) Build and use your own resolver
Both of these are beyond the scope of this article but FYI I use my own DNS server, maybe I’ll do a write up on building one of those one day but there’s loads available already. Ping me if you have questions.
Once you have routable IPv6 and DNS working you’re basically all set to use IPv6 in the wild. The best thing to do next is visit http://test-ipv6.com which will perform a full diagnostic of your IPv6 capability. If you come back with 10/10 then you’re doing very well.
Firewalls
Something to bear in mind with IPv6. If you do it the “proper” way, as I’ve outlined here, there’s no NAT. If you don’t want your host being contacted directly from the Internet you should be sure that your firewall is actually filtering IPv6 traffic. I can’t possibly go through instructions for every firewall here but there are some basics to be aware of. Every firewall I’ve come across so far has a different ruleset for IPv6 versus IPv4, so you can’t assume you’re protected.
That includes Linux where the ip6tables command is used to configure the IPv6 firewall. You could be well defended against IPv4 using iptables but allowing any traffic from IPv6. This can be OK on a link-local subnet where there is likely an element of trust, but a different ball game once you’re Internet addressable.
Hurricane Electric offer a free nmap scan through their website to your allocated IP which you can use to test your firewall, alternatively, contact me and I’ll do it for you.
Privacy
Something which may freak you out, it did me, the first time I saw it. If you go the http://test-ipv6.com/ website, it reveals your “internal” IPv6 address. Of course it does, there’s no NAT. On this topic there’s a couple of things to note.
Firstly, unless you’re deliberately proxying or tunnelling through different sites and being smart, privacy on the Internet is a myth. Don’t think for one minute that your RFC1918 network NATted behind your ISP assigned address is any protection at all. With IPv6 and no NAT it’s just making it explicit.
Many OSes do provide so-called “Privacy Addresses” which are randomly generated valid additional IPv6 addresses which the host adds to your interface and will use to communicate to Global Scope networks. This means you can browse the Internet without divulging your true IP address on the local LAN. Windows does this by default.
It seems appealing on the face of it but ultimately, it’s pointless. Learn to control the information given away to anonymous websites through better means, not relying on security through obscurity. Your IP address is meaningless if the attacker gets your computer to initiate the connection.
Summing up
Switching to IPv6 was remarkably easy. Go native if you can or get a free tunnel from HE (or other provider) but either way, get yourself connected via IPv6 as there are so many things to learn. I also switched my VPS provider from Amazon to a company called BitFolk who offer excellent pricing and native IPv6 support so now my websites (with the exception of this which is hosted at wordpress.com) all enjoy IPv6 too.
Watch this space for some more posts soon as I start to explore the attacks and defences in IPv6 and please get in touch with me if you have any questions.