Sunday, January 16, 2011

Routing select hosts through vpn

I have a PPTP VPN connection set up on an ubuntu 8.10 box as ppp0 and I was wonder how to route select connections to go through the VPN.

For example I want google.com to go through the default interface, but bing.com to route through ppp0.

Could I do this with a routing rule? Or is something like this more cut out for iptables?

  • You can do this using a routing rule but you will have to add all ip-addresses of bing to the route through ppp0. In the real world this is much harder. Google for example has a lot of ips and is even getting more. So you will have to update your rule to reflect the addresses currently used.

    abronte : The bing and google are just examples, the hosts i will be using only have 1 ip. What would adding a route rule like this look like?
    abronte : this can be done by doing "route add -host gw "
    Wienczny : You could also use "ip route add $IP dev $DEVICE"
    From Wienczny
  • Apologies if this is considered as a thread hijack but I think in theory it answers Abronte's question, we just need the answer to do it in a practical sense.

    Ok, I have to same problem. I have a VPN which I want to route traffic for specific websites through. I know how to do it I just don't know which utilities to use and how to configure.

    The proposed solution:

    Firefox -> Foxyproxy (filtering on regex) -> HTTP proxy -> VPN interface.

    I have Foxyproxy set up to use the HTTP proxy when it matches a pattern. The bit where I am stuck is getting a HTTP proxy that will send request out on a specific interface. I have tried 'tinyproxy' but it does not seem to take notice of the 'bind 192.168.100.170' which is the IP address of my ppp0 VPN interface.

    Can someone suggest a HTTP proxy that will allow this.

    From JRT

0 comments:

Post a Comment