gentoo configure ipv6 and ipv4 dual stack

Due to lack of documentation I had a bit of trouble getting both default gateways to work. It is vital that both gateways are on a separate line in the config file. You must also use the CIDR notation for ipv4 too. You cannot mix the netmask and CIDR entries. This is my config file which works without a problem. The only think I have changed are the IP addresses I used the ones reserved for documentation.

 

/etc/conf.d/net

 

###############################################################################################
config_eth0="198.51.100.2/24 2001:db8::2/48"
###############################################################################################
routes_eth0="default via 198.51.100.1
default via 2001:db8::2"
###############################################################################################

You also need to make sure that you kernel supports ipv6 and you need iproute2. To check this run

# ip -6 addr show lo
1: lo: mtu 16436
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
(The above lines show things are working)

If you can see your loopback address ::1 you should be good to restart your network card to apply the new configuration. Or if you needed to recompile you kernel a reboot may be necessary. After that is done you can test the ipv6 connection with icmp6.

# ping6 -n google.com
PING google.com(2a00:1450:4008:c01::8b) 56 data bytes
64 bytes from 2a00:1450:4008:c01::8b: icmp_seq=1 ttl=50 time=29.8 ms
64 bytes from 2a00:1450:4008:c01::8b: icmp_seq=2 ttl=50 time=28.5 ms
64 bytes from 2a00:1450:4008:c01::8b: icmp_seq=3 ttl=50 time=28.3 ms
64 bytes from 2a00:1450:4008:c01::8b: icmp_seq=4 ttl=50 time=28.4 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3009ms
rtt min/avg/max/mdev = 28.352/28.779/29.817/0.637 ms

That looks good we received an answer from google via ipv6. Another thing you should know is that you will need to create iptables rules for ip6tables. In the standard configuration all packets will be accepted which you might not want (default policy accept). Now you could think about reconfiguring your web services to use your ipv6 connection. You may also need to emerge your software with the ipv6 use flag to make use of the new connection. A useful tool for calculating ipv6 networks and subnets is net-misc/sipcalc Sipcalc is an advanced console-based IP subnet calculator. Have fun with your new ipv6 connection :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>