ethtool and mii-tool

ethtool and mii-tool

mii-tool(这是Linux下专门设置网卡工作模式的命令)
  1. 查看网卡的工作模式,输入命令:
  #mii-tool -v
  eth0: negotiated 100baseTx-FD, link ok
  product info: vendor 00:aa:00, model 56 rev 0
  basic mode: autonegotiation enabled
  basic status: autonegotiation complete, link ok
  capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
  link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  从以上信息中可以看出,这块网卡工作在100M全双工自适应模式下,“100BaseTx-FD”意为100M Full Duplex。
  2. 更改网卡的工作模式,输入命令:
  #mii-tool -F media [interface]
  media可选的模式有100baseTx-FD、100baseTx-HD、10baseT-FD、10baseT-HD等。 Interface代表所选择的网卡,如eth0、eth1等,默认为eth0。
  例如,设置网卡工作在10M半双工模式下,输入命令:
  #mii-tool -F 10baseT-HD eth0
  3. 恢复网卡的自适应工作模式,输入命令:
  #mii-tool -r eth0
  更详细的使用方法可以用mii-tool -h来获得。



ethtool/mii-tool

Linux LAN card: Find out full duplex / half speed or mode

Q. How do I find out if my Lan (NIC) card working at full or halt duplex mode / speed under Linux?

A. LAN card or NIC is use to send and receive data. Technically, we use word Duplex for this functionality. Full duplex means you are able to send and receive data (files) simultaneously. In half duplex, you can either send or receive data at a time (i.e. you cannot send receive data (files) simultaneously). Obviously, full duplex gives you best user experience. However, how can I find out whether I am using full duplex/half duplex speed/mode?
Task: Find full or half duplex speed

You can use dmesg command to find out your duplex mode:

# dmesg | grep -i duplex

Output:

eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

ethtool command

Uss ethtool to display or change ethernet card settings. To display duplex speed, enter:

# ethtool eth1

Output:

Settings for eth1:
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: 10Mb/s
Duplex: Full
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

mii-tool command

You can also use mii-tool to find out your duplex mode. Type following command at shell prompt:

# mii-tool


Output:

eth0: negotiated 100baseTx-FD flow-control, link ok

Remember,


1. 100baseTx-FD: 100Mbps full duplex (FD)
2. 100baseTx-HD: 100Mbps half duplex (HD)
3. 10baseT-FD: 10Mbps full duplex (FD)
4. 10baseT-HD: 10Mbps half duplex (HD)

mii-tool utility checks or sets the status of a network interface Media Independent Interface (MII) unit. Most fast ethernet adapters use an MII to autonegotiate link speed and duplex setting. If you are using old card then this utility may not work (use dmesg command).

This utility is useful for forcing specific Ethernet speed and duplex settings too, setup 100Mbps full duplex speed under Linux:

# mii-tool -F 100baseTx-FD


Setup 10Mbps half duplex:

# mii-tool -F 10baseT-HD


source:

http://www.cyberciti.biz/faq/howto-setup-linux-lan-card-find-out-full-duplex-half-speed-or-mode/

你可能感兴趣的:(ethtool and mii-tool)