我最近买了一台新的戴尔 Optiplex 7090 机器,i9- 10900,64GB 内存
我尝试在其上安装 Ubuntu 20.04(服务器,不使用 GUI,因此仅使用服务器版本),但在选择安装 Ubuntu 的第一个屏幕后,显示屏变为空白/丢失信号。我猜想硬件对于 20.04 来说太新了。
我安装了 20.10(或者可能是 21.04),安装得很好,没有问题,如预期一样顺利。然而,在进行了 15 分钟左右的基本设置后,我的 SSH 连接变慢/断开。调查后,我发现大量数据包丢失 - 看起来像是网络上的 IP 冲突。我检查并更改了 IP,但没有什么变化。
它使用直接插入路由器的板载 Gbit LAN。我将网线与旁边的另一台没有问题的 PC 交换(这意味着它也使用路由器上的其他端口)。我尝试设置静态 IP,尝试从头开始重新安装,尝试了不同版本的 Ubuntu 20.04/21.04/21.10(我现在使用的版本)。我尝试了 CentOS 8 - 运行良好,没有网络数据包丢失,但我更喜欢使用 Ubuntu,所以想让它正常工作。
最后我发现,如果我将某个 USB 记忆棒插入前置 USB3 端口,数据包丢失就会停止,网络连接也会变得稳定。如果我是你,我也不会相信,但我向你保证这会使网络连接稳定。我无论如何也想不出这有什么不同。但这在不同的重新安装中一直存在。我从 USB 拇指驱动器安装 Ubuntu,然后将其移除,使用 15 分钟左右,然后开始出现数据包丢失。然后我插入 USB 驱动器,现在它 100% 稳定(包括整夜 ping)。
所以我很茫然,如果有人有任何想法/建议可以尝试的话,我很想弄清楚这一点?
lspci -v
00:00.0 Host bridge: Intel Corporation Device 9b33 (rev 05)
Subsystem: Dell Device 0a52
Flags: bus master, fast devsel, latency 0
Capabilities: <access denied>
Kernel driver in use: skl_uncore
00:02.0 VGA compatible controller: Intel Corporation CometLake-S GT2 [UHD Graphics 630] (rev 05) (prog-if 00 [VGA controller])
Subsystem: Dell CometLake-S GT2 [UHD Graphics 630]
Flags: bus master, fast devsel, latency 0, IRQ 148
Memory at 6000000000 (64-bit, non-prefetchable) [size=16M]
Memory at 4000000000 (64-bit, prefetchable) [size=256M]
I/O ports at 3000 [size=64]
Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: i915
Kernel modules: i915
00:14.0 USB controller: Intel Corporation Tiger Lake-H USB 3.2 Gen 2x1 xHCI Host Controller (rev 11) (prog-if 30 [XHCI])
Subsystem: Dell Tiger Lake-H USB 3.2 Gen 2x1 xHCI Host Controller
Flags: bus master, medium devsel, latency 0, IRQ 125
Memory at 6001100000 (64-bit, non-prefetchable) [size=64K]
Capabilities: <access denied>
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
00:14.2 RAM memory: Intel Corporation Tiger Lake-H Shared SRAM (rev 11)
Subsystem: Dell Tiger Lake-H Shared SRAM
Flags: fast devsel
Memory at 6001114000 (64-bit, non-prefetchable) [disabled] [size=16K]
Memory at 600111b000 (64-bit, non-prefetchable) [disabled] [size=4K]
Capabilities: <access denied>
00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger Lake-H Serial IO I2C Controller #0 (rev 11)
Subsystem: Dell Tiger Lake-H Serial IO I2C Controller
Flags: bus master, fast devsel, latency 0, IRQ 27
Memory at 4010000000 (64-bit, non-prefetchable) [virtual] [size=4K]
Capabilities: <access denied>
Kernel driver in use: intel-lpss
Kernel modules: intel_lpss_pci
00:16.0 Communication controller: Intel Corporation Tiger Lake-H Management Engine Interface (rev 11)
Subsystem: Dell Tiger Lake-H Management Engine Interface
Flags: bus master, fast devsel, latency 0, IRQ 149
Memory at 6001119000 (64-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel driver in use: mei_me
Kernel modules: mei_me
00:17.0 SATA controller: Intel Corporation Device 43d2 (rev 11) (prog-if 01 [AHCI 1.0])
Subsystem: Dell Device 0a52
Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 127
Memory at 6e920000 (32-bit, non-prefetchable) [size=8K]
Memory at 6e924000 (32-bit, non-prefetchable) [size=256]
I/O ports at 3080 [size=8]
I/O ports at 3088 [size=4]
I/O ports at 3060 [size=32]
Memory at 6e923000 (32-bit, non-prefetchable) [size=2K]
Capabilities: <access denied>
Kernel driver in use: ahci
Kernel modules: ahci
00:1b.0 PCI bridge: Intel Corporation Device 43c4 (rev 11) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 122
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
I/O behind bridge: [disabled]
Memory behind bridge: 6e800000-6e8fffff [size=1M]
Prefetchable memory behind bridge: [disabled]
Capabilities: <access denied>
Kernel driver in use: pcieport
00:1c.0 PCI bridge: Intel Corporation Device 43bd (rev 11) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 123
Bus: primary=00, secondary=02, subordinate=03, sec-latency=0
I/O behind bridge: [disabled]
Memory behind bridge: [disabled]
Prefetchable memory behind bridge: [disabled]
Capabilities: <access denied>
Kernel driver in use: pcieport
00:1f.0 ISA bridge: Intel Corporation Device 4384 (rev 11)
Subsystem: Dell Device 0a52
Flags: bus master, fast devsel, latency 0
00:1f.3 Audio device: Intel Corporation Device f0c8 (rev 11)
Subsystem: Dell Device 0a52
Flags: bus master, fast devsel, latency 64, IRQ 150
Memory at 6001110000 (64-bit, non-prefetchable) [size=16K]
Memory at 6001000000 (64-bit, non-prefetchable) [size=1M]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
00:1f.4 SMBus: Intel Corporation Tiger Lake-H SMBus Controller (rev 11)
Subsystem: Dell Tiger Lake-H SMBus Controller
Flags: medium devsel, IRQ 16
Memory at 6001118000 (64-bit, non-prefetchable) [size=256]
I/O ports at efa0 [size=32]
Kernel driver in use: i801_smbus
Kernel modules: i2c_i801
00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger Lake-H SPI Controller (rev 11)
Subsystem: Dell Tiger Lake-H SPI Controller
Flags: fast devsel
Memory at 6e922000 (32-bit, non-prefetchable) [size=4K]
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (14) I219-LM (rev 11)
Subsystem: Dell Ethernet Connection (14) I219-LM
Flags: bus master, fast devsel, latency 0, IRQ 124
Memory at 6e900000 (32-bit, non-prefetchable) [size=128K]
Capabilities: <access denied>
Kernel driver in use: e1000e
Kernel modules: e1000e
01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/980PRO (prog-if 02 [NVM Express])
Subsystem: Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/980PRO
Flags: bus master, fast devsel, latency 0, IRQ 16, NUMA node 0
Memory at 6e800000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: nvme
Kernel modules: nvme
02:00.0 PCI bridge: Texas Instruments XIO2001 PCI Express-to-PCI Bridge (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=02, secondary=03, subordinate=03, sec-latency=0
I/O behind bridge: [disabled]
Memory behind bridge: [disabled]
Prefetchable memory behind bridge: [disabled]
Capabilities: <access denied>
答案1
MTU 为 1500 是默认值,在大多数情况下应该都很好。不过,有些网络需要更小的值,例如 1492,并且不会在初始协商中传达此信息。最好进行一些测试,看看 MTU 设置是否是导致数据包丢失过多的原因。
就是这样:
如果您对文件进行了任何更改
/etc/dhcp/dhclient.conf
,请删除它们并重新启动服务器用于
ping
在更改 MTU 设置时检查数据包丢失:ping -c 4 -M do -s 1472 151.101.193.69
定义:
选项 定义 -c 4
计数 ⇢ 迭代的次数 -M do
设置路径 MTU 发现策略 ⇢ do
不允许任何级别的碎片化-s 1472
数据包大小(以位为单位)(1472 + 28 开销 = 1500) 151.101.193.69
AskUbuntu 的 IP 地址。可以使用任何地址,但要避免使用 Google 拥有的服务,因为它们并不总是响应 ping 请求。 您可能会看到如下输出:
ping -c 4 -M do -s 1472 151.101.193.69 PING 151.101.193.69 (151.101.193.69) 1472(1500) bytes of data. From 192.168.0.1 icmp_seq=1 Frag needed and DF set (mtu = 1454) ping: local error: message too long, mtu=1454 ping: local error: message too long, mtu=1454 ping: local error: message too long, mtu=1454 --- 151.101.193.69 ping statistics --- 4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3074ms
调整该
-s
值直到没有碎片和message too long
错误。例如:ping -c 4 -M do -s 1200 151.101.193.69 PING 151.101.193.69 (151.101.193.69) 1200(1228) bytes of data. 1208 bytes from 151.101.193.69: icmp_seq=1 ttl=59 time=5.52 ms 1208 bytes from 151.101.193.69: icmp_seq=2 ttl=59 time=5.72 ms 1208 bytes from 151.101.193.69: icmp_seq=3 ttl=59 time=5.64 ms 1208 bytes from 151.101.193.69: icmp_seq=4 ttl=59 time=5.68 ms --- 151.101.193.69 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 5.517/5.640/5.720/0.076 ms
对于这个例子,我发现
1200
,MTU 为 ,1228
导致零数据包丢失。笔记:理想情况下,您应该从10 开始
1472
,然后以 10 左右的增量逐渐减少。如果 MTU 值太低,您的传输速度就会受到影响。在文件中为您的网络设置适当的 MTU 值
/etc/dhcp/dhclient.conf
:default interface-mtu 1228; supersede interface-mtu 1228;
笔记:确保更改
1228
为适合您的网络的 MTU 大小。如果您有多个接口,您可以指定哪个接口应该具有哪个 MTU 值:
interface "enp0s31f6" { default interface-mtu 1228; supersede interface-mtu 1228; }
重新启动网络并确保接口已启动:
sudo service networking restart sudo ifup enp0s31f6
验证 MTU 值:
sudo ifconfig | grep mtu
这可能会给你类似这样的结果:
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1228 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 veth43316c1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 veth80786dc: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 vethf40bd74: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
有了这个,希望你的数据包丢失将成为过去