|
|
Parent Directory
| Linux IPv6 Basics
Brett Lee
=============================
Reference:
http://tldp.org/HOWTO/Linux+IPv6-HOWTO
If you are learning IPv6, you may want to check out the support
of it in both Solaris 10 and the various BSDs.
Ok, here we go.
1. Displaying the routing table:
You might think it would be `netstat -rn`, or `route -n`, but
actually you need to (for now) use the `ip command`:
[root@linux ~]# ip -6 route help
Usage: ip route { list | flush } SELECTOR
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
ip route { add | del | change | append | replace | monitor } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
[ mpath MP_ALGO ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]
[ rtt NUMBER ] [ rttvar NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
FLAGS := [ equalize ]
MP_ALGO := { rr | drr | random | wrandom }
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
[root@linux ~]#
OK, that iss TMI. Here's how you do it: :)
[root@linux ~]# ip -6 route show
2001::/64 dev eth1 proto kernel metric 256 expires 2592154sec mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev eth1 metric 256 expires 20023994sec mtu 1500 advmss 1440 hoplimit 4294967295
default via fe80::203:baff:fee8:36f1 dev eth1 proto kernel metric 1024 expires 156sec mtu 1500 advmss 1440 hoplimit 4294967295
default via fe80::203:baff:fee8:36f2 dev eth1 proto kernel metric 1024 expires 3593sec mtu 1500 advmss 1440 hoplimit 4294967295
[root@linux ~]#
How about just the routes on eth1?
[root@linux ~]# ip -6 route show dev eth1
2001::/64 proto kernel metric 256 expires 2592152sec mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 metric 256 expires 20023773sec mtu 1500 advmss 1440 hoplimit 4294967295
default via fe80::203:baff:fee8:36f1 proto kernel metric 1024 expires 166sec mtu 1500 advmss 1440 hoplimit 4294967295
default via fe80::203:baff:fee8:36f2 proto kernel metric 1024 expires 3590sec mtu 1500 advmss 1440 hoplimit 4294967295
[root@linux ~]#
How about our neighbors?
[root@linux ~]# ip -6 neigh show
fe80::203:baff:fee8:36f1 dev eth1 lladdr 00:03:ba:e8:36:f1 router STALE
fe80::203:baff:fee8:36f2 dev eth1 lladdr 00:03:ba:e8:36:f2 router STALE
[root@linux ~]#
Only those on eth1?
[root@linux ~]# ip -6 neigh show dev eth1
fe80::203:baff:fee8:36f1 lladdr 00:03:ba:e8:36:f1 router STALE
fe80::203:baff:fee8:36f2 lladdr 00:03:ba:e8:36:f2 router STALE
[root@linux ~]#
Let's ping someone:
[root@linux ~]# ping6 fe80::203:baff:fee8:36f1
connect: Invalid argument
[root@linux ~]#
Hmm, guess it doesn't know the interface (required for LL addresses):
[root@linux ~]# ping6 -I eth1 fe80::203:baff:fee8:36f1
PING fe80::203:baff:fee8:36f1(fe80::203:baff:fee8:36f1) from
fe80::230:48ff:fe52:7f6e eth1: 56 data bytes
64 bytes from fe80::203:baff:fee8:36f1: icmp_seq=0 ttl=255 time=0.363 ms
64 bytes from fe80::203:baff:fee8:36f1: icmp_seq=1 ttl=255 time=0.189 ms
--- fe80::203:baff:fee8:36f1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1010ms
rtt min/avg/max/mdev = 0.189/0.276/0.363/0.087 ms, pipe 2
[root@linux ~]#
Kinda lonely, let's ping the multicast address and find some neighbors:
[root@linux ~]# ping6 -I eth1 ff02::1
PING ff02::1(ff02::1) from fe80::230:48ff:fe52:7f6e eth1: 56 data bytes
64 bytes from fe80::230:48ff:fe52:7f6e: icmp_seq=0 ttl=64 time=0.061 ms
64 bytes from fe80::203:baff:fee8:36f1: icmp_seq=0 ttl=255 time=0.512 ms (DUP!)
64 bytes from fe80::203:baff:fee8:36f2: icmp_seq=0 ttl=255 time=0.574 ms (DUP!)
64 bytes from fe80::204:76ff:feef:2970: icmp_seq=0 ttl=128 time=0.637 ms (DUP!)
64 bytes from fe80::21b:24ff:fe0c:c4f3: icmp_seq=0 ttl=255 time=0.700 ms (DUP!)
64 bytes from fe80::230:48ff:fe52:e696: icmp_seq=0 ttl=64 time=0.704 ms (DUP!)
64 bytes from fe80::21b:24ff:fe5b:da24: icmp_seq=0 ttl=255 time=0.708 ms (DUP!)
64 bytes from fe80::230:48ff:fe53:2cf4: icmp_seq=0 ttl=64 time=0.735 ms (DUP!)
64 bytes from fe80::230:48ff:fe53:2ef6: icmp_seq=0 ttl=64 time=0.906 ms (DUP!)
64 bytes from fe80::230:48ff:fe54:c298: icmp_seq=0 ttl=64 time=0.913 ms (DUP!)
64 bytes from fe80::230:48ff:fe53:c218: icmp_seq=0 ttl=64 time=0.917 ms (DUP!)
64 bytes from fe80::203:baff:feea:8f55: icmp_seq=0 ttl=255 time=0.921 ms (DUP!)
64 bytes from fe80::21e:68ff:fe9b:40a3: icmp_seq=0 ttl=255 time=0.924 ms (DUP!)
64 bytes from fe80::230:48ff:fe52:7fc2: icmp_seq=0 ttl=64 time=0.928 ms (DUP!)
64 bytes from fe80::230:48ff:fe53:2cfe: icmp_seq=0 ttl=64 time=1.15 ms (DUP!)
64 bytes from fe80::230:48ff:fe52:7fce: icmp_seq=0 ttl=64 time=1.16 ms (DUP!)
64 bytes from fe80::230:48ff:fe53:c386: icmp_seq=0 ttl=64 time=1.65 ms (DUP!)
--- ff02::1 ping statistics ---
2 packets transmitted, 2 received, +32 duplicates, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.045/0.582/1.654/0.347 ms, pipe 2
[root@linux ~]#
Ahh, much better:
[root@linux ~]# ip -6 neigh show dev eth1
fe80::203:baff:feea:8f55 lladdr 00:03:ba:ea:8f:55 REACHABLE
fe80::203:baff:fee8:36f1 lladdr 00:03:ba:e8:36:f1 router REACHABLE
fe80::230:48ff:fe53:2ef6 lladdr 00:30:48:53:2e:f6 REACHABLE
fe80::21e:68ff:fe9b:40a3 lladdr 00:1e:68:9b:40:a3 REACHABLE
fe80::204:76ff:feef:2970 lladdr 00:04:76:ef:29:70 REACHABLE
fe80::21b:24ff:fe5b:da24 lladdr 00:1b:24:5b:da:24 REACHABLE
fe80::203:baff:fee8:36f2 lladdr 00:03:ba:e8:36:f2 router REACHABLE
fe80::230:48ff:fe53:2cfe lladdr 00:30:48:53:2c:fe REACHABLE
fe80::230:48ff:fe53:c218 lladdr 00:30:48:53:c2:18 REACHABLE
fe80::230:48ff:fe52:7fc2 lladdr 00:30:48:52:7f:c2 REACHABLE
fe80::230:48ff:fe54:c298 lladdr 00:30:48:54:c2:98 REACHABLE
fe80::230:48ff:fe53:c386 lladdr 00:30:48:53:c3:86 REACHABLE
fe80::230:48ff:fe52:e696 lladdr 00:30:48:52:e6:96 REACHABLE
fe80::230:48ff:fe52:7fce lladdr 00:30:48:52:7f:ce REACHABLE
fe80::21b:24ff:fe0c:c4f3 lladdr 00:1b:24:0c:c4:f3 REACHABLE
fe80::230:48ff:fe53:2cf4 lladdr 00:30:48:53:2c:f4 REACHABLE
[root@linux ~]#
How about we ping a global address
[root@linux ~]# ping6 2002::203:baff:fee8:36f3
PING 2002::203:baff:fee8:36f3(2002::203:baff:fee8:36f3) 56 data bytes
64 bytes from 2002::203:baff:fee8:36f3: icmp_seq=0 ttl=255 time=0.376 ms
64 bytes from 2002::203:baff:fee8:36f3: icmp_seq=1 ttl=255 time=0.385 ms
--- 2002::203:baff:fee8:36f3 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1008ms
rtt min/avg/max/mdev = 0.376/0.380/0.385/0.020 ms, pipe 2
[root@linux ~]#
And traceroute?
[root@linux ~]# traceroute6 2002::203:baff:fee8:36f3
traceroute to 2002::203:baff:fee8:36f3 (2002::203:baff:fee8:36f3), 30 hops max, 40 byte packets
1 2002::203:baff:fee8:36f3 (2002::203:baff:fee8:36f3) 0.576 ms 0.456 ms 0.413 ms
[root@linux ~]#
And tracepath?
[root@linux ~]# tracepath6 2002::203:baff:fee8:36f3
1?: [LOCALHOST] pmtu 1500
1: 2002::203:baff:fee8:36f3 1. 54ms reached
Resume: pmtu 1500 hops 1 back 1
[root@linux ~]#
For tcpdump, use 'ip6', 'icmp6', or 'proto ipv6':
icmp6: filters native ICMPv6 traffic
ip6: filters native IPv6 traffic (including ICMPv6)
proto ipv6: filters tunneled IPv6-in-IPv4 traffic
[root@linux ~]# tcpdump -n -s 0 -i eth1 ip6
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
[root@linux ~]# tcpdump -n -s 0 -i eth1 icmp6
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
[root@linux ~]# tcpdump -n -s 0 -i eth1 proto ipv6
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
[root@linux ~]#
Anyway, those are some Linux basics with IPv6.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In an effort to provide a service of value to the open source community, I've put together this website that containing many of my notes and references.
This website is not authoritative and it is certainly not without errors; it is a work in progress.
In addition to my contributions you will also find the work of others. Where the work is not mine, I have tried to indicate that, and to reference the source of the work: by citing the original author, retaining the authors' name and license wherever present, or by placing the work in a suitably named URL containg /external/ in the path. If you find any work here that should not be publically available, please send me a note and it will be removed.
As for my contributions, you are free to use any of *MY* notes or code from this website unless specifically instructed otherwise.
Brett Lee, Ph.D., President & CEO
Everything Penguin, Inc.
|
|
|