- 找到无线连接名:
Get-NetAdapter | Select-Object Name, InterfaceDescription, Status我的无线网卡名称是
"Wi-Fi"。
PS C:\Users\xxx> Get-NetAdapter | Select-Object Name, InterfaceDescription, Status
Name InterfaceDescription Status
---- -------------------- ------
Wi-Fi 802.11n USB Wireless LAN Card Up
Ethernet Intel(R) 82579LM Gigabit Network Connection Disconnected
vEthernet (Default Switch) Hyper-V Virtual Ethernet Adapter Up
vEthernet (June9virtual_Switch) Hyper-V Virtual Ethernet Adapter #2 Disconnected
2, 手动设置 DNS
# 设置首选 DNS 为 1.1.1.1(cloudflare)
netsh interface ip set dns name="Wi-Fi" static 1.1.1.1 primary
netsh interface ip set dns name="vEthernet (June9virtual_Switch)" static 1.1.1.1 primary
# 设置备用 DNS 为 8.8.8.8(Google)
netsh interface ip add dns name="Wi-Fi" 8.8.8.8 index=2
netsh interface ip add dns name="Ethernet 2" 8.8.8.8 index=2
3, 刷新 DNS 缓存
ipconfig /flushdns
4, 刷新成功后,用 ipconfig /all 可以看dns设置是否成功
ipconfig /all | findstr "DNS Servers"
5, 想切换回自动获取 DNS,可以用这个命令:
# 恢复自动从 DHCP 获取 DNS
netsh interface ip set dns name="Wi-Fi" dhcp
netsh interface ipv6 set dns name="Wi-Fi" dhcp
9806

被折叠的 条评论
为什么被折叠?



