Home Networking/Computing Tips/Tricks IPv6 Linux Command Line Examples
IPv6 Linux Command Line Examples PDF Print Email
Written by Andrew Walding   
Sunday, 07 August 2011 16:14

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

Let's start with some simple ones. 

To verify you have IPv6 running:

csi@csi-virtual-machine:~$ cat /proc/net/if_inet6

fe80000000000000020c29fffef704ce 02 40 20 80     eth0
00000000000000000000000000000001 01 80 10 80       lo

First, let's check the IFCONFIG -A from the Terminal Window:

ifconfig_-a_linuxcap

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

The "netstat -r -6" command displays the routing table in your computer:

netstat_-r_-6_linuxcap

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:

csi@csi-virtual-machine:~$ netstat -ps -6

Ip6:

  23857 total packets received

  0 incoming packets discarded

  23857 incoming packets delivered

  0 forwarded

  5841 requests sent out

  1 dropped because of missing route

  23793 incoming multicast packets

  5780 outgoing multicast packets

  Ip6InOctets: 4025297

  Ip6OutOctets: 546152

  Ip6InMcastOctets: 4015659

  Ip6OutMcastOctets: 536762

Icmp6:

  84 ICMP messages received

  0 input ICMP message failed.

  7 ICMP messages sent

  ICMP input histogram:

  group member responses: 84

  ICMP output histogram:

    router solicits: 3

    neighbor solicits: 1

    Icmp6OutMLDv2Reports: 3

    Icmp6InType131: 84

    Icmp6OutType133: 3

    Icmp6OutType135: 1

    Icmp6OutType143: 3

Udp6:

  23524 packets received

  0 packets to unknown port received.

  0 packet receive errors

  5770 packets sent

UdpLite6:

Tcp:

  123 active connections openings

  9380 passive connection openings

  62 failed connection attempts

  28 connection resets received

  1 connections established

  245471 segments received

  301392 segments send out

  908 segments retransmited

  0 bad segments received.

  31 resets sent

csi@csi-virtual-machine:~$


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_inet6


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.

Last Updated on Sunday, 07 August 2011 17:16
 

Comments  

 
0 #3 nitin 2012-04-09 23:20
thanks Andrew !!!
Quote
 
 
0 #2 Andrew Walding 2012-04-09 08:54
Nitin, the examples in this article assume the system has a single IPv6 interface. If the system had multiple interfaces, you could adjust these default routes if you wanted to.
Quote
 
 
0 #1 nitin 2012-04-09 08:01
but in all the outputs why there is duplicate entries of default route (::/0) ??
Quote
 

Add comment


Security code
Refresh

Copyright © 2012 CellStream Intranet. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 

Login Form

Please Log in:



Visitor Map

site statistics

Testimonials