Windows 网络管理命令
本文列出一些常用的 Windows 网络管理命令。
目录
- ping
- 网络信息查询
- netstat
- 网卡信息
- 路由配置
- 查看路由表
- 禁用启用网卡
- 释放、更新地址
- 添加、删除IP地址
ping
ping: 测试网络连接情况
-n
:要发送的回显请求数-t
:ping 主机直到中断-i
:生存时间ttl-6
:IPv6
$ ping 192.168.20.8 -n 3Pinging 192.168.20.8 with 32 bytes of data:
Reply from 192.168.20.8: bytes=32 time<1ms TTL=64
Reply from 192.168.20.8: bytes=32 time<1ms TTL=64
Reply from 192.168.20.8: bytes=32 time<1ms TTL=64Ping statistics for 192.168.20.8:Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 0ms, Average = 0ms
网络信息查询
netstat
netstat: 协议统计和当前 TCP/IP 网络连接
-t
列出所有tcp连接-a
:显示所有连接和侦听端口-n
:以数字形式显示地址和端口号-o
:显示进程 ID-p proto
:显示指定的协议的连接,TCP、UDP、TCPv6 或 UDPv6-s
:显示每个协议的统计。默认情况下,显示IP、IPv6、ICMP、ICMPv6、TCP、TCPv6、UDP 和 UDPv6的统计信息,可使用-p
选项指定协议。-e
:显示以太网统计。此选项可以与 -s 选项结合使用。-r
:显示路由信息
$ netstat -ano -p tcp
Active ConnectionsProto Local Address Foreign Address State PIDTCP 0.0.0.0:21 0.0.0.0:0 LISTENING 4896TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1032TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 10388TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 10388TCP 0.0.0.0:1080 0.0.0.0:0 LISTENING 11476TCP 0.0.0.0:2425 0.0.0.0:0 LISTENING 7728TCP 0.0.0.0:5040 0.0.0.0:0 LISTENING 7940TCP 0.0.0.0:5357 0.0.0.0:0 LISTENING 4
查询5037端口占用:
$ netstat -ano | findstr 5037
TCP 0.0.0.0:5037 0.0.0.0:0 LISTENING 34212
找到对应进程(也可以在任务管理器中查看):
$ tasklist | findstr 34212
adb.exe 34212 Console 1 10,692 K
通过PID或者进程名杀死进程:
$ taskkill -pid 34212 -f -t # taskkill /pid 34212 /f /t
$ taskkill -f -im adb.exe # taskkill /f /im adb.exe
网卡信息
$ ipconfig
$ ipconfig /all
$ netsh interface ipv4 show config
$ netsh interface ipv6 show config
$ wmic nic list brief
查看IP地址:
$ netsh interface ip show address WANConfiguration for interface "WAN"DHCP enabled: YesIP Address: 192.168.3.98Subnet Prefix: 192.168.3.0/24 (mask 255.255.255.0)Default Gateway: 192.168.3.252Gateway Metric: 0InterfaceMetric: 25
$
$ netsh interface ipv4 show dnsservers WANConfiguration for interface "WAN"DNS servers configured through DHCP: 192.168.3.252Register with which suffix: Primary only
更多命令:
$ netsh interface ipv4 show /?The following commands are available:Commands in this context:
show addresses - Shows IP address configurations.
show compartments - Shows compartment parameters.
show config - Displays IP address and additional information.
show destinationcache - Shows destination cache entries.
show dnsservers - Displays the DNS server addresses.
show dynamicportrange - Shows dynamic port range configuration parameters.
show excludedportrange - Shows all excluded port ranges.
show global - Shows global configuration parameters.
show icmpstats - Displays ICMP statistics.
show interfaces - Shows interface parameters.
show ipaddresses - Shows current IP addresses.
show ipnettomedia - Displays IP net-to-media mappings.
show ipstats - Displays IP statistics.
show joins - Displays multicast groups joined.
show neighbors - Shows neighbor cache entries.
show offload - Displays the offload information.
show route - Shows route table entries.
show subinterfaces - Shows subinterface parameters.
show tcpconnections - Displays TCP connections.
show tcpstats - Displays TCP statistics.
show udpconnections - Displays UDP connections.
show udpstats - Displays UDP statistics.
show winsservers - Displays the WINS server addresses.
无线网卡信息:netsh wlan show interface
$ netsh wlan show interfaceThere is 1 interface on the system:Name : WLAN 3Description : Realtek 8832AU Wireless LAN WiFi 6 USB NICGUID : 96c31aeb-d8c6-4d28-8327-444aa5dd04f6Physical address : c8:3a:35:c1:11:14State : connectedSSID : test_5GBSSID : 50:2b:73:c3:72:06Network type : InfrastructureRadio type : 802.11axAuthentication : WPA2-PersonalCipher : CCMPConnection mode : ProfileChannel : 64Receive rate (Mbps) : 1201Transmit rate (Mbps) : 1201Signal : 100%Profile : test_5GHosted network status : Not available
断开无线WiFi:
$ netsh wlan disconnect
更多netsh wlan
命令:
$ netsh wlan /?The following commands are available:Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a table.
connect - Connects to a wireless network.
delete - Deletes a configuration entry from a table.
disconnect - Disconnects from a wireless network.
dump - Displays a configuration script.
export - Saves WLAN profiles to XML files.
help - Displays a list of commands.
IHV - Commands for IHV logging.
refresh - Refresh hosted network settings.
reportissues - Generate WLAN smart trace report.
set - Sets configuration information.
show - Displays information.
start - Start hosted network.
stop - Stop hosted network.
路由配置
route add [Destination] mask [netmask] [gw] metric [测量值]
- -p:添加永久路由
- Destination: 指定该路由的网络目标。
- mask:当添加一个网络路由时,需要使用网络掩码。
- gw:路由数据包通过网关。注意,你指定的网关必须能够达到。
- metric:设置路由跳数。
# ipv4
$ route -p add 23.23.23.0 mask 255.255.255.0 192.168.97.60
route delete 23.23.23.0
# ipv6
$ netsh interface ipv6 add/del route 2001::/64 "Local Area Connection 2" 2001::2
查看路由表
$ netstat -r
$ route print
$ route print -4
$ route print -6
$ netsh interface ipv4 show route
$ netsh interface ipv6 show route
禁用启用网卡
$ netsh interface set interface eth0 disabled # 禁用网卡
$ netsh interface set interface name="接口名称" admin=DISABLE$ netsh interface set interface eth0 enabled #启用网卡
$ netsh interface set interface name="接口名称" admin=ENABLE$ netsh interface ipv6 set interface name="接口名称" disable/enable$ netsh interface show interface #显示接口
通过python脚本自动化控制:
import os
os.popen('netsh interface set interface name="接口名称" admin=DISABLE')
释放、更新地址
# ipv4
$ ipconfig /release
$ ipconfig /renew
# ipv6
$ ipconfig /release6
$ ipconfig /renew6
添加、删除IP地址
# ipv4
$ netsh interface ip add address "本地连接" 192.168.1.100 255.255.255.0
$ netsh interface ip delete address "本地连接" 192.168.1.100
## 设置静态IP地址
$ netsh interface ip set address name="eth1" source=static address=192.168.5.125 mask=255.255.255.0# ipv6
$ netsh interface ipv6 delete address 本地连接 2001::1
$ netsh interface ipv6 add/del address 本地连接 2001::1
--THE END--
Windows 网络管理命令相关推荐
- Windows运行命令收集
收集的一些有用的Windows运行命令. winver 检查Windows版本 wmimgmt.msc 打开Windows管理体系结构(wmi) wupdmgr Windows更新程 ...
- windows常用命令行操作及相关快捷方式
下面是个人总结的windows命令行和常用命令,和大家一起交流下! 本文从命令行基础命令,编写命令快捷键,文件操作命令,service服务操作命令, 启动系统应用 ...
- nslookup网络管理命令行工具
基础命令学习目录首页 nslookup是一种网络管理命令行工具,可用于查询DNS域名和IP地址输入指令nslookup默认服务器和Address是当前上网所用的DNS服务器域名和地址A记录A(Addr ...
- windows相关命令
winver 检查Windows版本 wmimgmt.msc 打开Windows管理体系结构(wmi) wupdmgr Windows更新程序 w脚本 Windows脚本宿主设置 write ...
- 用windows运行命令打开
1. gpedit.msc-----组策略 2. sndrec32-------录音机 3. Nslookup-------IP地址侦测器 4. explorer-------打开资源管理器 5. l ...
- windows 全部命令
dos命令 ESC:清除当前命令行: F7:显示命令历史记录,以图形列表窗的形式给出所有曾经输入的命令,并可用上下箭头键选择再次执行该命令. F8:搜索命令的历史记录,循环显示所有曾经输入的命令,直到 ...
- 常见WINDOWS运行命令
常见WINDOWS运行命令 gpedit.msc-----组策略 sndrec32-------录音机 Nslookup-------IP地址侦测器 explorer-------打开资源管理器 lo ...
- windows 网络命令大全
windows网络命令大全 Windows 2k/2003 Server 1.最基本,最常用的,测试物理网络的 ping 192.168.10.88 -t ,参数-t是等待用户去中断测试 2.查看 ...
- windows网络命令大全
windows网络命令大全 网络命令行操作 Windows 2k/2003 Server 1.最基本,最常用的,测试物理网络的 ping 192.168.10.88 -t ,参数-t是等待用户去中断测 ...
最新文章
- Hadoop hdfs完全分布式搭建教程
- [转载]Mysql数据库千万级数据处理优化
- 星际2的一些技术特性
- django 表单html5,我们如何在django管理表单中添加动态html5数据属性
- Python计算并可视化商品批发时商家收益和顾客节省情况
- 用mysql建立商城数据字典_把mysql数据库生成数据字典,直接可用
- jQuery 笔记目录
- Linux服务器挂载ntfs移动硬盘
- python开发工具和框架安装器_Python基础框架和工具
- everything开启服务器功能
- Socket Tools的使用
- 系统分析师论文通用格式
- C语言大作业:车辆信息管理系统
- 计算机ping使用的端口,ping端口命令是什么
- Java基础面试题(持续更新)
- 未来的计算机作文2000字,未来的模样作文2000字
- 【5G核心网】5GC核心网之网元AMF
- 【C++】Win10设置默认程序
- MySQL空间函数——ST_AsText走过的坑
- 猫学习IOS(四)UI半小时就搞定Tom猫
热门文章
- 三菱FX5U-绝对定位指令 DRVA(DDRVA) 两种写法
- 华为计算机单机pc游戏软件,华为应用市场pc端
- 解决“TypeError: Cannot read properties of undefined (reading ‘push‘)“
- 寄存器英文全称中文翻译英文对照表
- MySQL面试高薪指南
- 2020 EC Final 诸事不顺记
- 某大型合资企业审批系统上线经验教训总结
- 如何在Ubuntu系统 上登录北理工教务处查看选项(转自FTP联盟)亲测成功
- java replace无效_Java String.replace()方法无效的原因及解决方式
- 百业升级 共启新程——CDEC2021中国数字智能生态大会武汉站今日举行