Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying this command:

route add -net netmask gw dev eth0 is a public IP address of a VPN router gateway which located in a different subnet and connected through internet.


SIOCADDRT: No such process

Is it possible to route a traffic to external gateway ? or its required that the gateway should in the same network to enable static routing.

Any info or direction appreciated.


share|improve this question
up vote 1 down vote accepted

What you're trying to do is endow the originating host with knowledge of how to route traffic after the next hop, which isn't strictly a routing table issue. As others have said, the best thing is to endow your next-hop route with knowledge of how to route to, and let the router sort it out.

If you really do want to do what you describe above, then this is called source routing, and it's by no means universally loved and honoured. If the devices in your routing path - specifically your next-hop router - will allow an LSRR packet, you may be able to pass this "where to go after next-hop router" information inside each packet to Not having done this, I can't advise on how to construct such packets, but it will be an application issue.

share|improve this answer

In theory yes, but in practice your device must know how to get packets to that subnet anyway so there isn't much point.

You really need to setup your routers to do your routing so that policies are enforced on them rather than being devolved to hosts.

share|improve this answer

It seems that there is no route from this machine to your VPN gateway. Try to add right route to first.

share|improve this answer
can u advice, how to set the route to the VPN gateway ? thanks. – taras Jul 25 '11 at 8:23
In your case, try this: route add dev eth0 route add -net netmask gw dev eth0 – hangover Jul 25 '11 at 8:49
Well, editor gobbled my linebreaks :) – hangover Jul 25 '11 at 8:54
route add dev eth0 route add -net netmask gw dev eth0 – hangover Jul 25 '11 at 8:58
thanks. Is it safe if u run this command ? any risk that i can get disconnected from SSH ? – taras Jul 25 '11 at 12:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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