Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7802963
  • 博文数量: 701
  • 博客积分: 2150
  • 博客等级: 上尉
  • 技术积分: 13233
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-29 16:28
个人简介

天行健,君子以自强不息!

文章分类

全部博文(701)

文章存档

2019年(2)

2018年(12)

2017年(76)

2016年(120)

2015年(178)

2014年(129)

2013年(123)

2012年(61)

分类: LINUX

2015-02-04 16:09:03

linux下查看网卡是否有物理网线连接的命令

这个比较有用,帮助判断网络故障
/sbin/mii-tool
mii-tool(这是Linux下专门设置网卡工作模式的命令)
1. 查看网卡的工作模式,输入命令:
mii-tool -v
SIOCGMIIREG on eth0 failed: Input/output error
eth0: negotiated 100baseTx-FD, link ok
  product info: vendor 00:50:43, model 11 rev 1
  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
SIOCGMIIREG on eth1 failed: Input/output error
eth1: negotiated 100baseTx-FD, link ok
  product info: vendor 00:50:43, model 11 rev 1
  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: invalid option -- h
usage: mii-tool [-VvRrwl] [-A media,... | -F media] [interface ...]
       -V, --version               display version information
       -v, --verbose               more verbose output
       -R, --reset                 reset MII to poweron state
       -r, --restart               restart autonegotiation
       -w, --watch                 monitor for link status changes
       -l, --log                   with -w, write events to syslog
       -A, --advertise=media,...   advertise only specified media
       -F, --force=media           force specified media technology
media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
       (to advertise both HD and FD) 100baseTx, 10baseT

阅读(4141) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~