17 July 2021

Change DNS settings from command line

Get the list of interface names:

netsh interface ip show config

Change interface named "Ethernet" to use DHCP for DNS:

netsh interface ipv4 set dnsservers name="Ethernet" source=dhcp

Set primary and secondary DNS servers for interface named "Ethernet":

netsh interface ip set dns "Ethernet" static 192.168.0.50
netsh interface ip add dns "Ethernet" 192.168.0.51 index=2

Delete a DNS server from interface "Ethernet":

netsh interface ip delete dnsserver "Ethernet" 192.168.0.51

No comments:

Post a Comment