生產中有一台linux裝置併發比較大,droped包比較多,尤其是在跑遊戲資料報的時候,存在嚴重的丟包現象,懷疑網絡卡效能不足,在更換裝置前想能不有通過軟體方法解決,通過網上一些資料顯示,出現這種現象,也有可能是網絡卡buffer size 太小的原因,遂嘗試更改buffer 大小解決,下面的裝置執行了64天,丟包超過20多億 .
ethtool命令用於獲取乙太網卡的配置資訊,或者修改這些配置
-a 檢視網絡卡中 接收模組rx、傳送模組tx和autonegotiate模組的狀態:啟動on 或 停用off。
-a 修改網絡卡中 接收模組rx、傳送模組tx和autonegotiate模組的狀態:啟動on 或 停用off。
-c display the coalesce information of the specified ethernet card。
-c change the coalesce setting of the specified ethernet card。
-g display the rx/tx ring parameter information of the specified ethernet card。
-g change the rx/tx ring setting of the specified ethernet card。
-i 顯示網絡卡驅動的資訊,如驅動的名稱、版本等。
-d 顯示register dump資訊, 部分網絡卡驅動不支援該選項。
-e 顯示eeprom dump資訊,部分網絡卡驅動不支援該選項。
-e 修改網絡卡eeprom byte。
-k 顯示網絡卡offload引數的狀態:on 或 off,包括rx-checksumming、tx-checksumming等。
-k 修改網絡卡offload引數的狀態。
-p 用於區別不同ethx對應網絡卡的物理位置,常用的方法是使網絡卡port上的led不斷的閃;n指示了網絡卡閃的持續時間,以秒為單位。
-r 如果auto-negotiation模組的狀態為on,則restarts auto-negotiation。
-s 顯示nic- and driver-specific 的統計引數,如網絡卡接收/傳送的位元組數、接收/傳送的廣播包個數等。
-t 讓網絡卡執行自我檢測,有兩種模式:offline or online。
-s 修改網絡卡的部分配置,包括網絡卡速度、單工/全雙工模式、mac位址等。
檢視當前網絡卡的buffer size情況
ethtool -g eth0
ring parameters for eth0:
pre-set maximums:
rx: 4096rx mini: 0
rx jumbo: 0
tx: 4096
current hardware settings:
rx: 256
rx mini: 0
rx jumbo: 0
tx: 256
由於我的是rx包會有droped的情況
我們用ethtool -g eth0 rx 2048
同樣對於eth1也是如此
ethtool -g eth1 rx 2048
再看看修改過後的ethtool -g eth0
ring parameters for eth0:
pre-set maximums:
rx: 4096
rx mini: 0
rx jumbo: 0
tx: 4096
current hardware settings:
rx: 2048
rx mini: 0
rx jumbo: 0
tx: 2048
命令描述:
ethtool 是用於查詢及設定網絡卡引數的命令。
使用概要:
ethtool ethx //查詢ethx網口基本設定,其中 x 是對應網絡卡的編號,如eth0、eth1等等
ethtool –h //顯示ethtool的命令幫助(help)
ethtool –i ethx //查詢ethx網口的相關資訊
ethtool –d ethx //查詢ethx網口註冊性資訊
ethtool –r ethx //重置ethx網口到自適應模式
ethtool –s ethx //查詢ethx網口收發包統計
ethtool –s ethx [speed 10|100|1000] [duplex half|full] [autoneg on|off] //設定網口速率10/100/1000m、設定網口半/全雙工、設定網口是否自協商
使用舉例:
1)[root@linux /]#
ethtool eth1
settings for eth1:
supported ports: [ tp ]
supported link modes: 10baset/half 10baset/full
100baset/half 100baset/full
1000baset/full
supports auto-negotiation: yes
advertised link modes: 10baset/half 10baset/full
100baset/half 100baset/full
1000baset/full
advertised auto-negotiation: yes
speed: 1000mb/s
duplex: full
port: twisted pair
phyad: 0
transceiver: internal
auto-negotiation: on
supports wake-on: umbg
wake-on: d
link detected: yes
2)[root@linux /]#
ethtool -i eth1
driver: e1000
version: 5.0.43-k1
firmware-version: n/a
bus-info: 06:08.1
3)[root@linux /]#
ethtool -s eth1
nic statistics:
rx_packets: 58068300
tx_packets: 87124083
rx_bytes: 1589713008
tx_bytes: 2165825901
rx_errors: 0
tx_errors: 0
rx_dropped: 0
tx_dropped: 0
multicast: 0
collisions: 0
rx_length_errors: 0
rx_over_errors: 0
rx_crc_errors: 0
rx_frame_errors: 0
rx_fifo_errors: 0
rx_missed_errors: 0
tx_aborted_errors: 0
tx_carrier_errors: 0
tx_fifo_errors: 0
tx_heartbeat_errors: 0
tx_window_errors: 0
4)[root@linux /]#
ethtool -s eth1 autoneg off speed 100 duplex full
相關參考:
1)[root@linux /]# which ethtool //查詢 ethtool 存放的路徑
/sbin/ethtool
2)[root@linux /]# rpm -qf /sbin/ethtool //查詢 ethtool 的版本資訊
ethtool-1.6-5
3)將 ethtool 設定永久儲存在網路裝置的方法
解決方法一:
ethtool 設定可通過 /etc/sysconfig/network-scripts/ifcfg-ethx 檔案儲存,從而在裝置下次啟動時啟用選項
。 例如:ethtool -s eth0 speed 100 duplex full autoneg off
此指令將eth0裝置設定為全雙工自適應,速度為100mbs。若要eth0啟動時設定這些引數, 修改檔案/etc/sysconfig/network-scripts/ifcfg-eth0 ,
新增如下一行:
ethtool_opts="speed 100 duplex full autoneg off"
解決方法二:
將ethtool設定寫入/etc/rc.d/rc.local之中。
ethtool 命令詳解
命令描述 ethtool 是用於查詢及設定網絡卡引數的命令。使用概要 ethtool ethx 查詢ethx網口基本設定,其中 x 是對應網絡卡的編號,如eth0 eth1等等 ethtool h 顯示ethtool的命令幫助 help ethtool i ethx 查詢ethx網口的相關資訊 et...
ethtool 命令詳解
ethtool 是用於查詢及設定網絡卡引數的命令。使用概要 ethtool enp5s0fx 查詢ethx網口基本設定,其中 x 是對應網絡卡的編號,如enp5s0fx 等等 ethtool h 顯示ethtool的命令幫助 help ethtool i enp5s0fx 查詢ethx網口的相關資訊...
Linux命令之Ethtool用法詳解
描述 ethtool是用於查詢及設定網絡卡引數的命令。概要 ethtool ethx 查詢ethx網口基本設定 ethtool h 顯示ethtool的命令幫助 help ethtool i ethx 查詢ethx網口的相關資訊 ethtool d ethx 查詢ethx網口註冊性資訊 ethtoo...