ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • ethtool statistics information
    2013. 7. 9. comments

    ethtool utility

    ethtool 유틸리티는 linux 환경에서 NIC(network interface card)의 driver ,  hardware에 대한 설정을 하거나 상태를 조회할 수 있는 명령어이다. ethernet link가 UP가 되어 있는지 그리고 Speed, Duplex 설정을 확인하는데 흔하게 사용된다.


    morenice@morenice-ubuntu:~$ ethtool eth0

    Settings for eth0:

    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: 1

    Transceiver: internal

    Auto-negotiation: on

    Supports Wake-on: d

    Wake-on: d

    Current message level: 0x00000007 (7)

    Link detected: yes





    NIC statistics


    ethtool 명령어는 -S 옵션으로 NIC에서 주고 받은 패킷에 대한 정보와 오류 정보를 얻을 수 있다.

    morenice@morenice-ubuntu:~$ ethtool -S eth0
    NIC statistics:
         rx_packets: 8
         tx_packets: 18
         rx_bytes: 4492
         tx_bytes: 1300
         rx_broadcast: 0
         tx_broadcast: 0
         rx_multicast: 0
         tx_multicast: 0
         rx_errors: 0
         tx_errors: 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_no_buffer_count: 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
         tx_abort_late_coll: 0
         tx_deferred_ok: 0
         tx_single_coll_ok: 0
         tx_multi_coll_ok: 0
         tx_timeout_count: 0
         tx_restart_queue: 0
         rx_long_length_errors: 0
         rx_short_length_errors: 0
         rx_align_errors: 0
         tx_tcp_seg_good: 0
         tx_tcp_seg_failed: 0
         rx_flow_control_xon: 0
         rx_flow_control_xoff: 0
         tx_flow_control_xon: 0
         tx_flow_control_xoff: 0
         rx_long_byte_count: 4492
         rx_csum_offload_good: 8
         rx_csum_offload_errors: 0
         alloc_rx_buff_failed: 0
         tx_smbus: 0
         rx_smbus: 0
         dropped_smbus: 0


    이 정보들을 통해서  NIC에 패킷이 얼마나 들어오고 나가는지 그리고 오류사항들이 있는지 통계정보를 확인할 수 있다. 네트워크의 패킷 흐름이 원활하지 않을 때 어떤 error에 대해서 counting되는지를 확인해보면 유용하다.  


    예전 네트워크가 엄청 느려질 때를 경험했는데,  ethtool로 확인을 해보니  rx_frame_errors가 증가하고 있었고 랜 케이블 교체를 해보니 그 이후로는 문제가 발생하지 않았다.

    또한 시스템에서 전송해야할 패킷들이 NIC의 전송할 수 있는 능력보다 월등히 많아서 tx errors 발생한 적도 있었다. 보내고 싶어도 NIC 자체에서 능력이 >안되서 보내지 못하는 상황이 생겨  tx error가 발생하는 것이다. 이런 경우에는 더 좋은 chipset을 쓰는 NIC로 교체해야 한다.


    만약에 잘 동작하던 시스템의 네트워크에 문제가 발생한다면 네트워크 인프라의 변경사항이 없는지를 살펴봐야하겠지만 NIC 통계정보를 통해서 문제가 있는지도 확인해봐야 한다.


    반응형

    댓글

Designed by Tistory.