简介

事情是这样的,我买了一个newifi路由器,之后准备将家里的网络重新部署一下,所以就把我的蜗牛星际停了,之后把网络从以前的极路由连接到newifi下,突然发现丢包严重,而且不是一般的严重,几乎丢包率达到70%以上而且ssh更本链接不上,我以为是安装了docker,太多网桥的关系,所以把docker停了,把能开机启动的服务全部停了,但是网卡丢包依然很严重,于是不停百度,百度到怀疑人生,从网线到路由器全部排查了一遍,后来看到一句话

蜗牛星际千兆网卡丢包严重

我终于想起来,蜗牛星际网卡是锁死在百兆上的,因为在极路由下,极路由是百兆的,所以网卡自动协商为百兆,但是在新路由下就不一样了,新路由是千兆的,网卡会自动协商成千兆,所以就造成了丢包严重,那么只要把网卡的速率改为百兆就好了

改网卡速率为百兆

首先看下网卡的信息,因为写这个博客的时候我已经解决这个问题了,所以之前的网卡信息我不能截图拍照下来了,但是你可以使用下面这个命令查看你的网卡信息

ethtool enp4s0

现在你可以看到我的网卡是百兆的,之前丢包的时候是千兆而且是自动协商模式的

  ~ ethtool enp4s0Settings for enp4s0:    Supported ports: [ TP ]    Supported   modes:   10 T/Half 10 T/Full                            100 T/Half 100 T/Full                            1000 T/Full    Supported pause   use: No    Supports auto-negotiation: Yes    Supported FEC modes: Not reported    Advertised   modes:  Not reported    Advertised pause   use: No    Advertised auto-negotiation: No    Advertised FEC modes: Not reported    Speed: 100Mb/s    Duplex: Full    Port: Twisted Pair    PHYAD: 1    Transceiver: internal    Auto-negotiation: off    MDI-X: off (auto)    Supports Wake-on: pumbg    Wake-on: g    Current message level: 0x00000007 (7)                   drv probe        detected: yes

也就是Auto-negotiation这里是on的

之后我们使用下面命令修改掉网卡速率

ethtool -s enp4s0 speed 100 duplex full autoneg off

接着查看网卡信息就是百兆的了,之后测试丢包就没有了

欢迎关注Bboysoul的博客www.bboysoul.com

Have Fun

收藏 打印