本文共 1509 字,大约阅读时间需要 5 分钟。
查看网卡速度有两个命令都可以查看:
mii-tooleth0: negotiated 1000baseT-FD flow-control, link ok
这表示,eth0网卡的速度为1000M,并且是全双工工作模式,也可以使用
ethtool eth0Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: umbg Wake-on: g Current message level: 0x00000007 (7) Link detected: yes
Speed 后边的数值就是速度,Duplex后边就是工作不是,full表示全双工,如果是half则表示半双工模式;Auto-negotiation 后边表示是否自动协商
那么如何调整网卡的速度以及工作模式?
修改linux网卡的工作模式:ethtool –r ethX ## 重置ethX网口到自适应模式ethtool –S ethX ## 查询ethX网口收发包统计ethtool –s ethX [speed 10|100|1000] ## 设置网口速率10/100/1000M [duplex half|full] ## 设置网口半/全双工 [autoneg on|off] ## 设置网口是否自协商
下面的命令会把eth0设置成全双工非自动协商工作模式,并且速度为100M
ethtool -s eth0 duplex full autoneg off speed 100
设置网卡工作模式开机为全双工的方法:
一: 在/etc/sysconfig/network-script/ifcfg-ethX加入下面这句:ETHTOOL_OPTS="speed 100 duplex full autoneg off"
二:
将上面的命令写入到/etc/rc.local里面。ethtool -s eth0 duplex full autoneg off speed 100
转载地址:http://ztnhb.baihongyu.com/