Trying to add IPv6 route returns an RTNETLINK answers error

b1tH1de0 asked:

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?

My 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.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.