[Originally posted Mar 18, 2012 4:40 AM by Antti Uitto [ updated Mar 18, 2012 5:34 AM ]]
In today’s story we are attached to a local area network (LAN) with a bunch of IPv6-enabled hosts. We do not necessarily need to have a valid IPv6 router present, since we are just fooling around in this local segment, pinging each other and testing connections.
IPv6 is a protocol meant serve a worldwide network and it’s numerous hosts. There are however addresses called link-local in each IPv6-enabled host. This link-local address is generated automatically by your computer’s operating system and it is valid for connectivity between hosts that can see each other in L2, even in absence of IPv6 routers. These addresses are also used by IPv6’s Neighbor Discovery Protocol.
If your operating system is from this millenia, it should have IPv6 available. But let’s check.
user@host:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:13:d4:3e:dd:b3 inet addr:192.168.1.140 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::213:d4ff:fe3e:ddb3/64 Scope:Link lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host
Mine seems to have. Note that both of my IPv6 addresses are such that they would not help me if I wanted connectivity in the global Internet. They are valid inside my own LAN segment.
Linux ping6 (http://linux.die.net/man/8/ping6) Windows ping -6 Mac OSX ping6 Cisco router ping ipv6
I pinged with my Linux box to my own localhost address
user@host:~$ ping6 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.036 ms 64 bytes from ::1: icmp_seq=2 ttl=64 time=0.044 ms
Next I will check if I can see any IPv6 neighbors
user@host:~$ ip -6 neighbor user@host:~$
There was no-one there.
I will attempt to summon other hosts to become visible by pingin to address ff02::1 which is ip6-allnodes. All other IPv6 hosts should respond to this call.
user@host:~$ ping6 -I eth0 ff02::1 PING ff02::1(ff02::1) from fe80::213:d4ff:fe3e:ddb3 eth0: 56 data bytes 64 bytes from fe80::213:d4ff:fe3e:ddb3: icmp_seq=1 ttl=64 time=0.051 ms 64 bytes from fe80::ba8d:12ff:fe03:474c: icmp_seq=1 ttl=64 time=70.8 ms (DUP!) 64 bytes from fe80::1636:5ff:fe19:2392: icmp_seq=1 ttl=64 time=204 ms (DUP!)
Note! You will need to insert the name of the interface in the ping command. ( -I eth0 in this case)
After pinging allnodes-address I check again my neighbors:
user@host:~$ ip -6 neigh fe80::ba8d:12ff:fe03:474c dev eth0 lladdr b8:8d:12:03:47:4c REACHABLE fe80::1636:5ff:fe19:2392 dev eth0 lladdr 14:36:05:19:23:92 STALE fe80::a667:6ff:fe87:6b71 dev eth0 lladdr a4:67:06:87:6b:71 STALE
I ping one of them directly using the same syntax:
user@host:~$ ping6 -I eth0 fe80::ba8d:12ff:fe03:474c PING fe80::ba8d:12ff:fe03:474c(fe80::ba8d:12ff:fe03:474c) from fe80::213:d4ff:fe3e:ddb3 eth0: 56 data bytes 64 bytes from fe80::ba8d:12ff:fe03:474c: icmp_seq=1 ttl=64 time=22.9 ms 64 bytes from fe80::ba8d:12ff:fe03:474c: icmp_seq=2 ttl=64 time=40.9 ms
And the ssh into the neighbor:
user@host:~$ ssh fe80::ba8d:12ff:fe03:474c%eth0 Password: Last login: Sun Mar 18 13:14:22 2012 from host.local Another-host:~ ap$ Another-host:~ ap$
Note! When connecting with link-local addresses you will need to specify the interface for the connection. In this case it is given as %eth0 in the end of the neighbors link-local address.
Carla Schroder: Linux Networking Cookbook