Trying to add IPv6 route returns an RTNETLINK answers error

centos5ipv6routing

On CentOS 5.10 I'm trying to add static IPv6 route via external GW (6::a0c:34a) as follows:

ip -6 route add 12::/64 via 6::a0c:34a dev eth1

The above returns a RTNETLINK answers: Invalid argument error.

Now if I try the same but change the GW addr to 2006::a0c:34a

ip -6 route add 12::/64 via 2006::a0c:34a dev eth1

everything works fine.

Any ideas?

Best Answer

You cannot add a route whose gateway is an invalid IP address. If you try, you receive the Invalid argument error.

(But you can add routes to invalid IP address ranges. This is to support bogon handling, blackholing, and various other oddball scenarios that you should not normally have to deal with.)

To resolve this problem, renumber your network so that all hosts have valid IPv6 addresses.