In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how linux uses ethtool commands to manage Ethernet cards. I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it.
Ethtool is used to view and modify driver parameters and hardware settings for network devices, especially wired Ethernet devices. You can change the parameters of the Ethernet card as needed, including autonegotiation, speed, duplex and local area network wake-up. By configuring the Ethernet card, your computer can communicate effectively over the network. This tool provides a lot of information about Ethernet devices connected to your Linux system.
We will show you how to change the following parameters and how to view them. This article will help you troubleshoot problems related to Ethernet cards in your Linux system.
The following information will help you understand how Ethernet cards work.
Half-duplex: half-duplex mode allows the device to send or receive packets only at a time.
Full-duplex: full-duplex mode allows devices to send and receive packets at the same time.
Autonegotiation: autonegotiation is a mechanism that allows the device to automatically select the best network speed and mode of operation (full-duplex or half-duplex mode).
Speed: by default, it uses the maximum speed, and you can change it according to your needs.
Link detection: link detection can display the status of the network card. If displayed as no, try rebooting the network card. If the link detection still shows no, check for problems with the cables connected between the switch and the system.
How to install ethtool on Linux
By default, ethtool should already be installed on most systems. If not, you can install it from the official library of the distribution.
For the RHEL/CentOS 6ax 7 system, install ethtool using the s-systems/ "class=" ext "rel=" external nofollow "target=" _ blank "> yum command:
$sudo yum install-y ethtool
For RHEL/CentOS 8 and Fedora systems, use the dnf command to install ethtool:
$sudo yum install-y ethtool
For Debian-based systems, use the apt command or the apt-get command to install ethtool:
$sudo apt-get install ethtool
For openSUSE systems, use the zypper command to install ethtool:
$sudo zypper install-y ethtool
For Arch Linux systems, use the pacman command to install ethtool:
$sudo pacman-S ethtool how to check available network interfaces on Linux
You can use the ip command or the ifconfig command (obsolete in modern releases) to verify the names and other details of the available, active NICs:
# ip an or # ifconfig 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00 qdisc mq state UP group default qlen 00 scope host lo valid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:10:22:35:23:sf brd ff:ff:ff:ff:ff:ff inet 192.164.23. 100Accord 24 brd 192.164.23.255 scope global eth0 valid_lft forever preferred_lft forever how to check the network card (NIC) information on Linux
Once you know the name of the Ethernet card, you can easily view its details using the ethtool command, as shown below.
In the Linux system, each NIC is assigned a unique name, such as ethX, enpXXX and so on.
Older Linux distributions use the eth [X] format. For example, RHEL 6 and their older versions.
Modern Linux distributions use the enp [XXX] or ens [XXX] format. For example, most modern Linux distributions use this format, including RHEL 7, Debian 10, and Ubuntu 16.04 LTS.
# ethtool eth0 Settings for eth0: Supported ports: [TP] Supported link modes: 1000baseT/Full 10000baseT/Full Supported pause frame use: No Supports auto-negotiation: No Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 10000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: off MDI-X: Unknown Supports Wake-on: uag Wake-on: d Link detected: yes how to check the driver and firmware version of an Ethernet card
You can use the-I option of the ethtool command to check the driver version, firmware version, and bus details, as shown below:
# ethtool-I eth0 driver: vmxnet3version: 1.4.16.0-k-NAPIfirmware-version:expansion-rom-version:bus-info: 0000:0b:00.0supports-statistics: yessupports-test: nosupports-eeprom-access: nosupports-register-dump: yessupports-priv-flags: no how to check network usage statistics
You can use the-S option in the ethtool command to view network usage statistics. It can display the number of bytes transmitted, the number of bytes received, the number of errors, etc.
# ethtool-S eth0 NIC statistics: Tx Queue#: 0 TSO pkts tx: 2053 TSO bytes tx: 7167572 ucast pkts tx: 4028081 ucast bytes tx: 399093197 mcast pkts tx: 0 mcast bytes tx: 0 bcast pkts tx: 0 bcast bytes tx: 0 pkts tx err: 0 pkts tx discard: 0 drv dropped tx total: 0 too many frags: 0 giant hdr: 0 hdr err: 0 tso: 0 ring full: 0 pkts linearized: 0 hdr cloned: 0 giant hdr: 0 Tx Queue#: 1 TSO pkts tx: 1955 TSO bytes tx: 6536945 ucast pkts tx: 3711838 ucast bytes tx: 346309662 mcast pkts tx: 0 mcast bytes tx: 0 bcast pkts tx: 1186 bcast bytes tx: 49812 pkts tx Err: 0 pkts tx discard: 0 drv dropped tx total: 0 too many frags: 0 giant hdr: 0 hdr err: 0 tso: 0 ring full: 0 pkts linearized: 0 hdr cloned: 0 giant hdr: 0 Rx Queue#: 0 LRO pkts rx: 0 LRO byte rx: 0 ucast pkts rx: 5084776 ucast bytes rx: 4673133395 Mcast pkts rx: 0 mcast bytes rx: 0 bcast pkts rx: 154143 bcast bytes rx: 45415676 pkts rx OOB: 0 pkts rx err: 0 drv dropped rx total: 0 err: 0 fcs: 0 rx buf alloc fail: 0 Rx Queue#: 1 LRO pkts rx: 0 LRO byte rx: 0 ucast pkts rx: 6346769 ucast bytes rx: 4835534292 Mcast pkts rx: 0 mcast bytes rx: 0 bcast pkts rx: 3464 bcast bytes rx: 714646 pkts rx OOB: 0 pkts rx err: 0 drv dropped rx total: 0 err: 0 fcs: 0 rx buf alloc fail: 0 tx timeout count: 0 how to change the speed of Ethernet devices
You can change the speed of Ethernet as needed. When you make this change, the network card will be automatically disconnected, and you need to use the ifup command or the ip command or the nmcli command to reconnect it.
# ethtool-s eth0 speed 10 ip link set eth0 up how to enable / disable autonegotiation for Ethernet cards on Linux?
You can use the autoneg option in the ethtool command to enable or disable autonegotiation, as shown in the following figure:
# ethtool-s eth0 autoneg off# ethtool-s eth0 autoneg on how to change multiple parameters at the same time
If you want to use the ethtool command to change multiple parameters of the Ethernet card at the same time, please use the following format:
How to check the autonegotiation, RX and TX of a specific network card by Syntax:ethtool-s [device_name] speed [10] half/full] autoneg [on/off] # ethtool-s eth0 speed 1000 duplex full autoneg off
To view details such as autonegotiation for specific Ethernet devices, use the following format:
# ethtool-how does an eth0 identify a specific Nic from multiple devices (LED on the blinking Nic)
This option is useful if you want to identify a specific physical interface. The following ethtool command causes the LED light on the eth0 port to flash:
# how ethtool-p eth0 permanently sets these parameters in Linux
After the system is rebooted, your changes using ethtool will be restored by default.
To make custom settings permanent, you need to update the values in the network configuration file. Depending on your Linux distribution, you may need to update this value to the correct file.
For RHEL-based systems. You must use the ETHTOOL_OPTS variable:
# vi / etc/sysconfig/network-scripts/ifcfg-eth0 ETHTOOL_OPTS= "speed 1000 duplex full autoneg off"
For Debian-based systems:
# vi / etc/network/interfaces post-up ethtool-s eth0 speed 1000 duplex full autoneg off and above are all the contents of this article "how to manage Ethernet cards with ethtool commands by linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.