Contents ...
udn網路城邦
How to configure primary and secondary DNS servers
2016/12/24 21:35
瀏覽845
迴響0
推薦0
引用0

You can use the dnsclient context of the netsh command to configure a primary DNS server like this:
netsh interface ip set dnsservers name="Local Area Connection" source=static address=10.0.0.1 register=primary
(也可以寫成netsh interface ip set dnsservers "Local Area Connection" static 10.0.0.1 primary)
But how do you use netsh dnsclient to configure a secondary DNS server?
You need to use this command instead:
netsh interface ip add dnsservers name="Local Area Connection" address=10.0.0.2 index=2
The above command can be used to add a new DNS server to the statically-configured list on the client, and by default each time you run the command it adds the DNS server to the end of the list. If the optional index=parameter is used, the newly configured DNS server will be placed in the position specified while the other DNS servers will be moved down to make room for the new server in the DNS list on the client.
For example, you could configure primary and secondary DNS servers using these two commands:
netsh interface ip add dnsservers name="區域連線" address=10.0.0.1
netsh interface ip add dnsservers name="
區域連線" address=10.0.0.2 index=2
http://www.windowsnetworking.com/kbase/WindowsTips/Windows7/AdminTips/Network/ConfiguringasecondaryDNSserverfromthecommandline.html

DOS指令
:: 指此行是註解,不會執行 (::=REM)
語法實例:
netsh interface ip delete dnsservers name="區域連線" all
:: 加此行可以先清空DNS (::=rem 註解不執行)
netsh interface ip add dnsservers name="區域連線" address=10.160.128.9
netsh interface ip add dnsservers name="區域連線
" address=10.160.1.9 index=2
檔案存成”ConfigDNSserversIP.bat”,要以系統管理員身分執行。

全站分類:知識學習 隨堂筆記
自訂分類:電腦筆記

限會員,要發表迴響,請先登入