Discussion:
[Openvpn-users] adding host route to client?
Jiann-Ming Su
2008-03-05 07:46:55 UTC
Permalink
I've got openvpn 2.0.9 configured where I'm pushing a route to my
clients, i.e. "push 172.13.0.0 255.255.0.0".
The problem is the openvpn server lives in that subnet. So, as soon
as the tunnel comes up, the route to the openvpn server changes from
the default gateway interface to the tunnel interface, which simply
breaks the openvpn connection. Is there a way to elegantly configure
openvpn on either the client or the server such that a host route to
the openvpn server is injected into the client's routing table? I
suppose it's easy enough to do with a script and maybe the route-delay
option, but an extra script that has to be run manually doesn't seem
particularly elegant. Thanks for any tips.
--
Jiann-Ming Su
"I have to decide between two equally frightening options.
If I wanted to do that, I'd vote." --Duckman
"The system's broke, Hank. The election baby has peed in
the bath water. You got to throw 'em both out." --Dale Gribble
"Those who vote decide nothing.
Those who count the votes decide everything." --Joseph Stalin
Jan Just Keijser
2008-03-05 08:47:48 UTC
Permalink
hi Jiann-Ming,

the option
push "redirect-gateway def1"
is supposed to take care of this; if this does not work automatically,
try adding another push
push "172.13.X.Y 255.255.255.255 net_gateway"
where X.Y is the IP address of the openvpn server and 'net_gateway' is a
special keyword. This will add an extra route to your openvpn server
using the 'net' (i.e. non-VPN) gateway.

For more details, as always, Read The Fabulous Manual

HTH,

JJK
Post by Jiann-Ming Su
I've got openvpn 2.0.9 configured where I'm pushing a route to my
clients, i.e. "push 172.13.0.0 255.255.0.0".
The problem is the openvpn server lives in that subnet. So, as soon
as the tunnel comes up, the route to the openvpn server changes from
the default gateway interface to the tunnel interface, which simply
breaks the openvpn connection. Is there a way to elegantly configure
openvpn on either the client or the server such that a host route to
the openvpn server is injected into the client's routing table? I
suppose it's easy enough to do with a script and maybe the route-delay
option, but an extra script that has to be run manually doesn't seem
particularly elegant. Thanks for any tips.
Jiann-Ming Su
2008-03-05 15:39:12 UTC
Permalink
Post by Jiann-Ming Su
I've got openvpn 2.0.9 configured where I'm pushing a route to my
clients, i.e. "push 172.13.0.0 255.255.0.0".
The problem is the openvpn server lives in that subnet. So, as soon
as the tunnel comes up, the route to the openvpn server changes from
the default gateway interface to the tunnel interface, which simply
breaks the openvpn connection. Is there a way to elegantly configure
openvpn on either the client or the server such that a host route to
the openvpn server is injected into the client's routing table? I
suppose it's easy enough to do with a script and maybe the route-delay
option, but an extra script that has to be run manually doesn't seem
particularly elegant. Thanks for any tips.
I ended up adding the following line to the client config:

route ip_addr_of_openvpn_server 255.255.255.255 net_gateway
--
Jiann-Ming Su
"I have to decide between two equally frightening options.
If I wanted to do that, I'd vote." --Duckman
"The system's broke, Hank. The election baby has peed in
the bath water. You got to throw 'em both out." --Dale Gribble
"Those who vote decide nothing.
Those who count the votes decide everything." --Joseph Stalin
Marco Fretz
2008-03-06 07:35:38 UTC
Permalink
yes, that will work because this host route is more specific then ur /16
net route and your vpn client pc will use this route instead of the new
network route...
Post by Jiann-Ming Su
Post by Jiann-Ming Su
I've got openvpn 2.0.9 configured where I'm pushing a route to my
clients, i.e. "push 172.13.0.0 255.255.0.0".
The problem is the openvpn server lives in that subnet. So, as soon
as the tunnel comes up, the route to the openvpn server changes from
the default gateway interface to the tunnel interface, which simply
breaks the openvpn connection. Is there a way to elegantly configure
openvpn on either the client or the server such that a host route to
the openvpn server is injected into the client's routing table? I
suppose it's easy enough to do with a script and maybe the route-delay
option, but an extra script that has to be run manually doesn't seem
particularly elegant. Thanks for any tips.
route ip_addr_of_openvpn_server 255.255.255.255 net_gateway
Loading...