Skip to contentSkip to conversation

DNS problems with openvpn 2.1 on Windows

Openvpn-devel Johan Ymerson 4 participants 12 messages Apr 6, 2010 – Apr 8, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

I have been testing OpenVPN 2.1.1 for a while and have came across a strange DNS problem.
Other people seem to have seen the same problem (ex. http://www.astaro.org/astaro-gateway-products/vpn-site-site-remote-access/21387-new-sslvpn-client-dns-problems.html), and a work-around is available, but I have not seen any real fix for this or discussion on how to find the actual problem.

The problem is that with OpenVPN 2.1.1 (and all 2.1_rcX I have tested so far), Windows doesn't seem to use the connection specific DNS servers. All DNS information (as seen by ipconfig /all) is correct, and nslookup uses the correct server. All other applications however, does not. Eventually (after 5-30 minutes or so), Windows starts to use the correct DNS servers.

Note, this is _not_ the problem http://openvpn.net/faq.html#dhcpcaveats, although it sounds like it. I have tested that work-around and it doesn't work in this case.

The work-around that always seem to work is to do an "ipconfig /renew" in a route-up script.

I have tested on 3 PC's with Windows XP, all 3 show the same problem, at almost 100% of my connection attempts. OpenVPN 2.0.9 does not have this issue (ie. reverting back to 2.0.9 on the same machines with the same config never show the problem).

Is this problem known, and is someone working on it?
I can of course help debugging this, but I don't have the development environment needed to compile the Windows binaries.

/Johan Ymerson

#1 lore raw

Hi,

Quoted 4 lines · On Tuesday 06 April 2010 22:36:31 Johan Ymerson wrote:

I have tested on 3 PC's with Windows XP, all 3 show the same problem, at almost 100% of my connection attempts. OpenVPN 2.0.9 does not have this issue (ie. reverting back to 2.0.9 on the same machines with the same config never show the problem).

We also tried 2.0.9 but were able to reproduce the bug with it as well, so it has nothing to do with the openvpn driver version involved. I came to the conclusion that it's rather some kind of race condition in the Windows XP DNS resolver. At least I haven't seen this problem on Vista or 7 personally.

Quoted 3 lines

Is this problem known, and is someone working on it?
I can of course help debugging this, but I don't have the development environment needed to compile the Windows binaries.

Not much to debug anyway. The DNS servers get passed correctly via DHCP and Windows actually takes notice of them as they show up in ipconfig /all. Problem is that XP resolver somehow forgets to reprioritize the DNS servers list after an DHCP update sometimes and sticks with the old preferred name server until the scheduled reprioritization. At least that's my personal conclusion. And it would explain why a /renew fixes it.
We've contacted Microsoft tech support about this issue. If anything like a fix comes out of that I'll post an update here. If not we'll have to consider a workaround of some kind, but let's wait with that discussion until we're sure it's not fixable the right way.
Regards
Heiko
--
Heiko Hund | Software Engineer | Phone +49-721-25516-237 | Fax -200 Astaro AG | An der RaumFabrik 33a | 76227 Karlsruhe | Germany Executive Board: Markus Hennig, Jan Hichert, Günter Junk, Dr. Frank Nellissen Chairman of the Supervisory Board: Stanley J. Krasnow
Headquarter Location: Karlsruhe
Commercial Register: Mannheim HRB 108997

#2 lore raw
Quoted 26 lines · Heiko Hund

Hi,

Quoted 1 line · On Tuesday 06 April 2010 22:36:31 Johan Ymerson wrote:

I have tested on 3 PC's with Windows XP, all 3 show the same

problem, at

Quoted 3 lines

almost 100% of my connection attempts. OpenVPN 2.0.9 does not have this issue (ie. reverting back to 2.0.9 on the same machines with the same config never show the problem).

We also tried 2.0.9 but were able to reproduce the bug with it as well, so it has nothing to do with the openvpn driver version involved. I came to the conclusion that it's rather some kind of race condition in the Windows XP DNS resolver. At least I haven't seen this problem on Vista or 7 personally.

Quoted 3 lines

Is this problem known, and is someone working on it?
I can of course help debugging this, but I don't have the development environment needed to compile the Windows binaries.

Not much to debug anyway. The DNS servers get passed correctly via DHCP and Windows actually takes notice of them as they show up in ipconfig /all. Problem is that XP resolver somehow forgets to reprioritize the DNS servers list after an DHCP update sometimes and sticks with the old preferred name server until the scheduled reprioritization. At least that's my personal conclusion. And it would explain why a /renew fixes it.

Quoted 5 lines

We've contacted Microsoft tech support about this issue. If anything like a fix comes out of that I'll post an update here. If not we'll have to consider a workaround of some kind, but let's wait with that discussion until we're sure it's not fixable the right way.

isn't
ipconfig /flushdns
or
net stop dnscache
net start dnscache
enough? This might be related to
http://support.microsoft.com/kb/311218

I've recommended to people on the -users list to use an 'up' script with
net stop dnscache
net start dnscache
this has worked in 99% of the cases.

cheers,

JJK

#3 lore raw

Jan Just Keijser <[email protected]...> wrote on 2010-04-07 13:52:22:

Quoted 2 lines

isn't
ipconfig /flushdns

No, doesn't help in this case.

Quoted 3 lines

or
net stop dnscache
net start dnscache

I hadn't tested this before, but yes, it does seem to help (only done limited testing so far).

Quoted 2 lines

enough? This might be related to
http://support.microsoft.com/kb/311218

Related maybe, but at least that work around does not work in my case.

Quoted 5 lines

I've recommended to people on the -users list to use an 'up' script with
net stop dnscache
net start dnscache
this has worked in 99% of the cases.

For me, it doesn't work in the 'up' script, I must put it in the 'route-up' script. Maybe that is the last 1% :-)

/Johan

#4 lore raw
In reply to Jan Just Keijser
Quoted 10 lines · On Wednesday 07 April 2010 13:52:22 Jan Just Keijser wrote:
Quoted 7 lines

We've contacted Microsoft tech support about this issue. If anything like a
fix comes out of that I'll post an update here. If not we'll have to consider
a workaround of some kind, but let's wait with that discussion until we're
sure it's not fixable the right way.

isn't
ipconfig /flushdns

No, that doesn't do it.

Quoted 3 lines

or
net stop dnscache
net start dnscache

That works as well as ipconfig /renew. Even ipconfig /registerdns helps because it does an implicit /renew.

Quoted 2 lines

enough? This might be related to
http://support.microsoft.com/kb/311218

Sadly it's not. Seems to have effect on MS RAS protocols only. PPTP and L2TP get their DNS settings via PPP IPCP, so it's kind of clear that this fix does not apply to the ones from openvpn via DHCP.

Quoted 4 lines

I've recommended to people on the -users list to use an 'up' script with
net stop dnscache
net start dnscache
this has worked in 99% of the cases.

True, but it's not the solution I'm looking for, but a rather high level workaround.

Heiko

Signature · 7 lines
Heiko Hund | Software Engineer | Phone +49-721-25516-237 | Fax -200
Astaro AG | An der RaumFabrik 33a | 76227 Karlsruhe | Germany

Executive Board: Markus Hennig, Jan Hichert, Günter Junk, Dr. Frank Nellissen
Chairman of the Supervisory Board: Stanley J. Krasnow
Headquarter Location: Karlsruhe
Commercial Register: Mannheim HRB 108997
#5 lore raw
In reply to Heiko Hund

"Heiko Hund" <[email protected]...> wrote on 2010-04-07 09:59:08:

Quoted 11 lines

Hi,

Quoted 4 lines · On Tuesday 06 April 2010 22:36:31 Johan Ymerson wrote:

I have tested on 3 PC's with Windows XP, all 3 show the same problem, at almost 100% of my connection attempts. OpenVPN 2.0.9 does not have this issue (ie. reverting back to 2.0.9 on the same machines with the same config never show the problem).

We also tried 2.0.9 but were able to reproduce the bug with it as well, so it has nothing to do with the openvpn driver version involved. I came to the conclusion that it's rather some kind of race condition in the Windows XP DNS resolver. At least I haven't seen this problem on Vista or 7 personally.

Then I don't think we see the same problem. We have been using 2.0.9 on ~100 machines for a couple of years now without these problems. We upgraded 3 of them to 2.1.1, and they all instantly got this problem. We downgraded them to 2.0.9, and all problems gone. Then started switching between 2.0.9 and 2.1_rcX to determine when this problem started, but all 2.1_rcX seems to suffer from it, but 2.0.9 does _not_! So something must have changed between 2.0.9 and 2.1 that at least makes this a lot worse.

/Johan

#6 lore raw
Quoted 7 lines · On Wednesday 07 April 2010 14:04:18 Johan Ymerson wrote:

"Heiko Hund" <[email protected]...> wrote on 2010-04-07 09:59:08:

Quoted 5 lines

We also tried 2.0.9 but were able to reproduce the bug with it as well, so it has nothing to do with the openvpn driver version involved. I came to the conclusion that it's rather some kind of race condition in the Windows XP DNS resolver. At least I haven't seen this problem on Vista or 7 personally.

Quoted 7 lines

Then I don't think we see the same problem. We have been using 2.0.9 on ~100 machines for a couple of years now without these problems. We upgraded 3 of them to 2.1.1, and they all instantly got this problem. We downgraded them to 2.0.9, and all problems gone. Then started switching between 2.0.9 and 2.1_rcX to determine when this problem started, but all 2.1_rcX seems to suffer from it, but 2.0.9 does _not_! So something must have changed between 2.0.9 and 2.1 that at least makes this a lot worse.

Strange, we tested with 2.1_rc22 and the driver from 2.0.9 and ran into the problem within ten attempts. I can't image that the problem is related to userspace openvpn. Do you have the problem every time you connect and do you see the DNS servers in the output of ipconfig /all?

Heiko

Signature · 7 lines
Heiko Hund | Software Engineer | Phone +49-721-25516-237 | Fax -200
Astaro AG | An der RaumFabrik 33a | 76227 Karlsruhe | Germany

Executive Board: Markus Hennig, Jan Hichert, Günter Junk, Dr. Frank Nellissen
Chairman of the Supervisory Board: Stanley J. Krasnow
Headquarter Location: Karlsruhe
Commercial Register: Mannheim HRB 108997
#7 lore raw

Heiko Hund <[email protected]...> wrote on 2010-04-07 15:26:05:

Quoted 8 lines
Quoted 7 lines

Then I don't think we see the same problem. We have been using 2.0.9 on ~100 machines for a couple of years now without these problems. We upgraded 3 of them to 2.1.1, and they all instantly got this problem. We downgraded them to 2.0.9, and all problems gone. Then started switching between 2.0.9 and 2.1_rcX to determine when this problem started, but all 2.1_rcX seems to suffer from it, but 2.0.9 does _not_! So something must have changed between 2.0.9 and 2.1 that at least makes this a lot worse.

Quoted 4 lines

Strange, we tested with 2.1_rc22 and the driver from 2.0.9 and ran into the problem within ten attempts. I can't image that the problem is related to userspace openvpn. Do you have the problem every time you connect and do you see the DNS servers in the output of ipconfig /all?

I have not tested with 2.1.1 and tap driver from 2.0.9. Vanilla 2.0.9 does not have this problem (at least not in the thousands of connect attempts I have made by now). Vanilla 2.1.1 (and all rc versions I have found) does have the problem. It shows up in 1-2 attempts.

ipconfig /all shows all the correct values.
And, this is funny, nslookup always work.

I bet this actually is a change in the behavior of the userspace part, not the driver. Something userspace did after configuring the interface, but it doesn't do anymore. Something that made Windows re-examine the DNS order.

/Johan

#8 lore raw
Quoted 16 lines · Johan Ymerson

Heiko Hund <[email protected]...> wrote on 2010-04-07 15:26:05:

Quoted 8 lines
Quoted 8 lines

Then I don't think we see the same problem. We have been using 2.0.9 on ~100 machines for a couple of years now without these problems. We upgraded 3 of them to 2.1.1, and they all instantly got this problem. We downgraded them to 2.0.9, and all problems gone. Then started switching between 2.0.9 and 2.1_rcX to determine when this problem started, but all 2.1_rcX seems to suffer from it, but 2.0.9 does _not_! So something must have changed between 2.0.9 and 2.1 that at least makes this a lot worse.

Quoted 5 lines

Strange, we tested with 2.1_rc22 and the driver from 2.0.9 and ran into the problem within ten attempts. I can't image that the problem is related to userspace openvpn. Do you have the problem every time you connect and do you see the DNS servers in the output of ipconfig /all?

Quoted 6 lines

I have not tested with 2.1.1 and tap driver from 2.0.9. Vanilla 2.0.9 does not have this problem (at least not in the thousands of connect attempts I have made by now). Vanilla 2.1.1 (and all rc versions I have found) does have the problem. It shows up in 1-2 attempts.

ipconfig /all shows all the correct values.
And, this is funny, nslookup always work.

what exactly do you mean with 'nslookup always works' ?

Quoted 2 lines

I bet this actually is a change in the behavior of the userspace part, not the driver. Something userspace did after configuring the interface, but it doesn't do anymore. Something that made Windows re-examine the DNS order.

this could be a timing issue, which could be caused by changes to the userspace openvpn part; did you try playing with the
route-delay
tap-sleep
dhcp-renew
flags ? did that have any affect?

cheers,

JJK

#9 lore raw

Jan Just Keijser <[email protected]...> wrote on 2010-04-07 22:52:22:

Quoted 1 line

what exactly do you mean with 'nslookup always works' ?

nslookup always seem to use the correct dns server. For example, we have an internal website called 'intranet'. I can do nslookup intrnet, and it will return the correct internal ip address. But ping intranet will fail with:
Ping request could not find host intranet. Please check the name and try again.

Quoted 10 lines
Quoted 1 line

I bet this actually is a change in the behavior of the userspace part, not

the driver. Something userspace did after configuring the interface, but it doesn't do anymore. Something that made Windows re-examine the DNS order.

Quoted 1 line

this could be a timing issue, which could be caused by changes to the userspace openvpn part; did you try playing with the
route-delay
tap-sleep
dhcp-renew
flags ? did that have any affect?

dhcp-renew fails with:
Thu Apr 08 07:37:12 2010 WARNING: Failed to renew DHCP IP address lease on TAP-Win32 adapter: The system cannot find the file specified. (code=2)
Does dhcp-renew apply even when using the openvpn internal "dhcp" (ie. 'dev tun' and 'server 192.168.105.0 255.255.255.128' on the server side)?

I have tried different values for route-delay and tap-sleep, but it doesn't help.

/Johan

#10 lore raw
Quoted 2 lines · On Thursday 08 April 2010 08:03:54 Johan Ymerson wrote:

I have tried different values for route-delay and tap-sleep, but it doesn't
help.

AFAIR our clients use:
route-method exe
route-delay 2
ip-win32 dynamic

No one of our win7-users complained about this problem until now.

Marcel

#11 lore raw
In reply to Jan Just Keijser
Quoted 6 lines · On Wednesday 07 April 2010 22:52:22 Jan Just Keijser wrote:

this could be a timing issue, which could be caused by changes to the userspace openvpn part; did you try playing with the
route-delay
tap-sleep
dhcp-renew
flags ? did that have any affect?

We've tried all of those with no effect. I even hacked the driver so it responds to DHCP and ARP requests with a 500ms delay, nothing.

Heiko

Signature · 7 lines
Heiko Hund | Software Engineer | Phone +49-721-25516-237 | Fax -200
Astaro AG | An der RaumFabrik 33a | 76227 Karlsruhe | Germany

Executive Board: Markus Hennig, Jan Hichert, Günter Junk, Dr. Frank Nellissen
Chairman of the Supervisory Board: Stanley J. Krasnow
Headquarter Location: Karlsruhe
Commercial Register: Mannheim HRB 108997