Linux网络故障排查
- Linux网络故障排查命令
- 查看网卡信息
- 查看网卡基本信息
- 查看网卡驱动
- MTR
- Windows安装mtr
- Linux安装mtr
- MTR基本用法
- BestTrace路由分析:
- 安装BestTrace包
- besttrace基本用法
- iftop(查看网卡流量状态)
- 安装iftop
- iftop基本用法
- 查看哪个连接占用流量最多
- 不解析域名,所有的网络连接都以ip显示
- 指定监控网卡
- ss命令常见方法
- 端口查找
- 网络通信
- netstat
- 查询端口使用情况
- 只列出监听中的连接
ping
# 路由追踪
traceroute
# mtr命令查看在哪里丢包,相当于ping和traceroute命令的组合
mtr
# 实时查看网络质量
mtr baidu.com
# 显示mtr报告
mtr -r 114.114.114.114
# tcpdump抓包排查网络故障
tcpdump
# ss命令和netstat参数一样,格式不一样
ss
netstat

例如: 要查看你的网卡的速率
ethtool参数非常多,需要自己扩展了解
网卡速率等信息
ethtool eth0
ethtool -i eth0
相当于 ping+tracert
WinMTR.zip
# 下载 WinMTR 工具并安装。
在 https://github.com/oott123/WinMTR/releases GitHub上下载 MTR专用工具,
该工具为免安装,下载后可以直接使用。
# Debian/Ubuntu 系统
sudo apt install mtr
# RedHat/CentOS 系统
sudo yum install mtr
mtr qq.com
BestTrace查看VPS的去程和回程
#下载BestTrace包
wget https://cdn.ipip.net/17mon/besttrace4linux.zip
#解压
unzip besttrace4linux.zip
#移动到可执行目录
sudo mv besttrace /usr/local/bin/
#执行权限
chmod a+x besttrace
#或
chmod u+s besttrace
#必须以root运行
##追踪ip或域名
sudo besttrace 114.114.114.114
需要epel
# 启用epel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 安装iftop
yum install iftop -y
# 查看eth0哪个连接网络流量最多
iftop -P
iftop -n
# 不加i参数表示监控所有网卡
iftop
# 指定网卡
iftop -i eth0
# 指定网卡且不解析dns
iftop -n -i eth0
ss -ntpl
# -n参数:看到的时端口而不是服务名称
# -t参数:只列出TCP
# -l参数: 列出当前正在监听的套接字,而不是列出所有套接字
- ping
- ifconfig
- ip a
- -ano
- 例如 netstat -ano | grep 3306
- -tunlp(最常用)
- 例如 netstat -tunlp | grep 1080
netstat -tnl |grep 端口