I have the following setup

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

From Linux0, i am able to ping or ( 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


ip -6 route add default via 2004::

But i get the error

RTNETLINK answers: No route to host

What am i missing here?.

  • Add the network mask to the above line: ip -6 route add 2004::/64 dev eth0
    – user136501
    Commented 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
    Commented May 26, 2016 at 19:09

2 Answers 2


You need to add the route to the gateway first:

ip -6 route add 2004::3 dev eth0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .