The following patch adds the ability to configure a specified global address as the default next hop address for an IPv6-enabled interface. By default, apparently, radvd advertises the router using the link address of the router, and this won't work in some cases (perhaps all) for talking with the rest of the IPv6 world. Debian allows the specification of an IPv6 gateway within the approrpiate per interface section of /etc/network/interfaces (iface eth0 inet6 static, etc) but no such facility apparently exists in Gentoo. This is admitedly crude, and I'm sure it can be improved on, but it solves the problem. --- net.eth0.orig 2003-11-12 11:07:46.000000000 -0600 +++ net.eth0 2003-11-12 11:37:40.000000000 -0600 @@ -31,6 +31,7 @@ iface_IFACE="$(eval echo \$\{iface_${iface}\})" dhcpcd_IFACE="$(eval echo \$\{dhcpcd_${iface}\})" inet6_IFACE="$(eval echo \$\{inet6_${iface}\})" + inet6gw_IFACE="$(eval echo \$\{inet6gw_${iface}\})" alias_IFACE="$(eval echo \$\{alias_${iface}\})" status_IFACE="$(ifconfig | gawk -v IFACE="${iface}" '/Link/ { if ($1 == IFACE) print "up" }')" vlans="$(eval echo \$\{iface_${IFACE}_vlans\})" @@ -109,6 +110,11 @@ do ebegin " ${IFACE} inet6 add ${x}" /sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null + if [ -n "${inet6gw_IFACE}" ] + then + ebegin " Adding inet6 gateway ${inet6gw_IFACE}" + route add -A inet6 ::/0 gw ${inet6gw_IFACE} + fi eend 0 done save_options "inet6" "${inet6_IFACE}"
A slightly more elegant version of the same patch: --- net.eth0.orig 2003-11-12 11:07:46.000000000 -0600 +++ net.eth0 2003-11-12 12:14:48.000000000 -0600 @@ -31,6 +31,7 @@ iface_IFACE="$(eval echo \$\{iface_${iface}\})" dhcpcd_IFACE="$(eval echo \$\{dhcpcd_${iface}\})" inet6_IFACE="$(eval echo \$\{inet6_${iface}\})" + inet6gw_IFACE="$(eval echo \$\{inet6gw_${iface}\})" alias_IFACE="$(eval echo \$\{alias_${iface}\})" status_IFACE="$(ifconfig | gawk -v IFACE="${iface}" '/Link/ { if ($1 == IFACE) print "up" }')" vlans="$(eval echo \$\{iface_${IFACE}_vlans\})" @@ -111,6 +112,13 @@ /sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null eend 0 done + if [ -n "${inet6gw_IFACE}" ] + then + ebegin " Adding ${IFACE} inet6 gateway ${inet6gw_IFACE}" + route add -A inet6 ::/0 gw ${inet6gw_IFACE} + save_options "inet6gw" "${inet6gw_IFACE}" + eend 0 + fi save_options "inet6" "${inet6_IFACE}" fi
The link-scope gateway address will work. The patch isn't necessary. Failure to include a mask spec in the inet6_eth0 address caused an improper entry in the ipv6 routing table, so the problem I was trying to solve was a config problem on my end. It might be helpful to include a reminder to this effect in /etc/conf.d/net. Coulda saved me some time.
This suggestion is still valid for those of us who are using statically assigned IPv6 configurations. See bugs 6175, 34653.
wrangler
still not sure about this bug. currently i have a hack in my /etc/conf.d/net: inet6_eth0=( "2001:470:1f01:261::2/64" ) routes_eth0=( "default gw 192.168.6.1" "-A inet6 default gw 2001:470:1f01:261::1" ) there's got to be a better way.
I agree. I've got a fix in CVS to detect inet6 addresses in routes - so the below works :) routes_eth0=( "default gw 192.168.6.1" "default gw 2001:470:1f01:261::1" )
*** Bug 59922 has been marked as a duplicate of this bug. ***
Fixed in baselayout-1.11.7-r1