21

I have the following setup

           Linux 1                      Linux 0
    eth1            eth0-------------------eth0
   14.14.14.80      19.19.19.20             19.19.19.10
   2005::5/64       2004::3/64              2001::3/64 

From Linux0, i am able to ping 14.14.14.80 or 19.19.19.20 ( 19.19.19.20 was added as a default GW) and also on Linux1, ipv4 forwarding was enabled. For ipv6, i cannot add 2004::3/64 as the default ipv6 gateway on Linux0. I tried

ip -6 route add default via 2004::3

and

ip -6 route add default via 2004::

But i get the error

RTNETLINK answers: No route to host

What am i missing here?.

2
  • Add the network mask to the above line: ip -6 route add 2004::/64 dev eth0
    – user136501
    Sep 30, 2015 at 22:10
  • The normal thing to do would be to put devices on the same ethernet network in the same subnet, then you wouldn't have this problem.
    – plugwash
    May 26, 2016 at 19:09

2 Answers 2

22

You need to add the route to the gateway first:

ip -6 route add 2004::3 dev eth0
0
7

To add a default gateway, and not one specific to an Ethernet interface (dev), use:

route add default gw <GW IP Address> # For IPv4
route add -A inet6 default gw <GW IP Address> # For IPv6; you must specify the Address Family (AF)

Notice, you don't have to specify the subnet mask, nor the outgoing Ethernet interface.

To verify your work, list the host's IP routing table suing:

netstat -rn # for IPv4
netstat -rn -A inet6  # for IPv6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.