IPv6 Foun­da­tion Part 8: IPv6 on Lin­ux

IPv6 Foundation Part 8 - IPv6 on Linux
All the Tricks and Com­mands! Now Free! How IPv6 on Lin­ux works, how to enable, dis­able & trou­bleshoot it! Find all your answers and more in this free Course!

Table of Con­tents

About this course

So you are inter­est­ed in IPv6, which is absolute­ly great!

IPv6 is not only the future of net­work­ing, it is already here today! All the big play­ers on the Inter­net are already IPv6 enabled and it is now time for you to join the par­ty!

This course cov­ers all major aspects of the new Inter­net Pro­to­col and what changed, com­pared to IPv4. You will under­stand the fun­da­men­tals and be ahead of your peers that are still on the sink­ing ship of IPv4! As of today, there are no IPv4 address­es left and we have no oth­er option but to go ahead and deploy IPv6.

IPv6 Act Now

IPv6 Foun­da­tion Part 8: IPv6 on Lin­ux

Let’s have a look at IPv6 sup­port and some his­to­ry for Microsoft Win­dows, Apple MacOS and Lin­ux imple­men­ta­tions of our new Inter­net Pro­to­col.

IPv6 in Linux

In 1996 — after the first Draft of the IPv6 Spec­i­fi­ca­tion from Decem­ber 1995 in RFC1883 the first IPv6 code was includ­ed in Lin­ux Ker­nel 2.1.8.

In 2000 — the Japan­ese USAGI project sets a goal to ful­ly
imple­ment IPv6 on Lin­ux.

In 2008 — the IPv6 imple­men­ta­tion in Lin­ux was near­ly com­plete in Ker­nel 2.6.

How to dis­play IPv6 address­es on Lin­ux

$ ip -6 addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
5: br0: <BROADCAST,MULTICAST,UP, LOWER_UP> mtu 1500
    inet6 2a02:69e0:1337::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:f6ff:fefc:84d6/64 scope link
       valid_lft forever preferred_lft forever

the ip com­mand is part of the iproute2 pack­age, which is the stan­dard and state of the art user­space util­i­ty to work with ip address­es and rout­ing across all ver­sions of the Inter­net Pro­to­col.

How to con­fig­ure a sta­t­ic address for IPv6 on Lin­ux

$ ip -6 addr add 2a02:69e0:1337::1/64 dev eth0

Using the same ip com­mand from the iproute2 suite of tools you can just add the IPv6 address with pre­fix nota­tion to a spec­i­fied inter­face, here eth0.

How to remove a sta­t­ic address for IPv6 on Lin­ux

$ ip -6 addr del 2a02:69e0:1337::1/64 dev eth0

The same com­mand applies for remov­ing an address, just replace add with del.

How to dis­play the neigh­bor cache for IPv6 on Lin­ux

$ ip -6 neigh show
fe80::218:19ff:fe55:6a44 dev br0 lladdr 00:18:19:55:6a:44 router STALE
fe80::218:19ff:fe55:6a7a dev br0 lladdr 00:18:19:55:6a:7a router STALE
fe80::218:19ff:fe55:6a67 dev br0 lladdr 00:18:19:55:6a:67 router REACHABLE

The IPv6 neigh­bor cache is a crit­i­cal part of the protocol’s inter­nals and can uncov­er some inter­est­ing infor­ma­tion.

How to con­fig­ure default route for IPv6 on Lin­ux

$ ip -6 route add ::/0 via 2a02:69e0:1337::23

A default route is prob­a­bly the most impor­tant route for a host, because it acts as a catch-all route and all traf­fic that is not sent to anoth­er “more spe­cif­ic” des­ti­na­tion is sent here…

With IPv6, remem­ber the spe­cial des­ti­na­tion in this case is ::/0, which means “all routes

How to set a gener­ic route for IPv6 on Lin­ux

$ ip -6 route add 2a02:69e0::/32 via 2a02:69e0:1337::23

Apart from one default route, we might have the need for addi­tion­al more spe­cif­ic routes or spe­cial routes, that are reach­able via a dif­fer­ent path than the default route. The syn­tax is essen­tial­ly the same, just replace the spe­cial route ::/0 with a more spe­cif­ic in the same prefix/length nota­tion that is spe­cif­ic for IPv6.

How to remove a gener­ic route for IPv6 on Lin­ux

$ ip -6 route  del 2a02:69e0::/32 via 2a02:69e0:1337::23

Any route like more specifics and the default route can be removed again using the above stan­dard iproute2 syn­tax. (Click the link if you would like to read the Lin­ux man page (Man­u­al) for detailed syn­tax dec­la­ra­tion and full expla­na­tion.)

How to dis­play the rout­ing table for IPv6 on Lin­ux

$ ip -6 route list
2a02:69e0:1337::/64 dev br0 proto kernel metric 256
fe80::/64 dev br0 proto kernel metric 256
default via fe80::218:19ff:fe55:6a67 dev br0 proto ra metric 1024 expires 1684sec

At last, there is the one sim­ple com­mand to dis­play the Lin­ux IPv6 rout­ing table.

How to do a Ping to ver­i­fy con­nec­tiv­i­ty for IPv6 on Lin­ux

$ ping6 google.com
PING google.com (2a00:1450:400c:c0a::65) 56 data bytes 64 bytes from 2a00:1450:400c:c0a::65: icmp_seq=1 ttl=54 time=12.7 ms 64 bytes from 2a00:1450:400c:c0a::65: icmp_seq=2 ttl=54 time=13.0 ms 64 bytes from 2a00:1450:400c:c0a::65: icmp_seq=3 ttl=54 time=13.0 ms 64 bytes from 2a00:1450:400c:c0a::65: icmp_seq=4 ttl=54 time=12.9 ms

Very sim­i­lar to Microsoft’s imple­men­ta­tion of IPv6 on Win­dows, ping6 is the IPv6 alter­na­tive to the old ping com­mand also for Lin­ux. Ping is used to check if there is end-to-end reach­a­bil­i­ty between your host and a des­ti­na­tion. You can either use an IPv6 address for the des­ti­na­tion, or use a DNS name (it works!) but be aware — when using a DNS name you can­not be 100% sure that IPv6 is used as trans­port instead of IPv4.

Check out the parts about Source Pro­to­col Selec­tion and Source Address Selec­tion to under­stand which Pro­to­col and which address is used when ini­ti­at­ing a con­nec­tion!

How to do a Tracer­oute to ver­i­fy Rout­ing and Path for IPv6 on Lin­ux

$ traceroute6 google.com
traceroute to google.com (2a00:1450:400c:c0a::8b), 30 hops max, 80 byte packets
1 denuecore01.pall.as (2a02:69e0:500::1) 0.717 ms
2 denuecore00-2.pall.as (2a01:4f8:0:e0b0::25) 0.320 ms
3 core12.hetzner.de (2a01:4f8:0:3::39) 0.389 ms
4 2a01:4f8:0:3::fa (2a01:4f8:0:3::fa) 3.560 ms
5 juniper4.ffm.hetzner.de (2a01:4f8:0:3::e) 3.521 ms
6 de-cix10.net.google.com (2001:7f8::3b41:0:1) 40.654 ms
7 2001:4860::1:0:4ca2 (2001:4860::1:0:4ca2) 4.579 ms
8 2001:4860::2:0:a94a (2001:4860::2:0:a94a) 12.977 ms
9 wl-in-x8b.1e100.net (2a00:1450:400c:c0a::8b) 12.736 ms

Tracer­oute is used to see the dif­fer­ent rout­ing (Lay­er 3) hops along the path of a pack­et that is trans­ferred between the local host and a remote des­ti­na­tion. The Lin­ux com­mand is traceroute6 and here is the com­plete man page (Lin­ux Man­u­al) for it. is the IPv6 alter­na­tive to the IPv4 tracer­oute com­mand. You can either use an IPv6 address for the des­ti­na­tion, or use a DNS name (it works!) but be aware — when using a DNS name you can­not be 100% sure that IPv6 is used as trans­port instead of IPv4.

Same as with Ping, check out the parts about Source Pro­to­col Selec­tion and Source Address Selec­tion again to under­stand which Pro­to­col and which address is used when ini­ti­at­ing a con­nec­tion.

How to see live Pack­et Loss using mtr for IPv6 on Lin­ux

My Traceroute mtr IPv6 output

You know what tracer­oute is and why it is so help­ful. The Lin­ux util­i­ty My Tracer­oute (mtr), which is also avail­able for MacOS via home­brew, does a kind of a live tracer­oute and sends pack­ets every sec­ond. You are able to see live where pack­et loss hap­pens or laten­cy increas­es. I love this tool and high­ly rec­om­mend you try it out, for IPv6 and IPv4!

How to dis­able IPv6 on Lin­ux

I can­not rec­om­mend dis­abling IPv6 on Lin­ux and rec­om­mend learn­ing enough about it so you can con­fig­ure and enjoy it. Dis­abling IPv6 might also break some things that are depen­dent on it. Still, in some cas­es you might want or even need to dis­able it.

First, dis­able IPv6 in run­time on your Lin­ux machine:

$ sudo sysctl -w net.ipv6.conf.​default.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.​lo.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.​all.disable_ipv6=1

And depend­ing on your Lin­ux dis­tri­b­u­tion you might need to make sure this is reboot safe by writ­ing it into /etc/sysctl.conf:

net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.all.disable_ipv6 = 1

Now you can reboot your Lin­ux machine into an IPv6 free state.

If you had enough of life with­out IPv6, read on:

How to enable IPv6 on Lin­ux

I’m glad you want to (re-) enable IPv6 on your Lin­ux machine. This should be quick and easy.

First, enable IPv6 in run­time on your Lin­ux machine:

$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
$ sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0

And depend­ing on your Lin­ux dis­tri­b­u­tion you might need to make sure this is reboot safe by writ­ing it into /etc/sysctl.conf:

net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.all.disable_ipv6 = 0

Now you can reboot your Lin­ux machine to be back on full IPv6 sup­port. In case you need to do more con­fig­u­ra­tion, fol­low the pre­vi­ous steps on how to con­fig­ure address­es and rout­ing and how you trou­bleshoot your Lin­ux IPv6 imple­men­ta­tion.

Thank You

Thank you for attend­ing the Orig­i­nal IPv6 Foun­da­tion Mas­ter Class! You can book­mark this site to use it as a quick ref­er­ence in case you need to re-read some­thing and you can share this page to social media and your friends and col­leagues. Stay tuned to this blog for more in-depth sto­ries like this one.

Rec­om­mend­ed Resources for addi­tion­al read­ing

Apart from the links through­out this course I rec­om­mend the fol­low­ing resources for addi­tion­al infor­ma­tion:

  1. The Inter­net Soci­ety (ISOC) IPv6 Por­tal
  2. Test your IPv6 con­nec­tiv­i­ty on test-ipv6.com
  3. The offi­cial IANA list of assigned IPv6 address space is very inter­est­ing
  4. The Google IPv6 deploy­ment sta­tis­tics
  5. The RIPE NCC IPv6 work­ing group and mail­ing list

Book rec­om­men­da­tions on IPv6

I can rec­om­mend the fol­low­ing 3 books (Ama­zon refer­ral links) which I enjoyed read­ing:

This con­cludes IPv6 Foun­da­tion Part 8: IPv6 on Lin­ux of the orig­i­nal IPv6 Foun­da­tion Mas­ter Class.

Pre­vi­ous Part: IPv6 Foun­da­tion Part 7: IPv6 on Win­dows

Next Part: IPv6 Foun­da­tion Part 9: IPv6 on Mac

Share this post

Share on pocket
Share on reddit
Share on facebook
Share on twitter
Share on linkedin
Share on xing