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 端口