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

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

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

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)

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

相关推荐
Canmag 兴隆磁性6 小时前
中大型钕铁硼产品的磁通测量与自动分选:一条产线自动化的工程实现思路
运维·学习·自动化·永磁材料
xuefeiniao8 小时前
PHP2Shell漏洞修复
运维·服务器·php
便利店10249 小时前
系统活动一抓留存!深入 Linux C/C++ 调试工具之 sysdig
linux·运维·服务器·sysdig
g3voip10 小时前
工业防水电话到底怎么选?隧道、管廊与码头的需求差异
服务器·网络·信息与通信·ip
智能运维指南10 小时前
企业 IT 运维自动化平台怎么选?从场景匹配到 POC 验证的完整评估框架
运维·自动化·自动化运维·嘉为蓝鲸
珠海西格电力10 小时前
零碳园区管理系统的性能评估体系的行业标准
大数据·网络·人工智能·物联网·机器学习·架构·能源
.Bryce.10 小时前
从强化学习到Agentic RL:让Agent在“干活“中自己变聪明
服务器·网络·agent·rag·agentic rl
toooooop811 小时前
CentOS 7 内核 3.10.0-1160.119.1 升级指南
linux·运维·centos
云飞云共享云桌面11 小时前
广东东莞制造工厂10人共享一台三维设计服务器
运维·服务器·3d·自动化·制造
NetInside_11 小时前
Unknown,不应该是网络分析的终点
网络