ethtool

Ethtool是Linux下用於查詢及設定網卡參數的命令。

基本介紹

  • 中文名:ethtool
  • 外文名:ethtool
  • 基本:/查詢ethX網口基本設定
  • 用於查詢:及設定網卡參數的命令
概要,舉例,相關,

概要

ethtool ethX /
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]\ //設定網口速率10/100/1000M
[duplex half|full]\ //設定網口半/全雙工
[autoneg on|off]\ //設定網口是否自協商
[port tp|aui|bnc|mii]\ //設定網口類型
[phyad N]\
[xcvr internal|exteral]\
[wol p|u|m|b|a|g|s|d...]\
[sopass xx:yy:zz:aa:bb:cc]\
[msglvl N]

舉例

1)[root@linux /]# ethtool eth1
Settings for eth1:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/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
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
/sbin/ethtool
2)[root@linux /]# rpm -qf /sbin/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 -a|--show-pause DEVNAME Show pause options 顯示相應設備中止選項設定情況
ethtool -A|--pause DEVNAME Set pause options 對相應設備進行中止選項設定
[ autoneg on|off ]
[ rx on|off ]
[ tx on|off ]
ethtool -c|--show-coalesce DEVNAME Show coalesce options 顯示相應設備聯合選項設定情況
ethtool -C|--coalesce DEVNAME Set coalesce options 對相應設備進行聯合選項設定
[adaptive-rx on|off]
[adaptive-tx on|off]
[rx-usecs N]
[rx-frames N]
[rx-usecs-irq N]
[rx-frames-irq N]
[tx-usecs N]
[tx-frames N]
[tx-usecs-irq N]
[tx-frames-irq N]
[stats-block-usecs N]
[pkt-rate-low N]
[rx-usecs-low N]
[rx-frames-low N]
[tx-usecs-low N]
[tx-frames-low N]
[pkt-rate-high N]
[rx-usecs-high N]
[rx-frames-high N]
[tx-usecs-high N]
[tx-frames-high N]
[sample-interval N]
ethtool -g|--show-ring DEVNAME Query RX/TX ring parameters 查詢接收/傳送迴環參數
ethtool -G|--set-ring DEVNAME Set RX/TX ring parameters 設定接收/傳送迴環參數
[ rx N ]
[ rx-mini N ]
[ rx-jumbo N ]
[ tx N ]
ethtool -k|--show-offload DEVNAME Get protocol offload information 獲取協定卸載信息
ethtool -K|--offload DEVNAME Set protocol offload 設定協定卸載
[ rx on|off ]
[ tx on|off ]
[ sg on|off ]
[ tso on|off ]
[ ufo on|off ]
[ gso on|off ]
ethtool -i|--driver DEVNAME Show driver information 顯示相應設備的驅動信息
ethtool -d|--register-dump DEVNAME Do a register dump 暫存器轉存
ethtool -e|--eeprom-dump DEVNAME Do a EEPROM dump EEPROM轉存
[ raw on|off ]
[ offset N ]
[ length N ]
ethtool -E|--change-eeprom DEVNAME Change bytes in device EEPROM 更改設備EEPROM中的位元組
[ magic N ]
[ offset N ]
[ value N ]
ethtool -r|--negotiate DEVNAME Restart N-WAY negotation 重啟N路互動
ethtool -p|--identify DEVNAME Show visible port identification (e.g. blinking) 顯示可見的連線埠識別(比如相應連線埠指示燈會亮)
[ TIME-IN-SECONDS ]
ethtool -t|--test DEVNAME Execute adapter self test 執行適配器自我測試
[ online | offline ]
ethtool -S|--statistics DEVNAME Show adapter statistics 顯示適配器的統計信息
ethtool -h|--help DEVNAME Show this help 顯示幫助
查詢網路連線埠位置:ethtool -p ethX
這個命令多用於管理多網口的伺服器主機,由於背板的網路連線埠數量大,有時候不知道那個物理連線埠對應eth0或其他設備號,我們就可以使用這個命令來查詢。
用法:ethtool -p eth0
效果:設備號eth0對應的物理連線埠的兩個指示燈會閃爍
修改網路連線埠速率:ethtool -s
這個命令多用於手工設定網路速率,一般千兆網卡支持10|100|1000三個速率,單位是Mbps。 用法:ethtool -s eth0 speed 1000 duplex full autoneg off
效果:將設備號eth0對應的物理連線埠設定為速率為1000Mbps,全雙工工作模式,同時關閉自動協商。

相關詞條

熱門詞條

聯絡我們