Bootstrap FreeKB - Linux Fundamentals - Understanding IPv6
Linux Fundamentals - Understanding IPv6

Updated:   |  Linux Fundamentals articles

IPv4 addresses are 32 bits. IPV6 addresses are 128 bits. An IPV6 address consists of eight hexadecimal 4 digit units separated by colons. An IPv6 address can consist of the numbers 0 -9 and the letters A - F. For example:

2001:0db8:0217:0000:5a3c:0000:0121:0089


Dropping zeros

To reduce the length of an IPv6 address, leading zeros can be omitted from any hexadecimal unit that starts with one or more zeros. Also, consecuitive units that contain 4 zeros can be completely omitted, but this can only be used once. In another words, an IPv6 address can only have once instance of a double colon. For example:

Original: 2001:0db8:0217:0000:5a3c:0000:0121:0089

Revised: 2001:db8:217::5a3c:0:121:89

Bad IPv6 address:  2001:db8:217::5a3c::121:89


/64 Prefix

There are 64 bits in the first 4 units of an IPv6 address and there are 64 bits in the last 4 units of an IPv6 address. The first 4 units are the network ID and the last 4 units are the interface ID. For example:

Network ID - 2001:0db8:0217:0000

Interface ID - 5a3c:0000:0121:0089


Link local addresses (fe80)

IPv6 addresses starting with fe80 are link local addresses. A link local address is similar to the APIPA 169.254.x.x address in IPv4. Routers do not forward packets with a link local address.

If using Windowws, you can use the ping command to test connectivity to any link local address in the LAN.

ping fe80::fdc2:c31f:f82e:acc2
Reply from fe80::fdc2:c31f:f82e:acc2 time<1ms
Reply from fe80::fdc2:c31f:f82e:acc2 time<1ms
Reply from fe80::fdc2:c31f:f82e:acc2 time<1ms
Reply from fe80::fdc2:c31f:f82e:acc2 time<1ms

 

If using Linux, you can use the ping command to test connectivity to any link local address in the LAN. -c 4 will send 4 ICMP packets. -I eth0 specifies the interface to use.

ping6 -c 4  -I eth0 fe80::fdc2:c31f:f82e:acc2
64 bytes from fe80::fdc2:c31f:f82e:acc2 icmp_seq=1 ttl=64 time=4.35 ms
64 bytes from fe80::fdc2:c31f:f82e:acc2 icmp_seq=2 ttl=64 time=0.347 ms
64 bytes from fe80::fdc2:c31f:f82e:acc2 icmp_seq=3 ttl=64 time=0.341 ms
64 bytes from fe80::fdc2:c31f:f82e:acc2 icmp_seq=4 ttl=64 time=0.515 ms

Unique local addresses (fc, fd)

IPv6 addresses starting with fc or fd are unique local addresses. A unique local address is similar to a private IP address in IPv4. 

If using Windowws, you can use the ping command to test connectivity to any unique local address in the LAN, as long as the router in the LAN is configured to support IPv6.

ping fc01::fdc2:c31f:f82e:acc2
Reply from fc01::fdc2:c31f:f82e:acc2 time<1ms
Reply from fc01::fdc2:c31f:f82e:acc2 time<1ms
Reply from fc01::fdc2:c31f:f82e:acc2 time<1ms
Reply from fc01::fdc2:c31f:f82e:acc2 time<1ms

 

If using Linux, you can use the ping command to test connectivity to any unique local address in the LAN, as long as the router in the LAN is configured to support IPv6.

ping6 -c 4 fc01::fdc2:c31f:f82e:acc2
64 bytes from fc01::fdc2:c31f:f82e:acc2 icmp_seq=1 ttl=64 time=4.35 ms
64 bytes from fc01::fdc2:c31f:f82e:acc2 icmp_seq=2 ttl=64 time=0.347 ms
64 bytes from fc01::fdc2:c31f:f82e:acc2 icmp_seq=3 ttl=64 time=0.341 ms
64 bytes from fc01::fdc2:c31f:f82e:acc2 icmp_seq=4 ttl=64 time=0.515 ms

Public IPv6 address

http://test-ipv6.com is a great way to determine if your ISP has assigned you a public IPv6 address.


Multicast address (ff)

IPv6 addresses starting with ff are multicast addresses. A multicast address is packets intended to multiple possible recipients.


Loopback address (::1)

IPv6 address ::1 (or 0000:0000:0000:0000:0000:0000:0000:0001) is the loopback address. This is the equivalent to 127.0.0.1 in IPv4. You can ping ::1 to test connectivity with localhost.

Windows:

ping ::1
Reply from ::1 time<1ms
Reply from ::1 time<1ms
Reply from ::1 time<1ms
Reply from ::1 time<1ms

 

Linux

ping6 -c 4 ::1
64 bytes from ::1 icmp_seq=1 ttl=64 time=0.128 ms
64 bytes from ::1 icmp_seq=2 ttl=64 time=0.147 ms
64 bytes from ::1 icmp_seq=3 ttl=64 time=0.141 ms
64 bytes from ::1 icmp_seq=4 ttl=64 time=0.115 ms

Documentation address (2001:db8)

IPv6 addresses starting with 2001:db8 (or 2001:0db8) are used for documentation purposes (which is why this address was used in this article). 


Neighborhood Discovery

Neighborhood Discovery is a term used in IPv6 to describe the process of discovering the link-local address being used in a LAN. Neighborhood Discovery used the ICMP protocol to discovery the link-local address of a neighbor in the LAN.


Spotting a bad IPv6 address

Following are examples of bad IPv6 addresses.

Double colon: 2001:db8:217::5a3c::121:89


Viewing your PC IPv6 address

On Linux, the ifconfig or ip addr command can be used to view the IPv6 being used by the PC. Notice in this example an IPv6 loopback and link-local address are displayed.

[root@server1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65535 qdisc noqueue state UNKNOWN group default
. . .
  inet6 ::1/128 scope host
. . .
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast static UP group default qlen 1000
  . . .
  inet6: fe80::72f1:a1ff:fe8c:ca2f/64 scope link
. . .

 

[root@server1 ~]# ifconfig
eth0    Link encap:Ethernet  HWaddr 61:f3:b2:7b:21:1c
        inet addr:192.168.0.129  Bcast:192.168.0.255  Mask:255.255.255.0
        inet6 addr: fe80::72f1:a1ff:fe8c:ca2f/64  Scope:Link

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter fe318b in the box below so that we can be sure you are a human.