【Linux】一步一步学Linux——ethtool命令(155)
生活随笔
收集整理的這篇文章主要介紹了
【Linux】一步一步学Linux——ethtool命令(155)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
00. 目錄
文章目錄
- 00. 目錄
- 01. 命令概述
- 02. 命令格式
- 03. 常用選項
- 04. 參考示例
- 05. 總結(jié)
- 06. 附錄
01. 命令概述
ethtool命令用于查詢ethX網(wǎng)口基本設(shè)置、及設(shè)置網(wǎng)卡的參數(shù)。
命令比較復(fù)雜,功能特別多。
02. 命令格式
ethtool [ -a | -c | -g | -i | -d | -k | -r | -S |] ethX ethtool [-A] ethX [autoneg on|off] [rx on|off] [tx on|off] ethtool [-C] ethX [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-lowN] [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] ethX [rx N] [rx-mini N] [rx-jumbo N] [tx N] ethtool [-e] ethX [raw on|off] [offset N] [length N] ethtool [-E] ethX [magic N] [offset N] [value N] ethtool [-K] ethX [rx on|off] [tx on|off] [sg on|off] [tso on|off] ethtool [-p] ethX [N] ethtool [-t] ethX [offline|online] ethtool [-s] ethX [speed 10|100|1000] [duplex half|full] [autoneg on|off] [port tp|aui|bnc|mii] [phyad N] [xcvr internal|external] [wol p|u|m|b|a|g|s|d...] [sopass xx:yy:zz:aa:bb:cc] [msglvl N]03. 常用選項
-a 查看網(wǎng)卡中 接收模塊RX、發(fā)送模塊TX和Autonegotiate模塊的狀態(tài):啟動on 或 停用off。 -A 修改網(wǎng)卡中 接收模塊RX、發(fā)送模塊TX和Autonegotiate模塊的狀態(tài):啟動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 顯示網(wǎng)卡驅(qū)動的信息,如驅(qū)動的名稱、版本等。 -d 顯示register dump信息, 部分網(wǎng)卡驅(qū)動不支持該選項。 -e 顯示EEPROM dump信息,部分網(wǎng)卡驅(qū)動不支持該選項。 -E 修改網(wǎng)卡EEPROM byte。 -k 顯示網(wǎng)卡Offload參數(shù)的狀態(tài):on 或 off,包括rx-checksumming、tx-checksumming等。 -K 修改網(wǎng)卡Offload參數(shù)的狀態(tài)。 -p 用于區(qū)別不同ethX對應(yīng)網(wǎng)卡的物理位置,常用的方法是使網(wǎng)卡port上的led不斷的閃;N指示了網(wǎng)卡閃的持續(xù)時間,以秒為單位。 -r 如果auto-negotiation模塊的狀態(tài)為on,則restarts auto-negotiation。 -S 顯示NIC- and driver-specific 的統(tǒng)計參數(shù),如網(wǎng)卡接收/發(fā)送的字節(jié)數(shù)、接收/發(fā)送的廣播包個數(shù)等。 -t 讓網(wǎng)卡執(zhí)行自我檢測,有兩種模式:offline or online。 -s 修改網(wǎng)卡的部分配置,包括網(wǎng)卡速度、單工/全雙工模式、mac地址等。04. 參考示例
4.1 查詢網(wǎng)卡基本設(shè)置
[deng@localhost ~]$ ethtool ens33 Settings for ens33:Supported ports: [ TP ]Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: NoSupports auto-negotiation: YesSupported FEC modes: Not reportedAdvertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: NoAdvertised auto-negotiation: YesAdvertised FEC modes: Not reportedSpeed: 1000Mb/sDuplex: FullPort: Twisted PairPHYAD: 0Transceiver: internalAuto-negotiation: onMDI-X: off (auto) Cannot get wake-on-lan settings: Operation not permittedCurrent message level: 0x00000007 (7)drv probe linkLink detected: yes [deng@localhost ~]$4.2 查詢網(wǎng)卡驅(qū)動相關(guān)信息
[deng@localhost ~]$ ethtool -i ens33 driver: e1000 version: 7.3.21-k8-NAPI firmware-version: expansion-rom-version: bus-info: 0000:02:01.0 supports-statistics: yes supports-test: yes supports-eeprom-access: yes supports-register-dump: yes supports-priv-flags: no [deng@localhost ~]$4.3 查詢網(wǎng)卡收發(fā)包統(tǒng)計
[deng@localhost ~]$ ethtool -S ens33 NIC statistics:rx_packets: 15796742tx_packets: 31586rx_bytes: 4802989050tx_bytes: 56491284.4 查詢網(wǎng)卡注冊信息
[root@localhost ~]# ethtool -d ens33 MAC Registers ------------- 0x00000: CTRL (Device control register) 0x00C00249Endian mode (buffers): littleLink reset: resetSet link up: 1Invert Loss-Of-Signal: no4.5 設(shè)置網(wǎng)卡自適應(yīng)模式
[root@localhost ~]# ethtool -r ens33 [root@localhost ~]#4.6 設(shè)置網(wǎng)卡速率等信息
[root@localhost ~]# ethtool -s ens33 autoneg off speed 100 duplex full4.7 停止網(wǎng)卡的發(fā)送模塊TX
[root@localhost ~]# ethtool -A tx off ens334.8 設(shè)置網(wǎng)卡速率為100M
[root@localhost ~]# ethtool -s ens33 speed 1004.9 使網(wǎng)卡燈閃爍10次
[root@localhost ~]# ethtool -p ens33 10 [root@localhost ~]#操作完畢后,看哪塊網(wǎng)卡的led燈在閃,eth0就對應(yīng)著哪塊網(wǎng)卡。
4.10 顯示網(wǎng)卡Offload參數(shù)的狀態(tài)
[root@localhost ~]# ethtool -k ens33 Features for ens33: rx-checksumming: off tx-checksumming: ontx-checksum-ipv4: off [fixed]tx-checksum-ip-generic: ontx-checksum-ipv6: off [fixed]tx-checksum-fcoe-crc: off [fixed]tx-checksum-sctp: off [fixed]4.11 關(guān)閉網(wǎng)卡對收到的數(shù)據(jù)包的校驗功能
[root@localhost ~]# ethtool -K ens33 rx off4.12 顯示EEPROM dump信息
[root@localhost ~]# ethtool -e ens33 Offset Values ------ ------ 0x0000: 00 50 56 26 d8 88 20 04 ff ff ff ff ff ff ff ff 0x0010: 00 00 00 00 0b 46 50 07 ad 15 0f 10 86 80 e8 01 0x0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x0040: de df 61 78 0c 28 00 00 c8 00 ff ff ff ff ff ff 0x0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff 02 06 0x0060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x0070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 3a 0x0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x0090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [root@localhost ~]#05. 總結(jié)
06. 附錄
參考:【Linux】一步一步學(xué)Linux系列教程匯總
總結(jié)
以上是生活随笔為你收集整理的【Linux】一步一步学Linux——ethtool命令(155)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Linux】一步一步学Linux——m
- 下一篇: 【Linux】一步一步学Linux——d