温馨提示×

netsh命令解析与实例使用

小亿
81
2023-12-19 03:27:55
栏目: 编程语言

netsh是Windows操作系统中的命令行工具,用于管理网络配置和网络接口。它可以用于配置网络适配器、防火墙、路由器等网络相关设置。下面是netsh命令的一些常见用法和示例:

  1. 显示网络适配器的详细信息: netsh interface show interface

  2. 查看当前网络接口的IP地址配置: netsh interface ip show config

  3. 修改网络接口的IP地址配置: netsh interface ip set address “本地连接” static 192.168.0.2 255.255.255.0

  4. 启用或禁用网络接口: netsh interface set interface “本地连接” admin=enable netsh interface set interface “本地连接” admin=disable

  5. 查看当前网络接口的DNS服务器配置: netsh interface ip show dns

  6. 修改网络接口的DNS服务器配置: netsh interface ip set dns “本地连接” static 8.8.8.8

  7. 创建一个新的防火墙规则: netsh advfirewall firewall add rule name=“Block IP” dir=in action=block remoteip=192.168.0.2

  8. 查看当前防火墙规则列表: netsh advfirewall firewall show rule name=all

  9. 删除一个防火墙规则: netsh advfirewall firewall delete rule name=“Block IP”

以上只是netsh命令的一部分用法和示例,还有更多的功能和选项可以根据实际需求进行使用。可以通过在命令提示符窗口中输入"netsh"来查看更多的命令和帮助信息。

0