1

I am trying to route traffic only for a specific domain over a VPN. I found what seems to be the answer in another question:

Create the file /etc/ppp/ip-up with following content:

#!/bin/sh
/sbin/route add SUBNET $5
replacing SUBNET with subnet, you want to route through VPN (for ex. 192.168.0.0/16)

execute as root:

chmod 0755 /etc/ppp/ip-up
This file will be executed each time you connect to VPN.

I know how to create / save the file, where I am having trouble is determining the value for SUBNET. I don't know if I have to just pick up the value of the subnet from either my ethernet or VPN network preference panels, or I need to create a subnet somehow to define it as being only applicable to a certain domain.

1 Answer 1

2

SUBNET in this case should be the range of hosts that you wish to route through the VPN.

For example, say that you want to route traffic to these hosts via VPN:

192.168.1.5 192.168.1.7 192.168.1.15

You could either route them individually, by adding one line for each IP:

/sbin/route add 192.168.1.5/32 $5

/sbin/route add 192.168.1.7/32 $5

/sbin/route add 192.168.1.15/32 $5

Or you could route the entire 192.168.1.x subnet through the tunnel:

/sbin/route add 192.168.1.0/24 $5

If you need help on determining the number after the /, try experimenting on websites such as http://www.subnet-calculator.com

You must log in to answer this question.

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