0

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.

taras
  • 259
  • 2
  • 9
  • 20

3 Answers3

1

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.

blankabout
  • 1,004
  • 1
  • 9
  • 16
1

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.

Max Kochubey
  • 1,191
  • 6
  • 8
1

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.

MadHatter
  • 78,442
  • 20
  • 178
  • 229