Configure OpenVPN Client as default gateway

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
fuzzie
OpenVpn Newbie
Posts: 1
Joined: Sun Aug 29, 2010 9:43 pm

Configure OpenVPN Client as default gateway

Post by fuzzie » Sun Aug 29, 2010 9:57 pm

Hi,

I have a working OpenVPN installation with the following layout:

LAN-client
|
OpenVPN-server
|
Internet
|
OpenVPN-client

Now I want to do something strange: Instead of a normal configuration where the OpenVPN-client sends all traffic through the OpenVPN server (where I would put the redirect-gateway directive in a client-config-dir (ccd)) I would like all traffic from the LAN-client to be sent through the OpenVPN-client.

I tried using the iroute directive in the ccd like this:
iroute 0.0.0.0 0.0.0.0

Unfortunately this does not work, so I tried this:

iroute 1.0.0.0 0.0.0.0
iroute 2.0.0.0 0.0.0.0
iroute 3.0.0.0 0.0.0.0
...
iroute 255.0.0.0 0.0.0.0

This actually works.

I had to increase the max-routes-per-client directive because the OpenVPN-server seems to build up a routing table for each individual IP.

If there are a lot of connections, the OpenVPN server consumes a lot of memory (RAM) because of the large routing table.

So, the question is: Is there a nicer way to achieve the goal: route all traffic through OpenVPN-Client? Some kind of default gateway directive?

Thanks for your help

Kind regards

User avatar
krzee
Forum Team
Posts: 728
Joined: Fri Aug 29, 2008 5:42 pm

Re: Configure OpenVPN Client as default gateway

Post by krzee » Thu Sep 02, 2010 6:24 pm

very interesting that what you said actually does work
try using the same routes as redirect-gateway def1 would add, 0.0.0.0/1 and 128.0.0.0/1
that is the same as 0/0, and who knows... maybe it would work!
please report back as well, once it works as you want maybe you could make a writeup on our wiki or post configs in the bragging rights section =]

Post Reply