Getting Started with IPv6

It took me a -long- time to wrap my head around IPv6. It wasn’t for lack of trying — a lot of the documentation is difficult. Here’s my quick IPv6 primer:

Address Types

There are a few types of addresses, you’ll have to memorize them.

  • Link-Local – Starts with “fe80”
    • This is equivalent to the IPv4’s 169.254 range.
    • It’s auto-generated per interface, based off of the mac address.
    • Computers connected to the same network segment can communicate via link-local addresses. A ‘Neighbor Detection’ service helps nodes find each other locally.
    • Unlink IPv4, this address is mandatory (every IPv6 interface has one).
  • Site-Local – Starts with “fc00” or “fd00”
    • This is equivalent to the IPv4’s private address range (10.0.0.0, 192.168.0.0, and 172.16.0.0).
    • Internet routers will refuse to route these addresses by convention.
  • Global-Unique
    • This is the equivalent to globally unique IPv4 addresses.

You’ll also hear about ‘Anycast’ addresses. These aren’t a big deal. An anycast address is just a regular address, but by convention it’s allowed to be assigned to multiple servers. When you request the address from a client, the router that your packets will go to will decide to route you to the nearest server matching that address.

As an example, say your network spans the globe. You want to configure a bunch of DNS servers. You might give all of your DNS servers the same ‘anycast’ address, and configure your routers around the world such that when a client requests that anycast address, the router sends the packets to the closest DNS server.

Subnetting

Subnetting IPv6 is pretty similar to subnetting IPv4, except that you have to wrap your head around hex. Let’s go through some examples:

Turning slash notation into an IPv6 range.

Here are the steps:

  1. Write the IPv6 address out in binary.
  2. Write a line of “one” characters corresponding with the IPv6 slash number.
  3. Find the starting address by performing an ‘and’ operation between the binary  IPv6 address and line of “ones”.
  4. Find the ending address by performing an ‘or’ operation between the binary IPv6 address and the inverse of the line of “ones”.

Example time!

What’s the starting and ending address for fd54:4f72:cfcb::/48?

Step 1

Write the address out in binary. Each character of the IPv6 address requires 4 bits.

Here’s a handy hex to binary chart:

0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001
10 (a) = 1010
11 (b) = 1011
12 (c) = 1100
13 (d) = 1101
14 (e) = 1110
15 (f) = 1111

fd54 = 1111,1101,0101,0100
4f72 = 0100,1111,0111,0010
cfcb = 1100,1111,1100,1011
so, the binary representation is:
1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

Step 2
Write out the binary prefix underneath the binary network address. In our case, this will be 48 “ones”.
1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000
1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

Step 3
Perform an ‘And’ operation to find the starting address
1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

AND

1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

Result:
1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

Convert to hex:
Our starting address is: fd54:4f72:cfcb::

Step 4
Perform an ‘Or’ operation on the binary address and inverse of the prefix.

1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

OR

0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111

Results:

1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111

Convert to hex:
Our ending address is fd54:4f72:cfcb:ffff:ffff:ffff:ffff:ffff

Your First IPv6 Network

Let’s pretend we’re setting up a simple IPv6 network. What could our addresses look like? Let’s assume that your ISP gave you fd54:4f72:cfcb::/48. We want to subnet that into a /64 for our first network. How do we do that?

To be simple, let’s configure the default gateway of our first subnet as fd54:4f72:cfcb::1.

Let’s find our ending address.

Binary Network Address:

1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000

OR (inverse of /64 prefix)

0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 0000 0000 0000 0000 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111

Results:

1111 1101 0101 0100 : 0100 1111 0111 0010 : 1100 1111 1100 1011 : 0000 0000 0000 0000 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111 : 1111 1111 1111 1111

Convert to hex:
Our ending address is fd54:4f72:cfcb:0000:ffff:ffff:ffff:ffff.

So, for our first /64, we can use the range fd54:4f72:cfcb:: through fd54:4f72:cfcb:0000:ffff:ffff:ffff:ffff for clients. Don’t forget that we’re already using fd54:4f72:cfcb::1 for the gateway though.

Here’s an example:

Router Interfaces:
eth0 (internet uplink to ISP) <Upstream IP address assigned by ISP>
eth1 (our first /64 network) fd54:4f72:cfcb::1

Client Interfaces (made these up):
adds1.testnet.local – fd54:4f72:cfcb::2
fileserver1.testnet.local – fd54:4f72:cfcb::3
win8-desktop.testnet.local – fd54:4f72:cfcb::4

Hopefully that gets you started. I’ll talk about transition technologies next. Here’s a cool page to help you generate site-local addresses to play with.

Unique Local IPv6 Generator

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s