转载请注明以下内容:
来源:公众号【网络技术干货圈】
作者:圈圈
ID:wljsghq
Windows
ipconfig /all
Linux/macOS
ifconfig # 或 ip addr show
Windows
route print
Linux/macOS
netstat -r # 或 ip route show
Windows
nslookup
Linux/macOS
cat /etc/resolv.conf
通用
ping 目标地址 # 示例 ping 192.168.1.1 ping www.baidu.com
Windows
tracert 目标地址
Linux/macOS
traceroute 目标地址
Windows
telnet 目标地址 端口号 # 示例 telnet 192.168.1.1 80
Linux/macOS
nc -zv 目标地址 端口号 # 示例 nc -zv 192.168.1.1 80
Windows
ipconfig /release ipconfig /renew
Linux/macOS
sudo dhclient -r sudo dhclient
Windows
netsh interface ip set address "以太网" static 192.168.1.100 255.255.255.0 192.168.1.1
Linux
sudo nano /etc/network/interfaces # 添加以下内容 auto eth0 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1
macOS
sudo networksetup -setmanual "以太网" 192.168.1.100 255.255.255.0 192.168.1.1
Windows
netsh interface ip set dns "以太网" static 8.8.8.8
Linux
sudo nano /etc/resolv.conf # 添加以下内容 nameserver 8.8.8.8
macOS
sudo networksetup -setdnsservers "以太网" 8.8.8.8
Windows
arp -a
Linux/macOS
arp -n
Windows
netstat -ano
Linux/macOS
netstat -tuln
通用
tcpdump -i eth0 -w capture.pcap # 使用Wireshark分析
Windows
sc query
Linux
systemctl status 服务名
macOS
sudo launchctl list | grep 服务名
Windows
net start 服务名 net stop 服务名
Linux
sudo systemctl start 服务名 sudo systemctl stop 服务名
macOS
sudo launchctl start 服务名 sudo launchctl stop 服务名
Windows
netsh advfirewall show allprofiles
Linux
sudo ufw status
macOS
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
Windows
netsh advfirewall firewall show rule name=all
Linux
sudo iptables -L -n -v
macOS
sudo pfctl -s rules
通用
# 使用iperf工具 iperf -c 目标地址
通用
ping 目标地址
通用
ping -c 100 目标地址
Windows
hostname
Linux/macOS
hostname
Windows
netsh interface show interface
Linux/macOS
ip link show
Windows
pathping 目标地址
Linux/macOS
mtr 目标地址
这份速查表涵盖了从基础到高级的常用网络命令,适用于Windows、Linux和macOS系统。无论是日常维护还是故障排查,这些命令都能为您提供强大的支持。建议收藏并定期查阅,以提升网络管理效率。