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

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

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

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)

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

相关推荐
XIAOHEZIcode10 小时前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220701 天前
如何搭建本地yum源(上)
运维
大树884 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
摇滚侠4 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
霸道流氓气质4 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
Inhand陈工4 天前
基于台达PLC与映翰通IG502的智慧水产养殖精准投喂与远程运维解决方案
运维·人工智能·物联网·阿里云·信息与通信
网络研究院4 天前
2026年网络安全
网络·安全·法律·法规·趋势·发展
酣大智4 天前
ARP代理--工作原理
运维·网络·arp·arp代理
treesforest4 天前
AI安全系统如何识别异常访问?IP风险识别正在成为关键能力
网络·人工智能·tcp/ip·安全·web安全
shushangyun_4 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化