question

Doria avatar image
0 Votes"
Doria asked MarcinMilewski-0539 answered

Multiple DNS Servers into W2K19 using netsh.

Hi everyone!

How do I add multiple DNS Servers into a Windows Server 2019 core using netsh?


Thanks.

windows-serverwindows-server-core
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.

SunnyQi-MSFT avatar image
0 Votes"
SunnyQi-MSFT answered

Hi,

I did a test in my lab and found that the command netsh interface ipv4 add dnsserver name=Ethernet address=192.168.0.101 index=1 can be run successfully in my Windows Server 2019 core.

Here is my test result for your reference:

My systeminfo result:

115291-image.png

115245-image.png

115205-image.png

![115281-image.png

Here is an article for your reference:

Manually install a Server Core installation
Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

If you still cannot configure the DNS server on your server core, please help to provide related screenshots for further troubleshooting.

Best Regards,
Sunny


If the Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


image.png (58.3 KiB)
image.png (44.2 KiB)
image.png (77.4 KiB)
image.png (63.2 KiB)
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

You can find the interface name
netsh interface show interface

then add the DNS addresses
netsh interface ipv4 add dnsservers "Ethernet" address=192.168.x.x


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









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.

Doria avatar image
0 Votes"
Doria answered

I guess I was not clear enough.

I need to add two DNS Servers into NIC TCP/IP settings, 10.168.1.4 and 10.168.1.5, but after I do it only last one shows in the ipconfig /all command output. It appears that the second address overwrites the primary one. :-(


Thanks.

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

You can do
netsh interface ipv4 add dnsservers "Ethernet" address=10.168.1.4 index=1
netsh interface ipv4 add dnsservers "Ethernet" address=10.168.1.5 index=2

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







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.

Doria avatar image
0 Votes"
Doria answered

index= does not work in W2K19 core.

I tried.

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

You may need to delete them first
netsh interface ip delete dns "Ethernet" [old DNS ip address]

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










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 DSPatrick edited

Another option is to use PowerShell. Use Get-NetAdapter to find the index
https://devblogs.microsoft.com/scripting/powertip-use-powershell-to-set-primary-and-secondary-dns-server-addresses/

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




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

Just checking if there's any progress or updates?

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



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.

Doria avatar image
0 Votes"
Doria answered DSPatrick edited

Thanks all!

I was using "netsh interface ip" and not "netsh interface ipv4" commands.

MS should remove those old commands, I guess.


Thanks again. :-)

· 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.

Why did you not mark my answer??? I gave you the correct solution much sooner. Please fix that.





0 Votes 0 ·
MarcinMilewski-0539 avatar image
0 Votes"
MarcinMilewski-0539 answered

I want to add the third and fourth DNS server using netsh command and I am getting that the "index" is not a valid argument for this command. (Windows 2016)

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.