ethtool -g eth0
輸出含 Pre-set maximums(硬體上限)與 Current hardware settings(目前值)。
ethtool -G eth0 rx 2048
ethtool -G eth0 tx 2048
數值不得超過 Pre-set maximums 顯示的上限。常見預設 256/512,調至 1024/2048 通常即可改善。
ping -c 10 8.8.8.8
觀察丟包率是否歸零。
echo 'ethtool -G eth0 rx 2048' >> /etc/rc.local
echo 'ethtool -G eth0 tx 2048' >> /etc/rc.local
chmod +x /etc/rc.local
CentOS 7+ 建議改用 NetworkManager dispatcher 腳本或 systemd 服務單元。
-g:查詢 RX/TX 參數-G:設定 RX/TX 參數rx:接收環大小;tx:傳送環大小