Linux下使用ethtool满速网卡速率

有的独立主机、VPS由于各种原因,在系统上网卡速率达不到标称,或者因个人需要,限制网速,那么ethtool是个合适的工具。

一、满速网卡速率以下均以满速100Mbps为例。1、安装ethtoolCentos下:

yum -y install ethtool net-tools

Debian下:

apt-get install ethtool net-tools

2、设置网卡速率a、查看网卡信息

ifconfig

查看网口信息

ethtool eth0

b、速率设置

ethtool -s eth0 speed 100 duplex full autoneg off

其中的100代表100Mbps

c、设置开机启动直接添加到网卡信息里在/etc/sysconfig/network-scripts/ifcfg-eth0添加

ETHTOOL_OPTS="speed 100 duplex full autoneg off"

/etc/sysconfig/network-scripts/ifcfg-eth0不同系统稍有不同

d、debian设置方法(忽略b、c步骤)在/etc/network/interfaces文件里添加

link-speed 100 link-duplex full ethernet-autoneg off

二、ethtool常用命令ethtool eth0 //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0、eth1等等ethtool -h //显示ethtool的命令帮助(help)ethtool -i eth0 //查询eth0网口的相关信息ethtool -d eth0 //查询eth0网口注册性信息ethtool -r eth0 //重置eth0网口到自适应模式ethtool -S eth0 //查询eth0网口收发包统计ethtool -s eth0 [speed 10|100|1000] [duplex half|full] [autoneg on|off] //设置网口速率10/100/1000M、设置网口半/全双工、设置网口是否自协商

推荐站内搜索:主机服务器租用、网站备案流程、美国仿牌空间、免费com域名申请、广东网站备案、icp备案网站、域名注册价格、国外空间服务商、什么叫ip地址、域名代理、