1

On my Linux server (Ubuntu), how can I configure traffic originating from one of my network interfaces (my VPN device - ppp0) to route through its own gateway address?

Caveats:

  • I can't set it up as a default route on the server because it is expensive to route all traffic through it
  • There isn't a specific subnet linked to the VPN - it could be traffic to any public IP or port (the VPN behaves as a proxy)

The end goal is to be able to configure a single local application to bind to the VPN IP and communicate only over the VPN, but no other server traffic should be routed through it. I've set it up like this, but I seem to need some sort of additional routing rules to get it working.

2 Answers 2

1

If the VPN is actually acting as a proxy, then the source addresses should be re-written to the far end of the ppp session (unless it's an unnumbered interface, but I haven't seen that on a vpn). If it's actually routing normally, and the destination could be anywhere, then it becomes a more interesting problem.

The base solution is outlined in the LARTC-- you'd want to create a second routing table specifying the VPN tunnel as the default route, and then add filters to direct some traffic to look at the secondary routing table instead of the default one. If you only need one app to take the tunnel, and the app can bind to the tunnel interface's IP, then policy-based routing from the source IP should do the trick -- see the example here: http://lartc.org/howto/lartc.rpdb.html

1
0

you can use the dev parameter to bin a route to a specified device.

route add -net 0.0.0.0 gw ENTER-GATEWAY-HERE dev ppp0

You must log in to answer this question.

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