Loss of routes causes routing loop
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Short version:
After temporary loss of the physical connection, OpenVPN does
not reestablish the tunnel due to a routing loop. I think this is a Windows issue that OpenVPN should try to work around. We are running v2.1_rc15 on the clients, rc15 on one server and rc13 on the other two.
Long version:
I have configured the routing computer on our wireless network
to intercept OpenVPN traffic destined to our normal OpenVPN server and serve it locally. It adds the "redirect-gateway def1" option so that all traffic on the wireless link will be protected by the VPN. To ensure that a reconnection attempt to a different server address will not be looped into the tunnel, I added two /32 routes for the server addresses to the wireless gateway. This worked great in hard-wired testing on that subnet.
In wireless use, we find that Windows will dump SOME of the
routes created by OpenVPN when the radio changes APs (or for whatever reason drops momentarily). It seems to be deleting routes which use the gateway of that interface (or maybe just anything on that subnet?).
So specifically:
Wireless subnet: 172.21.166.0/24
Gateway (and OpenVPN server): 172.21.166.254
Public server addresses: 65.120.131.235 & .238
The gateway uses iptables to internally redirect requests to the
public addresses to itself. The client computers think they are still talking to the public address.
push "route 65.120.131.235 255.255.255.255 172.21.166.254" push "route 65.120.131.238 255.255.255.255 172.21.166.254" push "redirect-gateway def1"
After anything that makes Windows reset the physical interface,
the route table no longer contains the 65.120.131.* routes. My guess is that it deleted any routes that used 172.21.166.* as a gateway, and then re-added 172.21.166.254 as the default after DHCP finished negotiating.
I can see two possible OpenVPN fixes for this, but I have not
even dared to look at the code yet. When trying to reconnect after a ping-timeout:
1) Remove all OpenVPN-added routes first, or
2) Re-add/fix all OpenVPN-added routes first.
Either would work in my situation, but some people may want to
choose between the two.
Daniel Johnson
[email protected]...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFJefql6vGcUBY+ge8RAjoAAJ9NzJE/p3qxJlwnv5cWIwpfBS6b0gCghNHr bObdcQYAH1Ob7Z93t9ATzHg=
=xN7F
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've seen no replies to this yet, and I'm concerned that v2.1 will be released without any resolution. If one of the experienced developers could point me in the direction of the code files that handle route detection/creation/deletion, and that handle reconnection I think I can figure it out. My attempts to understand the overall structure have not made much progress.
On a related note, I'm looking at adding a second interface on the two main (and now only) VPN servers, so that they'll be 'local' on the guest/wireless network. Does OpenVPN do anything special with DNS results to prefer local addresses? If not, can that be added easily?
Daniel Johnson
[email protected]...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFKKDfZ6vGcUBY+ge8RAjmUAJ9LyVDhyNyFyEtVJlNMcmsJmoP/KACfbkIQ 2uMaMWScKbUfBB0ATC+HRHI=
=Vmnt
-----END PGP SIGNATURE-----
Quoted 4 lines · Daniel Johnson
On a related note, I'm looking at adding a second interface on the two main (and now only) VPN servers, so that they'll be 'local' on the guest/wireless network. Does OpenVPN do anything special with DNS results to prefer local addresses? If not, can that be added easily?
Openvpn does not do DNS at all. You can use it to push DNS related DHCP options to the "clients" so that they are directed to a DNS server that does the right thing. (There may be a way to do something similar in a "client-side" config, I don't recall.) That's about it.
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 5 lines · Karl O. Pinc
Openvpn does not do DNS at all. You can use it to push DNS related DHCP options to the "clients" so that they are directed to a DNS server that does the right thing. (There may be a way to do something similar in a "client-side" config, I don't recall.) That's about it.
Sorry, I wasn't specific. My clients look up "openvpn1[2,3,4].chguernsey.com" to connect, and I'm interested in how it handles the results. I expect it uses the Windows resolver, and that it will receive all of the numeric results. So if I change my DNS entries to report
PTR mercury.chguernsey.com.
A 65.120.131.235
A 172.21.166.249
can I get the client to "notice" that it is directly connected to the 172.21.166 subnet and use that IP?
For the moment I'm pursuing a split-view DNS to report only the internal address on that subnet. It should hide the effects of the routing-loop problem until it can be properly resolved.
Daniel Johnson
[email protected]...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFKKSw66vGcUBY+ge8RAprpAKDkxJU0eZiJkpJsRw38Bloj2mLR/gCgxoQL nMxPTd3/B0y87DOYd/tRhMQ=
=ZNPj
-----END PGP SIGNATURE-----
[Openvpn-devel] How to route without splitting the network into a /30?
Hello guys,
I would like to route with OpenVPN with public IPs. My setup works fine now, however every client get a dedicated /30 network segment instead of the /28 allowed. This of course means that I waste too many IPs as every client get its own gateway, and so on.
I don't want to use Tap for this.
Here is my config:
plugin /usr/lib/openvpn/openvpn-auth-pam.so login
local x.x.3.100
port 1194
proto udp
dev tun
ca ca.crt
cert x-vpn.crt
key x-vpn.key
dh dh1024.pem
server x.x.2.16 255.255.255.240
push "route x.x.2.0 255.255.255.0"
#push "route x.x.3.100 255.255.255.248"
push "redirect-gateway def1"
push "dhcp-option DNS x.x.2.3"
push "dhcp-option DOMAIN ekanet.net"
push "dhcp-option ROUTERS x.x.3.97"
#client-config-dir ccd
#route 10.0.0.0 255.255.255.0
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
user openvpn
group openvpn
persist-key
persist-tun
verb 1
username-as-common-name
tmp-dir /dev/shm
client-cert-not-required
Thanks in advance.
Best regards,
Emrah
Re: [Openvpn-devel] How to route without splitting the network into a/30?
Quoted 2 lines
-----Original Message-----
From: Emrah KAVUN [mailto:[email protected]...]
...
Quoted 8 lines
I would like to route with OpenVPN with public IPs. My setup works fine
now, however every client get a dedicated /30 network segment instead of
the /28 allowed. This of course means that I waste too many IPs as every
client get its own gateway, and so on.
I don't want to use Tap for this.
...
The option:
topology subnet
I think is what you are wanting. Check out the man page for details, but the short story is that you get one IP per client, one for the server, within the subnet defined in the 'server' directive.
-dave
Quoted 21 lines · Daniel Johnson
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 5 lines · Karl O. Pinc
Openvpn does not do DNS at all. You can use it to push DNS related DHCP options to the "clients" so that they are directed to a DNS server that does the right thing. (There may be a way to do something similar in a "client-side" config, I don't recall.) That's about it.
Sorry, I wasn't specific. My clients look up "openvpn1[2,3,4].chguernsey.com" to connect, and I'm interested in how it handles the results. I expect it uses the Windows resolver, and that it will receive all of the numeric results. So if I change my DNS entries to report
PTR mercury.chguernsey.com.
A 65.120.131.235
A 172.21.166.249
can I get the client to "notice" that it is directly connected to the 172.21.166 subnet and use that IP?
Quoted 3 lines
For the moment I'm pursuing a split-view DNS to report only the internal address on that subnet. It should hide the effects of the routing-loop problem until it can be properly resolved.
Daniel,
Earlier you mentioned that "In wireless use, we find that Windows will dump SOME of the routes created by OpenVPN when the radio changes APs".
When this occurs, does it trigger a reconnection by the OpenVPN clients to the server? If so, you can ensure that client-side routes are reset as part of the reconnection by NOT using the "persist-tun" directive in the client config file.
James
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 7 lines · James Yonan
Earlier you mentioned that "In wireless use, we find that Windows will dump SOME of the routes created by OpenVPN when the radio changes APs".
When this occurs, does it trigger a reconnection by the OpenVPN clients to the server? If so, you can ensure that client-side routes are reset as part of the reconnection by NOT using the "persist-tun" directive in the client config file.
By itself, no, the event does not trigger a reconnection. After the ping timeout (30 seconds) it tries to reconnect, and fails. I suppose to make things near-seamless the client would need to know which route(s) is/are critical, and check them regularly or when any ping fails? Man this is frustrating.
I'll test running without persist-tun. Other than it re-running the 'up' script, are there any gotchas?
If anyone wants to demonstrate the disappearing-route issue, here's the easiest way: On a Windows NT 5.1/'XP' computer, connect to a network with a cable. Create a route (by hand or via OpenVPN) whose gateway is on the LAN. Unplug the network cable for about ten seconds, then plug it back in. The route will be gone. A wireless hiccup need not last ten seconds to cause the same issue. I can understand why the current Windows behavior is generally desireable but it really fouls things up if you are depending on one of those routes.
Daniel Johnson
[email protected]...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFKLoAi6vGcUBY+ge8RAuuPAKCHhYqDylEhVOzZheOfJQukxD+/YACcD4TO kT45+dETGw6ZVdVLtljWouM=
=SFDI
-----END PGP SIGNATURE-----