24

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

kishore .
  • 455
  • 1
  • 3
  • 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 '16 at 19:09
  • Add the network mask to the above line: ip -6 route add 2004::/64 dev eth0 –  Sep 30 '15 at 22:10

2 Answers2

25

You need to add the route to the gateway first:

ip -6 route add 2004::3 dev eth0
CaptainCap
  • 431
  • 4
  • 5
8

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
DopeGhoti
  • 73,792
  • 8
  • 97
  • 133