linux查看和改变网卡工作速率
(2015-09-07 16:07:47)
标签:
it |
分类: 运维监控 |
[root]# dmesg | grep -i eth0 查看
[root@log]# cat messages-20150906 这个也可以查看 网卡经常UP DOWN
Sep 1 06:44:16 localhost kernel: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Sep 1 06:44:17 localhost kernel: igb: eth0 NIC Link is Down
Sep 1 06:44:21 localhost kernel: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Sep 1 06:44:24 localhost kernel: igb: eth0 NIC Link is Down
Sep 1 06:44:28 localhost kernel: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Sep 1 06:44:31 localhost kernel: igb: eth0 NIC Link is Down
Sep 1 06:44:54 localhost kernel: igb: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX
[root@]# ethtool eth0
Settings for eth0:
存在三种问题 交换机端口,服务器网卡,和网线问题。
解决办法:换网线,本机网口,和上联端口。基本可以搞定,不影响业务再排查问题
1.修改服务器网卡速度【注:会有7-10次丢包 可能会造成线上业务故障】
ethtool -s eth0 speed 1000 duplex full autoneg on
试了一下,果然如此!但是这 带来另一个问题:系统经常自动跳到100M模式!没办法,重启服务器,再试了一次!出乎我所料,重启机器后,即使关闭自协商模式也可以设置成功!
Ethtool是用于查询及设置网卡参数的命令。
概要:
ethtool ethX //查询ethX网口基本设置
ethtool –h //显示ethtool的命令帮助(help)
ethtool –i ethX //查询ethX网口的相关信息
ethtool –d ethX //查询ethX网口注册性信息
ethtool –r ethX //重置ethX网口到自适应模式
ethtool –S ethX //查询ethX网口收发包统计
ethtool –s ethX [speed 10|100|1000]\ //设置网口速率10/100/1000M
[duplex half|full]\ //设置网口半/全双工
[autoneg on|off]\ //设置网口是否自协商

加载中…