Hello, I am building a VPN application where I need to set DNS server programmatically. I am changing NameServer
parameter in the registry (in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
) to prepend a name server to the list of existing entries. Once I do this, if I try to look up a host name using nslookup
, it works fine, but ping
is not able to resolve the name - for 15 minutes. And after 15 mins ping is also able to resolve the name. I've tried my own little TCP/IP app, and that has the same issue. I looked at the traffic in wireshark, and I see that nslookup is sending dns lookup requests, while ping isn't.
Is there anyway I can kick windows to notice the name server earlier? Or is there a better way to set name servers in windows?
Thanks in advance for your help!