openvpn, setting route, client side

Ian Coetzee ubuntu at iancoetzee.za.net
Thu Apr 22 08:15:05 UTC 2010


On 2010/04/22 08:33 AM, Mihamina Rakotomandimby wrote:
> Manao ahoana, Hello, Bonjour,
>
>    
<snip>
> I run:
> - Debian Lenny on the server
> - Ubuntu Karmic on the client
>
> My problem is client side (Ubuntu).
> I dont use the Network manager, all is command line.
>
> When the VPN is down:
> - My default route is via wlan0
>
> When the VPN is up:
> - traffic to 10.8.0.x is via tun0
> - My default route is via wlan0
>
> If I want all the traffic to get through tun0, I have to:
> - Remove the default route from wlan0
> - Set the default route to tun0
>
> Of course, that doesn't work because when removing the default route
> from wlan0, the VPN looses its connectivity (no route) to get out.
>
> The workaround I found is to add routes one by one to my destinations
> via tun0:
> - "route add -host destination-1 dev tun0"
> - "route add -host destination-2 dev tun0"
> - "route add -host destination-3 dev tun0"
> - "route add -host destination-4 dev tun0"
> - ...
> - "route add -host destination-N dev tun0"
>
> Obviously also, if I just add default route though tun0, I have then 2
> default routes, which is not working.
>
> How to just get all the traffic through tun0 when the VPN is up?
>
> Misaotra, Thanks, Merci.
>
>    
Hi Misoatra

Might I suggest adding a /32 route to the vpn-server via wlan0 and then 
/0'ing the rest though tun0 (havent tested it but makes logical sense)

I also noticed that using a windows pptp connection windows moves your 
/0 route to a metric of 100 and adds a /0 route with a metric of 10. 
Tried that from work, ended up not being able to log into my home for a 
whole day :S.

Regards
Ian





More information about the ubuntu-users mailing list