[简洁版]Windows命令行配置IP地址及DNS等

  • 注:以下配置需要使用管理员运行cmd命令行执行
  1. 配置IP
# 查看接口名称:
netsh interface ip show interface
netsh interface ip show config
# 配置接口地址:
netsh interface ipv4 set address name="以太网" static 192.168.10.10 255.255.255.0 192.168.1.1
# 配置dhcp自动获取ip
netsh interface ipv4 set address name="以太网" source=dhcp
  1. 配置DNS
# 配置DNS服务器
netsh interface ipv4 set dnsserver name="以太网" static 223.5.5.5 index=1
netsh interface ipv4 set dnsserver name="以太网" static 223.6.6.6 index=2
# 自动获取
netsh interface ipv4 set dnsserver name="以太网" source=dhcp