最近遇到一个问题,一台服务器的千兆网口只有百兆速度,记录下定位排查的过程

环境:ubuntu 18.04

使用atop命令查看网口速度

没有atop使用apt-get install atop安装下

执行atop

CleanShot-2020-06-02_15.21.17@2x

发现2个网口,一个1000m,一个100m

强制修改网口匹配速度

执行**“sudo ethtool eno1** ”,查看网口匹配情况

                                                                                                                                                           Settings for eno1:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  100baseT/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: 100Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: on (auto)
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes

将eno1强制设置为1000m自协商全双工,并重启网口

sudo ethtool -s eno1 speed 1000 duplex full autoneg on;
sudo ethtool -r eno1;

这时神奇的情况出现了:断网了!!!

还好有一个备用网口插着网线,这时候派上用场了

通过另一个网口登陆查看eno1网口的匹配情况

sudo ethtool eno1                                                                     ─╯
Settings for eno1:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  1000baseT/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: Unknown!
	Duplex: Unknown! (255)
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: on (auto)
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: no

发现Speed和Duplex均为Unknown

然后把网口设置回100m,网口又通了

sudo ethtool -s eno1 speed 100 duplex full autoneg on;sudo ethtool -r eno1;

联系网管,交换机侧设置成1000m,网又断了,设置成100m,就通了

总结下:

无论服务器还是交换机,只要设置成1000m,就断网,设置成100m,又恢复了

网上查资料,很可能是网线的原因,只能等下次去机房排查了。

参考:

https://blog.csdn.net/liwei924/article/details/80881578