哥伦布

博客园 首页 新随笔 联系 订阅 管理

显示网络适配器状态

netsh interface show interface
显示各个网络适配器的名称和状态
image

启用(禁用)网络适配器

本系列命令需要以“以管理员身份运行”。

  • 禁用网络适配器命令
    netsh interface set interface "公司网络" disabled

  • 启用网络适配器命令
    netsh interface set interface "公司网络" enabled

设置IP地址

本系列命令需要以“以管理员身份运行”。

  • 固定IP模式
    netsh interface ip set address
    用法 : set address [name=] [[addr=]IP address [mask=]IP subnet mask] [[gateway=]IP address [gwmetric=]integer]
    netsh interface ip add address name="公司网络" addr=192.168.200.182 mask=255.255.255.0 gateway=192.168.200.254

  • 动态IP(DHCP)
    netsh interface ip set address name="公司网络" source=dhcp

set address命令用来为适配器设置一个IP,原来的IP会被清除并使用这个IP地址替换

增加IP地址

本系列命令需要以“以管理员身份运行”。
netsh interface ip add address
用法 : add address [name=] [[addr=]IP address [mask=]IP subnet mask] [[gateway=]IP address [gwmetric=]integer]
netsh interface ip add address name="公司网络" addr=192.168.200.182 mask=255.255.255.0 gateway=192.168.200.254
add address命令用来新增一个IP,原来的IP并不会被删除(或替换)

设置DNS地址

本系列命令需要以“以管理员身份运行”。

  • 添加一个固定DNS服务器IP
    netsh interface ip add dns name="公司网络" addr=114.114.114.114
  • 删除一个固定DNS服务器IP
    netsh interface ip del dns name="公司网络" addr=114.114.114.114
  • 动态IP(DHCP)
    netsh interface ip set dns name="公司网络" source=dhcp
posted on 2023-04-14 17:29  Caraxes  阅读(701)  评论(0)    收藏  举报