Selection 004

IPv6 Linux Command Line Examples

Check out these additional IPv6 Resources:
Our IPv6 overview course at Udemy
Our IPv6 Custom Profiles for Wireshark
Our IPv6 classes at the Online School

Here are some great Linux command line entries you can make to examine and configure IPv6 (assuming your version of Linux ipconfg does so).

Let’s start with some simple ones. 

To verify you have IPv6 running:

cat /proc/net/if_inet6
awalding@aw-Satellite:~$ cat /proc/net/if_inet6
2605600023c08e00000000000000000e 03 80 00 00 wlp7s0
2605600023c08e00352c3f0393ea14e3 03 40 00 01 wlp7s0
2605600023c08e00f69bd8020a75a6d1 03 40 00 00 wlp7s0
fe80000000000000d6c550bd213651a9 03 40 20 80 wlp7s0
00000000000000000000000000000001 01 80 10 80 lo

Let’s check the IFCONFIG -A from the Terminal Window:

ifconfig -a
awalding@aw-Satellite:~$ ifconfig -a
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:fc:b3:a6:a2 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp8s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 2c:60:0c:0c:97:bc txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1373 bytes 124777 (124.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1373 bytes 124777 (124.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vboxnet0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vboxnet1: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 0a:00:27:00:00:01 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vboxnet2: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 0a:00:27:00:00:02 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:2b:67:64 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:2b:67:64 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp7s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.30 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2605:6000:23c0:8e00::e prefixlen 128 scopeid 0x0<global>
inet6 2605:6000:23c0:8e00:352c:3f03:93ea:14e3 prefixlen 64 scopeid 0x0<global>
inet6 2605:6000:23c0:8e00:f69b:d802:a75:a6d1 prefixlen 64 scopeid 0x0<global>
inet6 fe80::d6c5:50bd:2136:51a9 prefixlen 64 scopeid 0x20<link>
ether 34:de:1a:54:08:ee txqueuelen 1000 (Ethernet)
RX packets 102479 bytes 113740227 (113.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24614 bytes 4011208 (4.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 You can see my machine is running “Dual Stack” since it has both IPv4 and IPv6.

The output is so long.  Try this:

ip -6 a s wlp7s0
awalding@aw-Satellite:~$ ip -6 a s wlp7s0
3: wlp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2605:6000:23c0:8e00::e/128 scope global dynamic noprefixroute
valid_lft 2996sec preferred_lft 1196sec
inet6 2605:6000:23c0:8e00:352c:3f03:93ea:14e3/64 scope global temporary dynamic
valid_lft 580017sec preferred_lft 61289sec
inet6 2605:6000:23c0:8e00:f69b:d802:a75:a6d1/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 586884sec preferred_lft 586884sec
inet6 fe80::d6c5:50bd:2136:51a9/64 scope link noprefixroute
valid_lft forever preferred_lft forever

The following command displays the routing table in your Linux computer (be patient it takes a bit):

netstat -r -6

Selection 004 

We can clearly see the IPv6 Routing table with the Link Local addresses and the IPv6 Multicast groups.

Let’s see if there has been any general IPv6 traffic on the interfaces.  You can do this with a “netstat -ps -6” command:

awalding@aw-Satellite:~$ netstat -ps -6
Ip6:
6034 total packets received
0 incoming packets discarded
6034 incoming packets delivered
0 forwarded
826 requests sent out
144 dropped because of missing route
5998 incoming multicast packets
819 outgoing multicast packets
Ip6InOctets: 1228069
Ip6OutOctets: 127896
Ip6InMcastOctets: 1223964
Ip6OutMcastOctets: 127469
Ip6InNoECTPkts: 6034
Icmp6:
382 ICMP messages received
0 input ICMP message failed
749 ICMP messages sent
ICMP input histogram:
group member queries: 32
router advertisement: 323
neighbour advertisement: 25
Icmp6InMLDv2Reports: 2
ICMP output histogram:
router solicits: 1
neighbor solicits: 4
Icmp6OutMLDv2Reports: 744
Icmp6InType130: 32
Icmp6InType134: 323
Icmp6InType136: 25
Icmp6InType143: 2
Icmp6OutType133: 1
Icmp6OutType135: 4
Icmp6OutType143: 744
Udp6:
5648 packets received
0 packets to unknown port received
0 packet receive errors
73 packets sent
UdpLite6:
Tcp:
290 active connection openings
0 passive connection openings
14 failed connection attempts
43 connection resets received
15 connections established
8333 segments received
8066 segments sent out
66 segments retransmitted
0 bad segments received
406 resets sent

Pretty cool.

Another way to see the IPv6 Route Table is using the “route” command. The command-line Route tool enables entries in the local IPv4 and IPv6 routing tables, such routes can direct  network traffic to local, WAN and internet network map.

Here is an IPv6 route test example:

route -A inet6

Selection 003

 

How about PING and TRACE ROUTE for IPv6?  Sure.  Here is how you Ping in IPv6:

csiipv6@csi-virtual-machine:~$ ping6 ::1

PING ::1(::1) 56 data bytes

64 bytes from ::1: icmp_seq=1 ttl=255 time=0.743 ms

64 bytes from ::1: icmp_seq=2 ttl=255 time=0.027 ms

64 bytes from ::1: icmp_seq=3 ttl=255 time=0.014 ms

64 bytes from ::1: icmp_seq=4 ttl=255 time=0.011 ms

64 bytes from ::1: icmp_seq=5 ttl=255 time=0.011 ms

64 bytes from ::1: icmp_seq=6 ttl=255 time=0.011 ms

64 bytes from ::1: icmp_seq=7 ttl=255 time=0.012 ms

64 bytes from ::1: icmp_seq=8 ttl=255 time=0.013 ms

64 bytes from ::1: icmp_seq=9 ttl=255 time=0.010 ms

64 bytes from ::1: icmp_seq=10 ttl=255 time=0.011 ms

64 bytes from ::1: icmp_seq=11 ttl=255 time=0.011 ms

64 bytes from ::1: icmp_seq=12 ttl=255 time=0.014 ms

64 bytes from ::1: icmp_seq=13 ttl=255 time=0.011 ms

64 bytes from ::1: icmp_seq=14 ttl=255 time=0.025 ms

64 bytes from ::1: icmp_seq=15 ttl=255 time=0.014 ms

64 bytes from ::1: icmp_seq=16 ttl=255 time=0.019 ms

64 bytes from ::1: icmp_seq=17 ttl=255 time=0.010 ms

64 bytes from ::1: icmp_seq=18 ttl=255 time=0.025 ms

64 bytes from ::1: icmp_seq=19 ttl=255 time=0.020 ms

64 bytes from ::1: icmp_seq=20 ttl=255 time=0.015 ms

^C

— ::1 ping statistics —

20 packets transmitted, 20 received, 0% packet loss, time 18998ms

rtt min/avg/max/mdev = 0.010/0.051/0.743/0.158 ms

 

Here are the ping6 options:

csi@csi-virtual-machine:~$ ping6 -?

Usage: ping6 [-LUdfnqrvVaAD] [-c count] [-i interval] [-w deadline]

             [-p pattern] [-s packetsize] [-t ttl] [-I interface]

             [-M pmtudisc-hint] [-S sndbuf] [-F flowlabel] [-Q tclass]

             [[-N nodeinfo-option] …]

             [hop1 …] destination

 

And here is the Trace route command:

csiipv6@csi-virtual-machine:~$ tracert6 ::1

traceroute to ::1 (::1) from ::1, 30 hops max, 60 byte packets

1 csi-virtual-machine (::1) 0.006 ms 0.004 ms 0.003 ms

 

 

Here are the Tracert options:

csi@csi-virtual-machine:~$ tracert6 -h

  -A  send TCP ACK probes
  -d  enable socket debugging
  -E  set TCP Explicit Congestion Notification bits in TCP packets
  -f  specify the initial hop limit (default: 1)
  -g  insert a route segment within a “Type 0” routing header
  -h  display this help and exit
  -I  use ICMPv6 Echo Request packets as probes
  -i  force outgoing network interface
  -l  display incoming packets hop limit
  -m  set the maximum hop limit (default: 30)
  -N  perform reverse name lookups on the addresses of every hop
  -n  don’t perform reverse name lookup on addresses
  -p  override destination port
  -q  override the number of probes per hop (default: 3)
  -r  do not route packets
  -S  send TCP SYN probes
  -s  specify the source IPv6 address of probe packets
  -t  set traffic class of probe packets
  -U  send UDP probes (default)
  -V  display program version and exit
  -w  override the timeout for response in seconds (default: 5)
  -z  specify a time to wait (in ms) between each probes (default: 0)

 

There is something known as Path MTU or PMTU in IPv6.  You can check Path MTU by doing a Path Ping in Windows, but there is no such command in Linux.

Our other favorite that allegedly does the Path Ping equivelant is “mtr”.  Here is the MTR usage:

usage: mtr [-hvrwctglspniu46] [–help] [–version] [–report]
                [–report-wide] [–report-cycles=COUNT] [–curses] [–gtk]
                [–raw] [–split] [–no-dns] [–address interface]
                [–psize=bytes/-s bytes]
                [–report-wide|-w] [-u]
                [–interval=SECONDS] HOSTNAME [PACKETSIZE]

Here is an example output of MTR for IPv4 (you have to type Control-C to stop MTR):

My traceroute  [v0.80]
csi-virtual-machine (0.0.0.0)                          Sun Aug  7 18:11:17 2011
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 192.168.1.1                       0.0%    15    0.9   1.0   0.8   2.3   0.4

You can see below that it works for IPv6 as well:

My traceroute  [v0.80]
csi-virtual-machine (::)                               Sun Aug  7 18:13:49 2011
Resolver error: No error returned but no answers given. of fields   quit
                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. ::1                               0.0%    11    0.0   0.0   0.0   0.1   0.0

We hope this helps you get started on IPv6 on your local Linux machine. 

I hope you find this article and its content helpful.  Comments are welcomed below.  If you would like to see more articles like this, please support us by clicking the patron link where you will receive free bonus access to courses and more, or simply buying us a cup of coffee!, and all comments are welcome! 

Leave a Comment

Contact Us Here


Please verify.
Validation complete :)
Validation failed :(
 
Your contact request has been received. We usually respond within an hour, but please be patient. We will get back to you very soon.