Утилита mii-tool
Управление сетевыми интерфейсами и ограничение скорости — mii-t00l
mii-t00l — утилита используется для просмотра и управления сетевыми интерфейсами в Linux. Одной из интересных особенностей ее использования — это в качестве установления определенной скорости на сетевом интерфейсе в Linux.
Для переключения в 10 мегабитный полудуплексный реим
#mii-tool -F 10baseT-HD
Для переключения в 10 мегабитный полнодуплексный режим
#mii-tool -F 10baseT-FD
Для 100 мегабитного режима
#mii-tool -F 100baseTx-FD
#mii-tool -F 100baseTx-HD
Для просмотра
# mii-tool -v eth0
eth0: 10 Mbit, half duplex, link ok
product info: vendor 00:aa:00, model 56 rev 0
basic mode: 10 Mbit, half duplex
basic status: link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
Полудуплексный режим — передача ведётся в обоих направлениях, но с разделением по времени называют полудуплексным.
В определенный момент времени передача происходит только в одном направлении.
Дуплексный режим — прием и передача происходят одновременно.
Общая скорость обмена в дуплексном режиме вполне может достигатьдвойного значения . Если использзовать Fast Ethernet со скоростью 100 мб/с, то скорость может быть 200 Мбит/с (100 — передача и 100 — приём).
Источник
Linux change the speed and duplex settings of an Ethernet card
Q. How do I change the speed, duplex on for my Ethernet card?
A. Under Linux use mii-tool or ethtool package which allows a Linux sys admin to modify/change and view the negotiated speed of network interface card (NIC) i.e. it is useful for forcing specific Ethernet speed and duplex settings.
Depending on which type of Ethernet card is installed on the system you need to use either mii-tool or ethtool. I recommend installing both and use one of the tool, which will work with your card.
Task: Install mii-tool and ethtool tools
If you are using Debian Linux you can install both of these package with following command: # apt-get install ethtool net-tools If you are using Red Hat Enterprise Linux you can install both of these package with following command: # up2date ethtool net-tools If you are using Fedora Core Linux you can install both of these package with following command: # yum install ethtool net-tools
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Task: Get speed and other information for eth0
Type following command as root user:
# ethtool eth0 Output:
Or use mii-tool command as follows: # mii-tool eth0 Output:
Task: Change the speed and duplex settings
Setup eth0 negotiated speed with mii-tool
Disable autonegotiation, and force the MII to either 100baseTx-FD, 100baseTx-HD, 10baseT-FD, or 10baseT-HD: # mii-tool -F 100baseTx-HD
# mii-tool -F 10baseT-HD Setup eth0 negotiated speed with ethtool # ethtool -s eth0 speed 100 duplex full
# ethtool -s eth0 speed 10 duplex half To make these settings permanent you need to create a shell script and call from /etc/rc.local (Red Hat) or if you are using Debian create a script into the directory /etc/init.d/ directory and run update-rc.d command to update the script.
Read man page of mii-tool and ethtool for more information.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Category | List of Unix and Linux commands |
---|---|
Documentation | help • mandb • man • pinfo |
Disk space analyzers | df • duf • ncdu • pydf |
File Management | cat • cp • less • mkdir • more • tree |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Linux Desktop Apps | Skype • Spotify • VLC 3 |
Modern utilities | bat • exa |
Network Utilities | NetHogs • dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop |
Searching | ag • grep • whereis • which |
Shell builtins | compgen • echo • printf |
Text processing | cut • rev |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Comments on this entry are closed.
I get an “SIOCSMIIREG on eth2 failed: Invalid argument” error when entering “mii-tool -F 100baseTx-FD eth2” What does this mean? Thanks.
Try to use ethtool. It appears that mii-tool is not compatible with your NIC.
Thanks for info, very use full!
I run “ethtool -s eth0 speed 10 duplex half” then run “ethtool eth0” and get “Speed: 100Mb/s”.
So speed was not changed really.
Why?
How to get wired LAN running at FULL-DUPLEX
At the Linux Terminal, type:
sudo ethtool eth0
This will tell you the properties of the wired config. If Duplex is showing half, then type:
sudo ethtool -s eth0 autoneg off
sudo ethtool -s eth0 duplex full
Finally, type to view final configuration:
sudo ethtool eth0
thank you so much It worked wondefully superb way …..
Google & Vivek pwns!
On Red Hat Enterprise, and SuSE Enterprise (and probably others) you can include the options in your interface config file using the ETHTOOL_OPTS argument:
# red hat: /etc/sysconfig/network-scripts/ifcfg-eth0
# sles: /etc/sysconfig/network/ifcfg-eth-id-
ETHTOOL_OPTS=”autoneg off speed 100 duplex full”
Note that you cannot disable autonegotiation on gig-ethernet over copper. Autonegotiation is REQUIRED in the 802.3ab definition (http://standards.ieee.org/reading/ieee/interp/IEEE802.3af-2003interp-6.pdf)
There is way to “fix” the speed on a gig-ethernet NIC while complying with the standard, based on the last paragraph of the article mentioned above by Shawn (http://standards.ieee.org/reading/ieee/interp/IEEE802.3af-2003interp-6.pdf):
# ethtool -s eth0 speed 1000 duplex full autoneg on
The NIC keeps the auto-negotiation but only advertises 1000mbps. It works fine.
I have a Dell laptop (Precision M6300) with Broadcom NetXtreme ethernet controller and
a wireless Dell WLAN Mini card. I had Fedora installed and can dual boot Windows XP or Fedora. I decided to start with the Broadcom controller since many of the Web sites imply
that the wireless ethernet on linux can be frustrating. Unfortunately, the “wired” ethernet is
also proving to be a problem. I will try the tools you have listed and hope. Certainly the
Administor->network-> gui interface did not work. Tried the tg3 driver but when I activate
it, it says it is not there. Of course I am sending this email thru the BroadCom controller but
with the XP OS. There seems to be a big difference between a linus USER and Admin. Oh well
I will reboot and try some of your suggestions.
My 1gbit card refuses to report 1gbit. GRRRR! I use the ethtool, but at no vail. The mii-tool dont do to much for my Debian system either.
Might be a stupid question, but are there some config settings for the network file? Im sure I had it running at 1gbit, but I also remember it was a hassle to get it to run at that speed.
Well, off to google again.. 🙂
@kanon
1000Base-T requires the use of auto nego. So perhaps the switch you’re using doesn’t offer it and the NIC decides to fallback to 100Mb? Just an idea…
Chris
Cool one……..Thanks for the post
Super now my Debian is work with my internet, I was change of 100TX to 10T , but Now I like to create one script that when restart my Debian is work my internet, the question is How I’ll create the Script? please any one there help me and send my same example or the solution.
Thanks for the post.
Very useful article! Trying any of this leaves me with no link, no connection. I can run 10mb/s half duplex, autonegotiated. Attempts to force, no auto yield no link. No response to pon.
I am running Debian Sid, NIC ethO –>pptp pppO to ASDL modem.
Alexey, I had the same problem.
You need to turn off autoneg to use a sub-optimal speed.
ethtool -s eth0 autoneg off speed 10 duplex half
As you pointed out, mii-tools may be deprecated, so
would you mind modifying accordingly your very interesting topic,
and consider adding what Mage767 has most conveniently added:
How to switch off auto-negocation using ethtool :
# ethtool -s eth0 autoneg off
So, to sum uop, either you are lucky enough to do both action alltogether:
# ethtool -s eth0 duplex full autoneg off
(this works for my Ethernet Card)
Either you need to do it in 2 steps:
# ethtool -s eth0 autoneg off
# ethtool -s eth0 duplex full
Thanks for your anwser – BTW you brought up a solution I had been wondering for months !
— Philippe
How to switch on autoneg on in linux ?
I tried below command for 10G intel nic card
# ethtool -s xaui0 duplex full autoneg on
it is showing follwing output
Cannot set new settings: Invalid argument
not setting duplex
not setting autoneg
This command does not seem to be working with Centos 4.5 Final
ethtool -s eth0 speed 100 duplex full
It locks up the NIC. I was able to SSH in from the secondary port and reboot the server gracefully.
Prior to changing the speed and duplex mode I get:
[root@hw000 vz-scripts]# 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: 100Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
Then I enter and it hangs:
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: 100baseT/Full
Advertised auto-negotiation: Yes
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: no
– Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller
– Ethernet controller: Intel Corporation 82547GI Gigabit Ethernet Controller
Myself facing same problem did you find any solution for the same.
On RHEL ES4u6 32bit, when I execute “ethtool eth0” it does NOT give me the speed, which I desire to know. I’ve played with the options, but don’t see anything obvious that forcefully provides information on the nic/link speed.
Any other option/method for determining, via the CLI the nic/link current speed?
Thanks
Message submitted 2010/05/24 @ 14:45 EST (as the article and messages don’t indicate their date of posting)
And thanks for heads up. I’ve fixed the problem with date and time. Now comment displays the date properly for all posts.
Hmm, my previous attempt to say this seems to have gone off into the ether (but not eth). 🙂
Thank you, too—and your are welcome as well, Vivek Gite. I appreciate the quick response!
However, I’ve no joy with using the ‘mii-tool’ you’d suggested.
‘ethtool eth0’ returns only the following output:
“Settings for eth0:
Current message Level: 0x00000007 (7)
Link Detected: yes”
—-and nothing further.
‘dmesg | less’ and manually searching for eth0 returns only the following:
“divert: allocationg divert_blk for eth0
eth0: registered as PCnet/PCI II 79c970a
eth0: no IPV6 routers present”
‘mii-tool eth0’ returns only the following:
“SIOCGMIIPHV on ‘eth0’ failed: Operation not supported.”
I get this, primarily on VMs within an ESX 3.5.0 host.
So, other than eth-tool and mii-tool……….. are there any other *creative* ways to determine NIC speed, from within the system at the command line?
VMWarw is known to have a few issues with ethtool. Try
ethtool -i vmnic0
And esxcfg-nics command can also help.
i commends is very useful thankx to all.
I changed the full duplex to half duplex using command
/sbin/ethtool -s eth0 speed 10 duplex half
but if do
/sbin/ethtool eth0 getting o/p: as below :
/sbin/ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
Link detected: yes
that indicates my PC is not getting changed to half duplex
Pls help me what i have to do?
yeah really it works…, thanks a lot.
Actually i was looking it from centos help sites, but i got only dust there,
now i tried it, And my net is working,
it is working of 10bastT-HD
Thanks for supporting code in this simple manner…
I have Red Hat RHEL 5.5 and when I use the ethool
# ethtool -s eth0 speed 1000 duplex full
I get the erro of :
Cannot set new settings: Invalid argument
not setting speed
not setting duplex
Is this a bug in RHEL 5.5? It worked in RHEL 4.8
In Debian (also Raspberry pi) this is the way to do it as per document
/usr/share/doc/ethtool/README.Debian
iface eth0 inet dhcp
link-speed 100
link-duplex full
ethernet-autoneg off
works like a charm
This is really the best way, working perfectly for me too. Thanks for pointing it out.
Hi,
I am using freescale processor MPC8548E based customized board .
Once the Linux is loaded on the target I gave the following ommand:
ifconfig media 100baseTX mediaopt full-duplex
as mentioned above.
But it is dispplaying the error:
ifconfig: bad address ‘media’…
I am trying to set the board eth1 port to work in 100 Mbps, Full Duplex mode.
ethtool and mii-tool are not working on the target. I am getting the error as: Command not found…..
ifconfig command is given as:
ifconfig media 100baseTX mediaopt full-duplex
For me, it wasn’t auto negotiating to 1000 full duplex even though it had in the past.
I replaced the ethernet cable from an old cord to a brand new shielded one and it switched right into 1000 Mbps Full Duplex. (The computer is plugged into a gigabit switch, naturally.)
In my /etc/sysconfig/network-scripts/ifconfig-eno1 the ethtool line is as follows:
ETHTOOL_OPTS=”autoneg on”
ethtool -s eth0 speed 1000 duplex full
I get the erro of :
Cannot set new settings: Invalid argument
not setting speed
not setting duplex
Источник