mii-tool

mii-tool(这是Linux下专门设置网卡工作模式的命令)
MII的全称是Media Independent Interface,字面意思上就是媒体无关的接口,因此它是独立于具体设备的,仔细想想标准化的东西都是独立于具体设备的。虽然如此,很多以太网卡设备并不支持这些参数的配置,因此当你执行mii-tool的时候,会得到Operation not supported的提示,要不就是没有使用超级用户身份,还有就是若接口编号设置超过eth7时,直接使用mii-tool 不加参数,会出现NO MII xxxxxxxxxx interface 之类的提示,是因为超过了默认值,使用帮助信息可以了解。
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来获得。
注:
mii-tool不支持1000M以上的网卡
正常对于100M以下的网卡都可以用这俩个命令来查看,但是对于100M以上网卡的,mii-tool就会出现问题
mii-tool -v eth0
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网卡,实际上是1000M的接口
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: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
#这里却正确的显示1000M网卡
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值