Configure OpenVPN Client as default gateway
Posted: 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
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