ethtool工具用法学习

来源:互联网 发布:淘宝联盟挣钱吗 编辑:程序博客网 时间:2024/06/07 02:35
ethtool是用于查询和设置网卡参数的工具。
http://blog.chinaunix.net/uid-24830931-id-3651481.html
ethtool version 3.9
Usage:
        ethtool DEVNAME Display standard information about device
      

点击(此处)折叠或打开

  1. 查看设备的基本信息,可以查看到网卡当前速度设置等重要信息
  2. ethtool p2p1
  3. Settings for p2p1:
  4. Supported ports: [ FIBRE ] 光纤
  5. Supported link modes: 10000baseT/Full 万兆网卡
  6. Supports auto-negotiation: No 是否支持自动协商
  7. Advertised link modes: 10000baseT/Full 万兆全双工
  8. Advertised pause frame use: No 停止帧
  9. Advertised auto-negotiation: No 自动协商
  10. Speed: 10000Mb/s 当前速度
  11. Duplex: Full 全双工
  12. Port: FIBRE 光口
  13. PHYAD: 0
  14. Transceiver: external
  15. Auto-negotiation: off
  16. Supports Wake-on: d
  17. Wake-on: d
  18. Current message level: 0x00000007 (7)
  19. Link detected: yes
        ethtool -s|--change DEVNAME     Change generic options
                [ speed %d ]  设置网卡速度
                [ duplex half|full ] 设置半双工/全双工
                [ port tp|aui|bnc|mii|fibre ]
                [ mdix auto|on|off ]
                [ autoneg on|off ] 自动协商
                [ advertise %x ]
                [ phyad %d ]
                [ xcvr internal|external ]
                [ wol p|u|m|b|a|g|s|d... ]
                [ sopass %x:%x:%x:%x:%x:%x ]
                [ msglvl %d | msglvl type on|off ... ]
        ethtool -a|--show-pause DEVNAME Show pause options 查看pause?选项
        ethtool -A|--pause DEVNAME      Set pause options 设置pause选项
                [ 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-features|--show-offload DEVNAME       Get state of protocol offload and other features
       

点击(此处)折叠或打开

  1. ./ethtool -k p2p1 tso, gro, gso, lro等设置,往往引发lb各种悲剧
  2. Features for p2p1:
  3. rx-checksumming: on
  4. tx-checksumming: on
  5. scatter-gather: on
  6. tcp-segmentation-offload: on
  7. udp-fragmentation-offload: off
  8. generic-segmentation-offload: on
  9. generic-receive-offload: on
  10. large-receive-offload: on
  11. rx-vlan-offload: on
  12. tx-vlan-offload: on
  13. ntuple-filters: off
  14. receive-hashing: off
        ethtool -K|--features|--offload DEVNAME Set protocol offload and other features 上述查看工具对应的设置工具
                FEATURE on|off ...
        ethtool -i|--driver DEVNAME     Show driver information  驱动信息,查看驱动版本信息的简单方法
        ethtool -d|--register-dump DEVNAME      Do a register dump
                [ raw on|off ]
                [ file FILENAME ]
        ethtool -e|--eeprom-dump DEVNAME        Do a EEPROM dump
                [ raw on|off ]
                [ offset N ]
                [ length N ]
        ethtool -E|--change-eeprom DEVNAME      Change bytes in device EEPROM
                [ magic N ]
                [ offset N ]
                [ length N ]
                [ value N ]
        ethtool -r|--negotiate DEVNAME  Restart N-WAY negotiation
        ethtool -p|--identify DEVNAME   Show visible port identification (e.g. blinking)
               [ TIME-IN-SECONDS ]
        ethtool -t|--test DEVNAME       Execute adapter self test
               [ online | offline | external_lb ]
        ethtool -S|--statistics DEVNAME Show adapter statistics
       

点击(此处)折叠或打开

  1. ./ethtool -S p2p1 各种统计数据,精确到队列级别,对于流量统计非常有用
  2. NIC statistics:
  3. rx_packets: 1027588268
  4. tx_packets: 6
  5. rx_bytes: 61655296080
  6. tx_bytes: 468
  7. rx_errors: 0
  8. tx_errors: 0
  9. rx_dropped: 0
  10. tx_dropped: 0
  11. multicast: 0
  12. collisions: 0
  13. rx_over_errors: 0
  14. rx_crc_errors: 0
  15. rx_frame_errors: 0
  16. rx_fifo_errors: 0
  17. rx_missed_errors: 605876
  18. tx_aborted_errors: 0
  19. tx_carrier_errors: 0
  20. tx_fifo_errors: 0
  21. tx_heartbeat_errors: 0
  22. rx_pkts_nic: 4406116906
  23. tx_pkts_nic: 6
  24. rx_bytes_nic: 264850404288
  25. tx_bytes_nic: 492
  26. lsc_int: 10
  27. tx_busy: 0
  28. non_eop_descs: 0
  29. broadcast: 0
  30. rx_no_buffer_count: 0
  31. tx_timeout_count: 0
  32. tx_restart_queue: 0
  33. rx_long_length_errors: 0
  34. rx_short_length_errors: 0
  35. tx_flow_control_xon: 58915
  36. rx_flow_control_xon: 0
  37. tx_flow_control_xoff: 187078
  38. rx_flow_control_xoff: 0
  39. rx_csum_offload_errors: 0
  40. alloc_rx_page_failed: 0
  41. alloc_rx_buff_failed: 0
  42. lro_aggregated: 0
  43. lro_flushed: 0
  44. lro_recycled: 0
  45. rx_no_dma_resources: 3116649674
  46. hw_rsc_aggregated: 0
  47. hw_rsc_flushed: 0
  48. fdir_match: 0
  49. fdir_miss: 4145384775
  50. fdir_overflow: 0
  51. fcoe_bad_fccrc: 0
  52. fcoe_last_errors: 0
  53. rx_fcoe_dropped: 0
  54. rx_fcoe_packets: 0
  55. rx_fcoe_dwords: 0
  56. fcoe_noddp: 0
  57. fcoe_noddp_ext_buff: 0
  58. tx_fcoe_packets: 0
  59. tx_fcoe_dwords: 0
  60. os2bmc_rx_by_bmc: 0
  61. os2bmc_tx_by_bmc: 0
  62. os2bmc_tx_by_host: 0
  63. os2bmc_rx_by_host: 0
  64. tx_queue_0_packets: 0
  65. tx_queue_0_bytes: 0
  66. tx_queue_1_packets: 0
  67. tx_queue_1_bytes: 0
  68. tx_queue_2_packets: 0
  69. tx_queue_2_bytes: 0
  70. tx_queue_3_packets: 0
  71. tx_queue_3_bytes: 0
  72. tx_queue_4_packets: 0
  73. tx_queue_4_bytes: 0
  74. tx_queue_5_packets: 0
  75. tx_queue_5_bytes: 0
  76. tx_queue_6_packets: 0
  77. tx_queue_6_bytes: 0
  78. tx_queue_7_packets: 0
  79. tx_queue_7_bytes: 0
  80. tx_queue_8_packets: 0
  81. tx_queue_8_bytes: 0
  82. tx_queue_9_packets: 0
  83. tx_queue_9_bytes: 0
  84. tx_queue_10_packets: 0
  85. tx_queue_10_bytes: 0
  86. tx_queue_11_packets: 6
  87. tx_queue_11_bytes: 468
  88. tx_queue_12_packets: 0
  89. tx_queue_12_bytes: 0
  90. tx_queue_13_packets: 0
  91. tx_queue_13_bytes: 0
  92. tx_queue_14_packets: 0
  93. tx_queue_14_bytes: 0
  94. tx_queue_15_packets: 0
  95. tx_queue_15_bytes: 0
  96. rx_queue_0_packets: 64222674
  97. rx_queue_0_bytes: 3853360440
  98. rx_queue_1_packets: 64231179
  99. rx_queue_1_bytes: 3853870740
  100. rx_queue_2_packets: 64222781
  101. rx_queue_2_bytes: 3853366860
  102. rx_queue_3_packets: 64224913
  103. rx_queue_3_bytes: 3853494780
  104. rx_queue_4_packets: 64218247
  105. rx_queue_4_bytes: 3853094820
  106. rx_queue_5_packets: 64227989
  107. rx_queue_5_bytes: 3853679340
  108. rx_queue_6_packets: 64225507
  109. rx_queue_6_bytes: 3853530420
  110. rx_queue_7_packets: 64227581
  111. rx_queue_7_bytes: 3853654860
  112. rx_queue_8_packets: 64221803
  113. rx_queue_8_bytes: 3853308180
  114. rx_queue_9_packets: 64232646
  115. rx_queue_9_bytes: 3853958760
  116. rx_queue_10_packets: 64222700
  117. rx_queue_10_bytes: 3853362000
  118. rx_queue_11_packets: 64223776
  119. rx_queue_11_bytes: 3853426560
  120. rx_queue_12_packets: 64224798
  121. rx_queue_12_bytes: 3853487880
  122. rx_queue_13_packets: 64218435
  123. rx_queue_13_bytes: 3853106100
  124. rx_queue_14_packets: 64216023
  125. rx_queue_14_bytes: 3852961380
  126. rx_queue_15_packets: 64227344
  127. rx_queue_15_bytes: 3853640640


        ethtool -n|-u|--show-nfc|--show-ntuple DEVNAME  Show Rx network flow classification options or rules
                [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 |
                  rule %d ] 查看flow director的各种配置
        ethtool -N|-U|--config-nfc|--config-ntuple DEVNAME      Configure Rx network flow classification options or rules
                rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... |
                flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4
                        [ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
                        [ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
                        [ proto %d [m %x] ]
                        [ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]
                        [ dst-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]
                        [ tos %d [m %x] ]
                        [ l4proto %d [m %x] ]
                        [ src-port %d [m %x] ]
                        [ dst-port %d [m %x] ]
                        [ spi %d [m %x] ]
                        [ vlan-etype %x [m %x] ]
                        [ vlan %x [m %x] ]
                        [ user-def %x [m %x] ]
                        [ dst-mac %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
                        [ action %d ]
                        [ loc %d]] |设置flow director 规则
                delete %d
        ethtool -T|--show-time-stamping DEVNAME Show time stamping capabilities
        ethtool -x|--show-rxfh-indir DEVNAME    Show Rx flow hash indirection
        ethtool -X|--set-rxfh-indir DEVNAME     Set Rx flow hash indirection
                equal N | weight W0 W1 ...
        ethtool -f|--flash DEVNAME      Flash firmware image from the specified file to a region on the device
               FILENAME [ REGION-NUMBER-TO-FLASH ]
        ethtool -P|--show-permaddr DEVNAME      Show permanent hardware address
        ethtool -w|--get-dump DEVNAME   Get dump flag, data
                [ data FILENAME ]
        ethtool -W|--set-dump DEVNAME   Set dump flag of the device
                N
        ethtool -l|--show-channels DEVNAME      Query Channels
        ethtool -L|--set-channels DEVNAME       Set Channels
               [ rx N ]
               [ tx N ]
               [ other N ]
               [ combined N ]
        ethtool --show-priv-flags DEVNAME       Query private flags
        ethtool --set-priv-flags DEVNAME        Set private flags
                FLAG on|off ...
        ethtool -m|--dump-module-eeprom|--module-info DEVNAME   Query/Decode Module EEPROM information and optical diagnostics if available
                [ raw on|off ]
                [ hex on|off ]
                [ offset N ]
                [ length N ]
        ethtool --show-eee DEVNAME      Show EEE settings
        ethtool --set-eee DEVNAME       Set EEE settings
                [ eee on|off ]
                [ advertise %x ]
                [ tx-lpi on|off ]
                [ tx-timer %d ]
        ethtool -h|--help               Show this help
        ethtool --version               Show version number
0 0
原创粉丝点击