分类: LINUX
2008-04-27 22:59:49
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://saturn.blog.51cto.com/184463/33663 | |||||||||||||
由于办公环境改变,网线不够长,翻箱捣柜找出一个HUB接上。可无论如何也获取不到IP。一看HUB才知道,原来HUB的带宽才10M,而我的网卡是10/100M自适应模式(比较老的网卡自适应能力比较差)。可能是网卡和HUB自适应模式不兼容引起的,网卡速率不能够自动识别,从而无法达到网络通信。因此我的网卡只能设置在10M的环境下才能正常运行。
Windows:
其实在Windows下解决方法很简单,在“设备管理器”-“网卡属性”-“高级”中的“LinkSpeed/Duplex Mode”设置为10M的就可以了。 Linux:
Linux下的实现方法很多,不过配置起来却很困难,其实只要用mii-tool那实现起来就相当简单了,如下:
写一个脚本 ******************************** ifconfig eth0 up mii-tool -F 10baseT-FD ifup eth0 ******************************** 然后把脚本加入/etc/rc.d/init.d/,让它开机自动运行就OK了。看,是不是很简单啊!:-)
注:mii-tool -F 10baseT-FD 这句是将网卡的的LinkSpeed改为10M全双工模式
------------------------------------------------------------------------------
------------------------------------------------------------------------------
以下是mii-tool工具的使用方法,从上摘抄的,供大家一起学习。
A key tool for determining if you are connected to the Ethernet, and if so, at what speed. The mii-tool program does not support all Ethernet devices, as some Ethernet devices have their own vendor-supplied tools to report the same information. The mii-tool source code is based on a tool called mii-diag which provides slightly more information but is less user friendly.
The information reported by mii-tool is quite terse. The following table should clarify the meaning of the speeds you'll encounter in output from mii-tool(There is a standard speed/Ethernet transmission style supported by mii-tool to which I have not referred. That is 100BaseT4. 100BaseT4 provides support for 100 megabit Ethernet networking over Category 3 rated cable. This is probably not a concern for most recently upgraded network infrastructure. The standard networking cable pulled in new construction and renovation is now Category 5 cable which supports 100Base-Tx-FD and possibly gigabit Ethernet. So, let's relegate 100BaseT4 to this footnote, and resume.)
Table B.2. Ethernet Port Speed Abbreviations
The raw number indicates the number of bits which can be exchanged between two Ethernet devices over the wire. So 10 megabit Ethernet can support the transmission of ten million bits per second. The suffix to each identifier indicates whether both hosts can send and receive simultaneously or not. Half duplex means that each device can either send or receive in the same instant. Full duplex means that both devices can send and receive simultaneously.
The simplest use of mii-tool reports the link status of all Ethernet devices on a system. Any argument to mii-tool is interpreted as an interface name to query for link status.
Example B.21. Detecting link layer status with mii-tool
In the above example, we can infer that tristan has only one Ethernet device (or no Ethernet drivers loaded for any other present Ethernet devices). The first Ethernet device has successfully negotiated a 100 megabit full duplex connection with the device to which it is connected.
Although a great rarity, you may have occasion to dictate to the Ethernet interface the speed at which it should talk to the switch or hub. mii-tool supports a mode of operation under which you indicate supported modes for autonegotiation. Normally, two connected devices will negotiate the fastest possible commonly shared speed. You can select what speeds you want to support on an Ethernet interface by using mii-tool.
Example B.22. Specifying Ethernet port speeds with mii-tool --advertise
After we specified that we wished only to support 10baseT-HD and 10baseT-FD as acceptable speeds, mii-tool caused the Ethernet driver to renegotiate port speed with the attached device. Here we selected 10baseT-FD.
Example B.23. Forcing Ethernet port speed with mii-tool --force
After manipulating the speed at which the Ethernet driver would communicate with the connected device on tristan, we chose to restart the autonegotiation process without forcing a particular speed or advertising a particular speed.
So, if you must know at what speed your linux machine is connected to another device, mii-tool comes to your rescue.
本文出自 “今夜灿烂” 博客,请务必保留此出处http://saturn.blog.51cto.com/184463/33663 本文出自 51CTO.COM技术博客 |