您好,欢迎来到知库网。
搜索
您的当前位置:首页Windows命令行设置IP和路由

Windows命令行设置IP和路由

来源:知库网

Windows 路由

Windows路由命令是route

  • route /? 帮助信息
  • route -f 清除所有网关的路由表(管理员权限,会清除默认设置的网关)
  • route print 打印路由表
  • route print -4 仅打印IPv4的路由表

设置默认网关后回有一条0.0.0.0的路由项

Windows IP设置

使用netsh interface ip在命令行中设置IP,可以逐个输入netshinterfaceip而进入命令。

说明:

  • netsh 网络配置命令
  • interface 进入接口配置模式,配置IP地址 (可以简写作int
  • ip 配置IP

常用例子:

# 查看IP(也可使用ipconfig)
netsh interface ip show address
# 设置IP
netsh interface ip set address "连接名称" static IP地址 子网掩码 网关IP
netsh interface ip set address "连接名称" dhcp
netsh interface ip set address "连接名称" gateway=网关IP
# 设置DNS
netsh interface ip set dns "连接名称" static DNS地址
netsh interface ip set dns "连接名称" dhcp
# 重置
netsh interface ipv4 reset

补充

  • 打开网络连接:ncpa.cpl
  • 运行管理员权限:runas /noprofile /user:Administrator cmd
  • 修改提示符:prompt /?

Copyright © 2019- zicool.com 版权所有 湘ICP备2023022495号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务