iproute2: ip: RTNETLINK answers: Invalid argument

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

Symptoms

Example:

# ip -6 route add default via 2002:4340:3:2b12:FF:FF:FF:FF  dev eth0
RTNETLINK answers: Invalid argument

We cannot add a route whose gateway is an invalid IP address.
The network address is always the first IP address in a subnet.

In the above example, the first four blocks 2002:4340:3:2b12 represent the IP, and the next four blocks FF:FF:FF:FF represent the subnet.
The first IP in that block would be: 2002:4340:3:2b12:0:0:0:0.

Thus:

# ip -6 route add default via 2002:4340:3:2b12:0:0:0:0  dev eth0