[Linux Command] ethtool là gì? Ứng dụng ethtool

Tác giả: 09/12/2022

Hôm nay Nhân Hoà sẽ gửi tới các bạn các thông tin về công cụ ethtool và ứng dụng của nó

1. ethtool là gì

ethtool là công cụ ứng dụng trên hệ điều hành Linux dùng để xem thông tin và chỉnh sửa các thông số liên quan card mạng

2. Sử dụng ethtool như thế nào

Cài đặt:

#sudo yum install ethtool -y (cho Centos)

#sudo apt install ethtool -y (cho Ubuntu – Debian)

Xem cú pháp và các tham số liên quan đến ethtool

#man ethtool

—————————-

a. Xem thông tin thông số kết nối của card mạng

Cú pháp: ethtool interface_name

example: #ethtool eth0

-----------

Settings for eth0:

       Supported ports: [ TP ]

       Supported link modes:   10baseT/Half 10baseT/Full

                               100baseT/Half 100baseT/Full

                               1000baseT/Full

       Supported pause frame use: No

       Supports auto-negotiation: Yes

       Advertised link modes: 10baseT/Half 10baseT/Full

                               100baseT/Half 100baseT/Full

                               1000baseT/Full

       Advertised pause frame use: No

       Advertised auto-negotiation: Yes

       Speed: 1000Mb/s

       Duplex: Full

       Port: Twisted Pair

       PHYAD: 1

       Transceiver: internal

       Auto-negotiation: on

       MDI-X: off (auto)

       Supports Wake-on: pumbg

       Wake-on: g

       Current message level: 0x00000007 (7)

                               drv probe link

       Link detected: yes

 

b. Xem thống kê thông số(statistics) của card mạng

#ethtool -S interface_name

example: ethtool -S eth0

---------------

NIC statistics:

     rx_packets: 6444814814

     tx_packets: 5266644847

     rx_bytes: 1358606358440

     tx_bytes: 4792444386124

     rx_broadcast: 258428982

     tx_broadcast: 5140

     rx_multicast: 216581958

     tx_multicast: 10

     rx_errors: 142

     tx_errors: 0

     tx_dropped: 0

     multicast: 216581958

 

c. Chỉnh thông số card mạng

Cú pháp: ethtool -s interface_name speed N [duplex half|full] [port tp|aui|bnc|mii] [mdix auto|on|off] [autoneg on|off] [advertise N] [phyad N]

[xcvr internal|external] [wol p|u|m|b|a|g|s|d…] [sopass xx:yy:zz:aa:bb:cc] [msglvl N | msglvl type on|off …]

Example: Chỉnh sửa speed lên 1Gbps full duplex

#ethtool -s eth0 speed 1000 duplex full autoneg off

Chúc các bạn học tốt!

Trả lời