ipv6 route add issue while adding a particular nexthop address

1

// IPv6 route add issue in kernel for a particular subnet...(1000::)...why?

// Adding ipv6 route :

sudo /sbin/ip -6 route add 1005:1006:1007:1008::1/64 via 1001:1002:1003:1004::1 dev eth0

RTNETLINK answers: No route to host

// but for OTHER CASES

sudo /sbin/ip -6 route add 2000::/3  dev eth0

sudo /sbin/ip -6 route add 1005:1006:1007:1008::1/64 via 2000:: dev eth0

// Now this is working..why so? please throw some lights on that issue..Thanks

Subhajit

Posted 2014-10-31T12:12:01.567

Reputation: 13

Please include the output of ip addr. Sounds like your gateway isn’t on the same network. – Daniel B – 2014-10-31T12:13:52.593

Answers

1

For a start you are using reserved address space, which you shouldn't use. Either get address space from your ISP or generate your own ULA prefix (I can recommend SixXS).

The reason that your first command doesn't work is that your gateway is on a different network than your own IP address. You need to reach your gateway to reach off-link destinations, but your gateway is off-link itself. That can never work.

The address 1005:1006:1007:1008::1/64 is part of the 1005:1006:1007:1008::/64 subnet. The addresses on that subnet are from (spelling out all the zeroes that you usually leave out) 1005:1006:1007:1008:0000:0000:0000:0000 to 1005:1006:1007:1008:ffff:ffff:ffff:ffff. As you can see 1001:1002:1003:1004::1 is not in that range, so your configuration is invalid.

In your second example you are telling your machine that 2000::/3 (which is all of the currently used global unicast space) is on your ethernet interface. So you are basically telling your machine that the whole internet is one big LAN, your LAN. After that you can of course use any address in 2000::/3 as your default gateway because everything in that range is considered is on-link. So you won't get an error from your system, but you are still miss-configuring your network.

If you want to experiment with IPv6 you should either run a local lab using ULA space or you should get an IPv6 tunnel from e.g. SixXS or Hurricane Electric.

And I recommend you learn how IP addressing works so you know what you are doing. Q&A sites like this are great for answering specific questions you have, but they are not really suited as a replacement for studying the basics or getting a training course. Try some of these websites and documents to get you started:

Sander Steffann

Posted 2014-10-31T12:12:01.567

Reputation: 4 169

Thanks a lot Sir for your great explanation and suggestions. – Subhajit – 2014-11-03T04:37:07.443

You're welcome! The idea in websites such as this is that you mark an answer as accepted when it answers your question. There is a checkmark you can click next to each answer. That way it won't show up in the list of unanswered questions anymore, and I'll get some points for it as well :) – Sander Steffann – 2014-11-03T09:25:22.087