openvpn, setting route, client side

Mihamina Rakotomandimby mihamina at gulfsat.mg
Thu Apr 22 06:33:21 UTC 2010


Manao ahoana, Hello, Bonjour,

I followed:
http://openvpn.net/index.php/open-source/documentation/howto.html

For simplicity, at first, I kept the 10.8.0.0 example on IP addresses.

I installed openVPN from the official packages repositories of each
system, versions might then be a bit different between client and
server.

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.

-- 
       Architecte Informatique chez Blueline/Gulfsat:
    Administration Systeme, Recherche & Developpement
                +261 34 29 155 34 / +261 33 11 207 36




More information about the ubuntu-users mailing list