This is a quick and dirty guide to getting started with IPv6 on Linux. It doesn't go into any complex configuration, but it should be enough to start testing software (which is what I've been using it for). Keep in mind that most jdk's older than 1.6 are horribly broken when it comes to ipv6 on linux, so you should use a newer jdk if you require ipv6 support. Most distros have IPv6 enabled by default even if you don't realize it. The output of "ip -6 addr" should show something similar to:
# ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 fe80::221:5eff:fe26:a934/64 scope link
valid_lft forever preferred_lft forever
If you see any lines starting with inet6 then your system is IPv6 enabled. You should see at a minimum the 'lo' interface with an ipv6 address of ::1. This is the equivilant of '127.0.0.1' in ipv4. It's also very likely you'll see an inet6 address that begins with 'fe80' on one or more interfaces. This is a link-local address which is automatically assigned when the interface is brought up. We want to assign a global address to the interface. To do this use the command
ip -6 addr add 3ffe:ffff:100:f101::1 dev eth0
Obviously, you should substitute your desired address and interface. One nice trick if you're not actually connected to an ipv6 router and just want to do testing is to use the 'dummy0' interface. This will create an interface called dummy0 that functions exactly like a real interface. Here's what 'ip -6 addr' shows on my system after assigning an address to dummy0.
$ ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
12: dummy0: <BROADCAST,NOARP> mtu 1500
inet6 3ffe:ffff:100:f101::1/128 scope global
valid_lft forever preferred_lft forever
At this point you should be able to do a
$ ping 3ffe:ffff:100:f101::1
PING 3ffe:ffff:100:f101::1(3ffe:ffff:100:f101::1) 56 data bytes
64 bytes from 3ffe:ffff:100:f101::1: icmp_seq=1 ttl=64 time=0.034 ms
64 bytes from 3ffe:ffff:100:f101::1: icmp_seq=2 ttl=64 time=0.042 ms
--- 3ffe:ffff:100:f101::1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
Now, verify the output of 'ip -6 route' has a route for ff00::/8 (ipv6 multicast route) which points at your desired interface. Something like this:
$ ip -6 route
3ffe:ffff:100:f101::1 dev dummy0 metric 256 expires 21312777sec mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev dummy0 metric 256 expires 21312777sec mtu 1500 advmss 1440 hoplimit 4294967295
ff00::/8 dev dummy0 metric 256 expires 21312777sec mtu 1500 advmss 1440 hoplimit 429496
Now, you should be fully configured. To verify, you can use a couple of classes which are included with jgroups. Here are the commands to execute in separate terminals:
java -cp ./jgroups.jar org.jgroups.tests.McastReceiverTest -bind_addr 3ffe:ffff:0100:f101::1 -mcast_addr ff0e::1:2:3 -port 5555
java -cp ./jgroups.jar org.jgroups.tests.McastSenderTest -bind_addr 3ffe:ffff:0100:f101::1 -mcast_addr ff0e::1:2:3 -port 5555
Now, typing a message in the Sender terminal should send a message to the Receiver. If so, congratulations, everything is working.
Comments