![]() |
學校地址:湖南省 長沙市 雨花區 車站南路紅花坡路口 |
![]() |
學校地址:湖南省 長沙市 雨花區 車站南路紅花坡路口 |
解決方法:
根據你系統安裝的網卡的類型,可以下面的兩個工具中的一個來改變網卡的速度,工作方式(半雙工和全雙工),和其他的選項:ethtool或者mii-tool. 如果一些網卡不能夠通過ethtool來設置,這種情況下,請嘗試使用mii-tool,反之亦然。首先檢查下面的軟件是否安裝。
# rpm -q ethtool# rpm -q net-tools
如果軟件沒有安裝,將輸出下面的結果:
# rpm -q ethtoolpackage ethtool is not installed# rpm -q net-toolspackage net-tools is not installed
如果這些軟件已經安裝,這個命令將輸出軟件的版本號:
# rpm -q ethtoolethtool-1.2-1# rpm -q net-toolsnet-tools-1.60-20.1
如果這些軟件沒有安裝,可以從安裝光盤來安裝。如果你的系統已經在紅帽網絡(RHN)注冊,也可以使用up2date安裝. 如果你的系統已經注冊到RHN上,執行up2date ethtool 或者 up2date net-tools. RHN就會下載和安裝這些軟件到你的系統上.
下一步,查看網絡接口的當前設置,使用下面的語法: command device_name, 其中command 是 ethtool 或者 mii-tool,device_name 是eth0, eth1等等.下面的例子來自2個不同的網卡:
# ethtool eth0Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on Supports Wake-on: puag Wake-on: g Link detected: yes# mii-tool eth1eth1: no autonegotiation, 10baseT-HD, link ok
關于如何設置網卡的選項:比如全雙工,半雙工和改變速度等等,可以查看man的幫助手冊.
# man ethtool # man mii-tool
一旦決定了你的設置,可以立即通過命令行進行設置。如果使用ethtool,為了使eth0每次啟動時,都完成這個設置,在/etc/sysconfig/network-scripts/ifcfg-eth0加入下面的信息.
ETHTOOL_OPTS=speed 100 duplex full autoneg off
不幸的是,除非把設置命令和參數放在/etc/rc.local文件中(在后面解釋),沒有一個辦法可以使這些設置在系統每次啟動的時候永久保存,這樣系統每次啟動的 后階段就會運行這個文件中的命令,也可以通過創建啟動腳本讓相關的設置在啟動過程的前期運行.
作為 后的一個辦法,你可以把他們放在/etc/rc.local文件中。在/etc/rc.local文件中,把ethtool和mii-tool字符串和設置選項分別放在一個新行中。下面的例子會對你的配置有幫助:
#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.ethtool -s eth0 speed 100 duplex full autoneg offmii-tool -F 100baseTx-FD eth1touch /var/lock/subsys/local
如果你保存了這些改變,當系統下次啟動的時候,網卡的速度和工作模式就會按照你設置的來工作(如果你的設置選項對于這個網卡是合適的)。
注: 有些網卡對于ethtool是不工作的,如果是這種情況,可以嘗試使用mii-tool反之亦然.
|