bash
ping -c 5 example.combash
mtr --report example.combash
ss -tulnpbash
iftop -i eth0bash
tcpdump -i eth0 -w capture.pcapbash
# 服务端
iperf -s
# 客户端
iperf -c server_ipbash
ip link show eth0bash
ip link set eth0 mtu 1500bash
sysctl -w net.ipv4.tcp_window_scaling=1
sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216bash
sysctl -w net.ipv4.tcp_fastopen=3bash
ethtool -g eth0
ethtool -G eth0 rx 4096 tx 4096bash
tc qdisc add dev eth0 root fqbash
ulimit -n
sysctl -w fs.file-max=100000bash
sysctl -w net.netfilter.nf_conntrack_max=1000000bash
ethtool eth0bash
ethtool -L eth0 combined 8# 增加本地端口范围
sysctl -w net.ipv4.ip_local_port_range="1024 65535"
# 启用TCP时间戳
sysctl -w net.ipv4.tcp_timestamps=1
# 减少TIME_WAIT状态时间
sysctl -w net.ipv4.tcp_fin_timeout=30
# 启用TCP复用
sysctl -w net.ipv4.tcp_tw_reuse=1
bash
apt install irqbalance
systemctl enable --now irqbalancebash
for irq in $(grep eth0 /proc/interrupts | awk '{print $1}' | sed 's/://'); do
echo 1 > /proc/irq/$irq/smp_affinity
done通过以上方法综合诊断和优化,可以有效解决Linux系统中的网络阻塞和延迟问题。