前段时间更换公司Linux服务器的交换机从10/100MB到1000MB时,发现交换机接口的灯只显示100MB,因为服务器为今年新购的,所以按道理来 说,网卡早就应该能够支持1000MB!之后在网上找到一些关于Linux中如何查看以及更改网卡速率及模式的命令!
ethtool
ethtool version 1.8
Usage:
ethtool DEVNAME
ethtool -a DEVNAME
ethtool -A DEVNAME \
[ autoneg on|off ] \
[ rx on|off ] \
[ tx on|off ]
ethtool -c DEVNAME
ethtool -C DEVNAME \
[adaptive-rx on|off] \
[adaptive-tx on|off] \
[rx-usecs N] \
[rx-frames N] \
[rx-usecs-irq N] \
[rx-frames-irq N] \
[tx-usecs N] \
[tx-frames N] \
[tx-usecs-irq N] \
[tx-frames-irq N] \
[stats-block-usecs N] \
[pkt-rate-low N] \
[rx-usecs-low N] \
[rx-frames-low N] \
[tx-usecs-low N] \
[tx-frames-low N] \
[pkt-rate-high N] \
[rx-usecs-high N] \
[rx-frames-high N] \
[tx-usecs-high N] \
[tx-frames-high N] \
[sample-interval N]
ethtool -g DEVNAME
ethtool -G DEVNAME \
[ rx N ] \
[ rx-mini N ] \
[ rx-jumbo N ] \
[ tx N ]
ethtool -i DEVNAME
ethtool -d DEVNAME
ethtool -e DEVNAME \
[ raw on|off ] \
[ offset N ] \
[ length N ]
ethtool -E DEVNAME \
[ magic N ] \
[ offset N ] \
[ value N ]
ethtool -k DEVNAME
ethtool -K DEVNAME \
[ rx on|off ] \
[ tx on|off ] \
[ sg on|off ] \
[ tso on|off ]
ethtool -r DEVNAME
ethtool -p DEVNAME [ %d ]
ethtool -t DEVNAME [online|(offline)]
ethtool -s DEVNAME \
[ speed 10|100|1000 ] \
[ duplex half|full ] \
[ port tp|aui|bnc|mii|fibre ] \
[ autoneg on|off ] \
[ phyad %d ] \
[ xcvr internal|external ] \
[ wol p|u|m|b|a|g|s|d... ] \
[ sopass %x:%x:%x:%x:%x:%x ] \
[ msglvl %d ]
ethtool -S DEVNAME
从上面的命令解释可以看出,ethtool的功能非常强大!
mii-tool --help
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
mii-tool命令只是在老版本以及现在部分版本才保留有这个命令,其实也可以做些简单的网卡的查看和更改,但是功能不及ethtool强大!出问题的 的服务器是装的SUSE Linux 10服务器版本,上面没有mii-tool这个工具,可能是没有安装的事,而公司另一台服务器是安装的RHEL4,上面两个网络工具都有!出问题的服务器 经过更改之后不用重启服务器就可以生效,交换机灯正常且速度也变快了,原来做samba和proxy老是慢和断线的情况没有出现了!问题解决!