IPv6 Addressing π±
So IPv6 has long addresses - a main feature, but people complain they are unreadable and hard to remember.
How to read and write IPv6 addresses
So when we send information on the Internet today, we basically either use IP version 4 or IP version 6, both work in parallel. They are not completely compatible, but we can use both.
So we can have a system with both protocols select which one to use, and often try both.
Say you want to visit this site https://garden.kramse.org your browser will do a DNS lookup, and connect to the address:
$ host garden.kramse.org
garden.kramse.org has address 185.129.62.180
garden.kramse.org has IPv6 address 2a06:d380:0:9985::1
The command host looks up the addresses on the command line, which is a built-in function in your browser. Then your browser would decide to connect to either the IPv4 shown first, or the IPv6 address β written with colons here.
If you compare the length it does not seem bad, so why are people complaining?!
Usually the people complaining are not using IPv6 β and have little to no experience actually using IPv6. So if they see addresses it may be from a command output like this one from my Linux laptop:
$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 50:84:92:84:4f:e5 brd ff:ff:ff:ff:ff:ff
altname wlx508492844fe5
inet 10.0.46.184/24 brd 10.0.46.255 scope global dynamic noprefixroute wlp2s0
valid_lft 41843sec preferred_lft 41843sec
inet6 2a06:4004:f05b:3:955c:488d:fce5:1862/64 scope global dynamic noprefixroute
valid_lft 3568sec preferred_lft 2475sec
inet6 fe80::df01:525:2dc7:32ef/64 scope link noprefixroute
valid_lft forever preferred_lft forever
In this example I have two network cards - a loopback interface lo and a Wi-Fi interface wlp2s0. They both have IPv4 and IPv6:
- lo has the well known addresses 127.0.0.1 and a new IPv6 address ::1
- wlp2s0 has 10.0.46.184/24 and a horrendous IPv6 address starting with 2a06:4004:.. and also ANOTHER starting with fe80: ?! Why oh why, this is complicated, I donβt like this!
Basic IP addressing
So with IPv4 we had an address 10.0.46.184 with /24 which signifies that this is a local address using Address Allocation for Private Internets RFC1918 - usually a Local Area Network (LAN) behind a Network address translation (NAT) router. The number 24 is the CIDR notation with 24-bit subnet mask of 24 times 1. Classless Inter-Domain Routing has been around since the 1990s and is the default since then.
With IPv6 we also use CIDR notation and the /64 is the most common case, a 64-bit prefix. This means the first half of the 128-bit address is the subnet and the rest is the host identifier - but in IPv6 we call if the interface ID. The reader has also noticed that instead of decimal numbers with dots - dot notation we write IPv6 with hexadecimal digits seperated by colon.
There are also ways to simplify the address so we can avoid having to write all 8 groups of four digits each time. The main rules are:
- The preferred form is x:x:x:x:x:x:x:x, where the βxβs are one to four hexadecimal digits of the eight 16-bit pieces of the address.
- Leading zeroes can be left out
- β::β indicates one or more groups of 16 bits of zeros. The β::β can only appear once in an address
2.3. Text Representation of Address Prefixes
The text representation of IPv6 address prefixes is similar to the
way IPv4 address prefixes are written in Classless Inter-Domain
Routing (CIDR) notation [CIDR]. An IPv6 address prefix is
represented by the notation:
ipv6-address/prefix-length
where
ipv6-address is an IPv6 address in any of the notations listed
in Section 2.2.
prefix-length is a decimal value specifying how many of the
leftmost contiguous bits of the address comprise
the prefix.
For example, the following are legal representations of the 60-bit
prefix 20010DB80000CD3 (hexadecimal):
2001:0DB8:0000:CD30:0000:0000:0000:0000/60
2001:0DB8::CD30:0:0:0:0/60
2001:0DB8:0:CD30::/60
Source: IP Version 6 Addressing Architecture
This might still seem like a lot of noise, and you are correct, but hang on!
Short hand
So in the examples above we have the adddresses:
garden.kramse.org has IPv6 address 2a06:d380:0:9985::1
interface wlp2s0 has 2a06:4004:f05b:3:955c:488d:fce5:1862/64
The last one is a dynamic address currently used on a laptop - similar to the 10.0.46.184 address allocated by Dynamic Host Configuration Protocol (DHCP) for IPv4. If you asked me for my DHCP address I would typically NOT know it, and there is no reason for remembering the long dynamic IPv6 address either - so forget it! If you need it, look it up. Similarly on lower physical level we use 48-bit Medium access control (MAC) addressing - our network cards Ethernet and Wi-Fi has a unique identifier. Nobody wants to remember those either!
The other one though - is allocated by me. Well I got the first part from RIPE NCC which got an allocation from IANA. This is documented in the IPv6 Global Unicast Address Space registry at https://www.iana.org/assignments/ipv6-unicast-address-assignments/ipv6-unicast-address-assignments.xhtml
So I got 2a06:d380::/32 (actually /29 but for now) and I use this for ALL my IPv6 addressing! Every host in my network is allocated from this base prefix. Then decided to allocate a part for my Kubernetes cluster 0:9985 and combined this is a /64.
So within this prefix/subnet 2a06:d380:0:9985::/64 a service is published with the full address 2a06:d380:0:9985::1 β which for me is comparable to remembering the IPv4 address 185.129.62.180.
TL;DR IPv6 addresses are always assigned in 64-bit prefixes/subnets - so remember only the first part and the last few bits, and in total that will be only a little more complex than 32-bit IPv4 addresses.
Notes in this category
Notes mentioning this note
There are no notes linking to this note.