Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying this command:

route add -net 125.106.0.0 netmask 255.255.0.0 gw 105.101.67.70 dev eth0

105.101.67.70 is a public IP address of a VPN router gateway which located in a different subnet and connected through internet.

Result:

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.

thanks.

share|improve this question

3 Answers 3

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 125.106.0.0/16, 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 125.106.0.0/16. 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 105.101.67.70 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 105.101.67.70 dev eth0 route add -net 125.106.0.0 netmask 255.255.0.0 gw 105.101.67.70 dev eth0 –  hangover Jul 25 '11 at 8:49
    
Well, editor gobbled my linebreaks :) –  hangover Jul 25 '11 at 8:54
    
route add 105.101.67.70 dev eth0 route add -net 125.106.0.0 netmask 255.255.0.0 gw 105.101.67.70 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

 
discard

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.