网络常用配置和运维命令以及使用方法

一、网络运维常见配置及命令

以下是一些整理简单网络常用配置和运维命令

1、ifconfig/ipconfig:查看和配置网络接口配置。

复制代码
用法:ifconfig 或 ipconfig

2、route/netstat -r:查看路由表。

复制代码
用法:route -n 或 netstat -r

3、netstat/ss:查看网络连接状态。

复制代码
用法:netstat 或 ss

4、ping:执行 Ping 测试。

复制代码
用法:ping <目标地址>

5、traceroute/tracert:执行 Traceroute。

复制代码
用法:traceroute 或 tracert <目标地址>

6、nslookup/dig:进行域名解析测试。

复制代码
用法:nslookup 或 dig <域名>

7、ifconfig/netsh interface ip set address:配置静态 IP 地址。

复制代码
用法:ifconfig <接口名称> <IP地址> 或 netsh interface ip set address <接口名称> static <IP地址> <子网掩码> <网关> (Windows)

8、route add default gw:配置默认网关。

复制代码
用法:route add default gw <网关IP>

9、vi /etc/resolv.conf/netsh interface ip set dns:配置 DNS 服务器。

复制代码
用法:vi /etc/resolv.conf (Linux) 或 netsh interface ip set dns <接口名称> static <DNS服务器IP> primary (Windows)

10、ifdown/ifup/ipconfig /release /renew:重启网络接口。

复制代码
用法:ifdown <接口名称> && ifup <接口名称> (Linux) 或 ipconfig /release <接口名称> && ipconfig /renew <接口名称> (Windows)

11、netstat -tuln/netstat -an:列出监听的端口。

复制代码
用法:netstat -tuln (Linux) 或 netstat -an (Windows)

12、iptables/netsh advfirewall firewall:配置防火墙规则。

复制代码
用法:iptables (Linux) 或 netsh advfirewall firewall (Windows)

13、lspci/lsusb/devmgmt.msc:查看网络设备列表。

复制代码
用法:lspci 或 lsusb (Linux) 或 devmgmt.msc (Windows)

14、ifconfig/ipconfig /all:查看网络接口统计信息。

复制代码
用法:ifconfig 或 ipconfig /all (Windows)

15、netstat -p/lsof -i/netstat -o:查看网络连接的进程。

复制代码
用法:netstat -p (Linux) 或 lsof -i (Linux) 或 netstat -o (Windows)

16、ethtool/PowerShell Get-NetAdapterStatistics:查看网络接口速率。

复制代码
用法:ethtool <接口名称> (Linux) 或 PowerShell Get-NetAdapterStatistics (Windows)

17、ethtool -i/PowerShell Get-NetAdapter:查看网络接口状态。

复制代码
用法:ethtool -i <接口名称> (Linux) 或 PowerShell Get-NetAdapter (Windows)

18、vconfig/PowerShell Set-NetAdapterAdvancedProperty:配置 VLAN。

复制代码
用法:vconfig (Linux) 或 PowerShell Set-NetAdapterAdvancedProperty (Windows)

19、iptables/Windows 防火墙规则:配置网络隔离。

复制代码
用法:iptables (Linux) 或 Windows 防火墙规则

20、ip route/PowerShell Set-NetRoute:配置网络负载均衡。

复制代码
用法:ip route (Linux) 或 PowerShell Set-NetRoute (Windows)

21、iftop/PowerShell Get-NetAdapterStatistics:查看网络流量统计。

复制代码
用法:iftop (Linux) 或 PowerShell Get-NetAdapterStatistics (Windows)

22、route add/PowerShell Add-NetRoute:配置静态路由。

复制代码
用法:route add (Linux) 或 PowerShell Add-NetRoute (Windows)

23、vi /etc/ntp.conf/PowerShell w32tm /config:配置网络时间协议 (NTP)。

复制代码
用法:vi /etc/ntp.conf (Linux) 或 PowerShell w32tm /config (Windows)

24、ethtool/PowerShell Get-NetAdapterAdvancedProperty:查看网络接口速度和双工模式

复制代码
用法:ethtool <接口名称> (Linux) 或 PowerShell Get-NetAdapterAdvancedProperty (Windows)

25、ifconfig/ipconfig /all:查看网络接口 MAC 地址。

复制代码
用法:ifconfig 或 ipconfig /all (Windows)

26、arp -d/arp -a -d:清除 ARP 缓存。

复制代码
用法:arp -d 或 arp -a -d (Windows)

27、ifconfig/ipconfig /all:查看网络接口错误统计。

复制代码
用法:ifconfig 或 ipconfig /all (Windows)

28、teamd/PowerShell New-NetLbfoTeam:配置网络接口绑定 (Teaming)。

复制代码
用法:teamd (Linux) 或 PowerShell New-NetLbfoTeam (Windows)

这些命令和配置方法可能会因操作系统和网络设备的不同而略有差异,请根据具体情况和操作系统文档进行适当的调整和使用。

相关推荐
辉视广播对讲6 小时前
医院IPTV,让医疗服务更有温度
网络·人工智能
Tim风声(网络工程师)6 小时前
光功率计中的红光(光衰测试设备)的使用
运维·网络
ar01236 小时前
AR电路巡检:让电力运维进入智能可视化时代
运维·人工智能·ar
星辰徐哥6 小时前
C语言网络编程:TCP、UDP、HTTP深度解析
c语言·网络·tcp/ip
茉莉玫瑰花茶7 小时前
LangGraph 介绍
服务器·网络·数据库
柠檬威士忌9857 小时前
2026-05-09 AI 前沿日报:算力战争、训练网络与前沿模型监管进入新阶段
网络·人工智能
2301_780789668 小时前
云服务器数据会泄露吗?怎么保护云服务器的数据
运维·服务器·tcp/ip·网络安全
念越8 小时前
从网络基础到Socket编程:TCP/UDP原理 + Java实战详解
java·网络·tcp/ip·udp
2301_780789668 小时前
云服务器被黑能恢复吗?云服务器被黑的解决办法
运维·服务器·网络·安全·web安全
AI精钢8 小时前
修复 AI Gateway 图片 MIME 类型错误:用魔数检测替代扩展名猜测
网络·人工智能·python·gateway·aigc