question

Max-8369 avatar image
0 Votes"
Max-8369 asked Max-8369 commented

How to specify DNS server addresses for VPN connection permanetly with any command-line (without GUI operation)?

Dear professionals,

I just consiger automatic registration about VPN connection with static DNS name server address information by command line (e.g. PowerShell).

 Add-VpnConnection -Name $vpnName -ServerAddress $serverAddress -RememberCredential ...

After successful registration with above command, I try to

 Set-DnsClientServerAddress  -InterfaceAlias $vpnName -ServerAddress SSS.TTT.UUU.VVV

However, an error has occured as "No MSFT_DNSClientServerAddress objects found".

Next, switch the VPN to online, and execute above command. Then DNS server addresses looks affected.

 ipconfig /all
    
    PPP Adapter ????:
    DNS Servers....:SSS.TTT.UUU.VVV

But it's temporary. So after disconnected and re-connected the VPN connection, that I/F has DNS server address information supplied by DHCP protocol.

     ipconfig /all
        
        PPP Adapter ????:
        DNS Servers....:DDD.EEE.FFF.GGG <- (supplied by DHCP server)

Let me know how to register the static DNS addresses to VPN connection permanently.

I will appreciate your support.

Max





windows-server-powershellwindows-dhcp-dns
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
0 Votes"
DSPatrick answered Max-8369 commented

Usually the VPN will inherit the DNS from the RRAS server's connection properties.

--please don't forget to upvote and Accept as answer if the reply is helpful--



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you DSPatrick.

Unfortunately, the RRAS server's behavior is complex.

The RRAS server is required to refer the global DNS servers (not corporate internal DNS servers) for some reasons and set this.

Furthermore, The RRAS server responds DNS reference addresses as above global DNS server address(es) to each VPN client as far in my investigated.
(The method that replying specified DNS reference addresses to VPN client is not found on RRAS machine - YAMAHA RTX1210. Is there lacking of research?)

So, the VPN client seems to be requred manual registration about corporate internal DNS server address(es), not to use RRAS supplied properties about it.

Max

0 Votes 0 ·
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered Max-8369 commented

Hello Max,

You can use the registry key: HKLM\System\CurrentControlSet\Services\Tcpip\Linkage\Bind

This list the NIC GUIDs and their bindings and orders of preference for the adapter. This way you can establish the preference of your DNS setting over DHCP assignments.

Follow this steps:

Examine the Bind registry key
Connect to your VPN connection
Check the Bind key again and copy the GUID that was added to the top of the list
Paste the GUID entry at the bottom of the list 20 times
Export the key and clean up the exported file to only include the bind key

Hope this helps in your query,

Best regards,

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello LimitlessTechnology-2700,

Thank you for your assistance.

This question is different from the application priorities for DNS server reference as follows:

https://serverfault.com/questions/356115/vpn-connection-causes-dns-to-use-wrong-dns-server

Max

0 Votes 0 ·