DNS requests on wrong interface...

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
nicovpn
OpenVpn Newbie
Posts: 5
Joined: Thu Mar 24, 2011 7:16 pm

DNS requests on wrong interface...

Post by nicovpn » Thu Mar 24, 2011 8:24 pm

Hello,

I am working in IT and we manage a lot of company.
For one of those company, we have a server Ovpn, and users can connect on the Exchange Server or the shares from outside the network.

But for 5-6 users (Win XP or 7), I have got the following problem :

-Ovpn Log = Perfect, Dns are pushed and routes are rights. The remote Domain is binded too on the ovpn interface. Ipconfig /all, and everything is correct.

But it can't resolves hostnames on the remote domain.
I have made a capture of packets and i saw that the DNS Requests are goint out on the REAL interface, and not the OVPN one...
The Weirdest thing is that after 15 mins...it starts resolving...and DNS request are going out on the OVPN interface.

I have checked the connection priorities for DNS on windows for these users, and it is correct :ovpn is prioritary.

Anyone has got an idea about this ?

User avatar
gladiatr72
Forum Team
Posts: 194
Joined: Mon Dec 13, 2010 3:51 pm
Location: Lawrence, KS

Re: DNS requests on wrong interface...

Post by gladiatr72 » Thu Mar 24, 2011 8:38 pm

control panel -> network and sharing -> change adapter settings -> <ALT>-n -> advanced settings

Make sure that your tap adapter is at the top of your connections list.

If this is already the case, you can create a .bat file (let's call it clearcache.bat) and put it in your openvpn directory. The only thing in this .bat file is "net stop dnscache"

add the line

up clearcache.bat

to your client configuration.

This will shutdown the dns client service and allow it to restart as you're bringing up your connection. This clears the dns cache allowing all new dns queries to flow to the dns server(s) on the remote end.

I fought with this for weeks. I hope this solves your problem.

-S
[..]I used to think it was awful that life was so unfair. [...]Wouldn't it be much worse if life were fair, and all the terrible things that happen to us come because we actually deserve them? -Marcus Cole

nicovpn
OpenVpn Newbie
Posts: 5
Joined: Thu Mar 24, 2011 7:16 pm

Re: DNS requests on wrong interface...

Post by nicovpn » Thu Mar 24, 2011 9:03 pm

I am going to try this, but i am not sure that it will works...

Because, i made a lot of tries after a reboot...and the cache should be clean so ?

Thanks

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: DNS requests on wrong interface...

Post by janjust » Thu Mar 24, 2011 11:00 pm

if you're using openvpn 2.1.3+ then try adding

Code: Select all

register-dns
to the client config ; names that don't resolve for about 15 minutes are a clear symptom of the dnscache issue. The "register-dns" option is supposed to fix this.

nicovpn
OpenVpn Newbie
Posts: 5
Joined: Thu Mar 24, 2011 7:16 pm

Re: DNS requests on wrong interface...

Post by nicovpn » Fri Mar 25, 2011 1:23 pm

register-dns = i get an unrecognized option

nicovpn
OpenVpn Newbie
Posts: 5
Joined: Thu Mar 24, 2011 7:16 pm

Re: DNS requests on wrong interface...

Post by nicovpn » Fri Mar 25, 2011 2:14 pm

gladiatr72, i am trying your method...I made the .bat etc...
Finally, i ve discovered that you don't need to modify the client config.

You name your .bat this way "samenameasconfigfile_up.bat" ...so for user toto, it gives "toto_up.bat"

So i used this to call the script...

Now OpenVPN launches perfectly, until the end of the connection process...A windows pops with the following error :

openvpn connect script failed exit code=2


Any ideas ?

nicovpn
OpenVpn Newbie
Posts: 5
Joined: Thu Mar 24, 2011 7:16 pm

Re: DNS requests on wrong interface...

Post by nicovpn » Fri Mar 25, 2011 3:13 pm

Hello,

It works now...

In fact the dns cache was already stopped, thts why it returned an error.

I modifier the script this way.

net stop dnscache
net start dnscache


PROBLEM SOLVED

Thanks for your help

User avatar
gladiatr72
Forum Team
Posts: 194
Joined: Mon Dec 13, 2010 3:51 pm
Location: Lawrence, KS

Re: DNS requests on wrong interface...

Post by gladiatr72 » Fri Mar 25, 2011 3:22 pm

janjust wrote:if you're using openvpn 2.1.3+ then try adding

Code: Select all

register-dns
to the client config ; names that don't resolve for about 15 minutes are a clear symptom of the dnscache issue. The "register-dns" option is supposed to fix this.
Stellar. I hadn't run across this option. Thanks for the info!

-S
[..]I used to think it was awful that life was so unfair. [...]Wouldn't it be much worse if life were fair, and all the terrible things that happen to us come because we actually deserve them? -Marcus Cole

Douglas
Forum Team
Posts: 285
Joined: Wed Aug 27, 2008 2:41 am

Re: DNS requests on wrong interface...

Post by Douglas » Fri Mar 25, 2011 8:30 pm

gladiatr72 wrote:
janjust wrote:if you're using openvpn 2.1.3+ then try adding

Code: Select all

register-dns
to the client config ; names that don't resolve for about 15 minutes are a clear symptom of the dnscache issue. The "register-dns" option is supposed to fix this.
Stellar. I hadn't run across this option. Thanks for the info!

-S
I learned something new too!

Post Reply