Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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

share|improve this answer

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.