Ubuntu 18.04 网络连接随机中断

Ubuntu 18.04 网络连接随机中断

我最近全新安装了 Ubuntu 18.04。

但现在我的网络连接会随机断开。无论是使用以太网还是使用 WLAN 连接,都会发生这种情况。我尝试了两种不同的 WLAN 电缆,之前都运行正常。

输出tail -f /var/log/kern.log为:

Apr 28 15:48:49 i7 kernel: [  408.161936] e1000e: enp0s31f6 NIC Link is Down
Apr 28 15:48:59 i7 kernel: [  418.117433] e1000e: enp0s31f6 NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx/Tx
Apr 28 15:48:59 i7 kernel: [  418.117440] e1000e 0000:00:1f.6 enp0s31f6: 10/100 speed: disabling TSO

lspci

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
00:16.0 Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] (rev 31)
00:1b.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #17 (rev f1)
00:1b.2 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #19 (rev f1)
00:1c.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #1 (rev f1)
00:1d.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Z170 Chipset LPC/eSPI Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller (rev 31)
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-V (rev 31)
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wireless Network Adapter (rev 01)
03:00.0 USB controller: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller
04:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 (rev 01)

ifconfig -a

enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.93  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 fe80::5e03:8c96:eeaa:979a  prefixlen 64  scopeid 0x20<link>
        ether 34:97:f6:8e:9c:e2  txqueuelen 1000  (Ethernet)
        RX packets 106315  bytes 75284075 (75.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 696757  bytes 985446361 (985.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xf7300000-f7320000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 7792  bytes 7648787 (7.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7792  bytes 7648787 (7.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.94  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 fe80::3ea3:7811:db83:317  prefixlen 64  scopeid 0x20<link>
        ether 14:da:e9:f1:a6:6d  txqueuelen 1000  (Ethernet)
        RX packets 438  bytes 139294 (139.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 77  bytes 12333 (12.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sudo lshw -C network

  *-network                 
       description: Wireless interface
       product: RTL8192CE PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: wlp2s0
       version: 01
       serial: 14:da:e9:f1:a6:6d
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtl8192ce driverversion=4.18.0-17-generic firmware=N/A ip=192.168.178.94 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:18 ioport:e000(size=256) memory:f7200000-f7203fff
  *-network
       description: Ethernet interface
       product: Ethernet Connection (2) I219-V
       vendor: Intel Corporation
       physical id: 1f.6
       bus info: pci@0000:00:1f.6
       logical name: enp0s31f6
       version: 31
       serial: 34:97:f6:8e:9c:e2
       size: 100Mbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.8-4 ip=192.168.178.93 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:127 memory:f7300000-f731ffff

有人能帮我吗?

编辑#1:输出ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 34:97:f6:8e:9c:e2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.93/24 brd 192.168.178.255 scope global dynamic noprefixroute enp0s31f6
       valid_lft 805451sec preferred_lft 805451sec
    inet6 fe80::5e03:8c96:eeaa:979a/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 14:da:e9:f1:a6:6d brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.94/24 brd 192.168.178.255 scope global dynamic noprefixroute wlp2s0
       valid_lft 800956sec preferred_lft 800956sec
    inet6 fe80::3ea3:7811:db83:317/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

编辑#2:输出ethtool -g enp0s31f6

Ring parameters for enp0s31f6:
Pre-set maximums:
RX:     4096
RX Mini:    0
RX Jumbo:   0
TX:     4096
Current hardware settings:
RX:     256
RX Mini:    0
RX Jumbo:   0
TX:     256

编辑#3:[已删除]

编辑 #4:所以我刚刚运行了 Ubuntu 19.04 Live USB 版本。我在那里也遇到了同样的问题。同样的消息在 中/var/log/kern.log。此外,我在 中收到以下消息kern.logDriver has suspect GRO implementation, TCP performance may be compromised.

编辑#5:

所以我找到了一个解决方法:我现在使用 USB 以太网适配器(路由器->以太网->适配器->USB->PC)。

更多信息:自从我最初描述问题以来,我认为连接中断发生在我单击链接、打开新选项卡并开始网络搜索时。因此,这可能与启动 http 请求有关。但我不确定。下载大文件时,我不会在下载过程中遇到连接中断的情况。

编辑#6:kern.log禁用 lan 并仅使用 wlan 时:

May  5 18:09:20 i7 kernel: [  108.077780] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 1 (2462/0 MHz)
May  5 18:09:21 i7 kernel: [  108.897066] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 2 (2452/0 MHz)
May  5 18:09:22 i7 kernel: [  109.920896] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 1 (2462/0 MHz)
May  5 18:09:32 i7 kernel: [  120.161068] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 2 (2452/0 MHz)
May  5 18:09:42 i7 kernel: [  130.271599] rtlwifi: AP off, try to reconnect now
May  5 18:09:42 i7 kernel: [  130.271653] wlp2s0: Connection to AP 24:65:11:ad:a3:4a lost
May  5 18:09:43 i7 kernel: [  131.417327] wlp2s0: authenticate with 24:65:11:ad:a3:4a
May  5 18:09:43 i7 kernel: [  131.437037] wlp2s0: send auth to 24:65:11:ad:a3:4a (try 1/3)
May  5 18:09:43 i7 kernel: [  131.440142] wlp2s0: authenticated
May  5 18:09:43 i7 kernel: [  131.444617] wlp2s0: associate with 24:65:11:ad:a3:4a (try 1/3)
May  5 18:09:43 i7 kernel: [  131.451848] wlp2s0: RX AssocResp from 24:65:11:ad:a3:4a (capab=0x431 status=0 aid=3)
May  5 18:09:43 i7 kernel: [  131.452237] wlp2s0: associated
May  5 18:09:46 i7 kernel: [  133.985199] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 1 (2462/0 MHz)
May  5 18:09:47 i7 kernel: [  134.906814] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 2 (2452/0 MHz)
May  5 18:10:20 i7 kernel: [  168.085188] wlp2s0: AP 24:65:11:ad:a3:4a changed bandwidth, new config is 2462 MHz, width 1 (2462/0 MHz)

编辑#7:ethtool -k enp0s31f6

Features for enp0s31f6:                         
rx-checksumming: on                             
tx-checksumming: on                             
        tx-checksum-ipv4: off [fixed]           
        tx-checksum-ip-generic: on              
        tx-checksum-ipv6: off [fixed]           
        tx-checksum-fcoe-crc: off [fixed]       
        tx-checksum-sctp: off [fixed]           
scatter-gather: on                              
        tx-scatter-gather: on                   
        tx-scatter-gather-fraglist: off [fixed] 
tcp-segmentation-offload: off                   
        tx-tcp-segmentation: off [requested on] 
        tx-tcp-ecn-segmentation: off [fixed]    
        tx-tcp-mangleid-segmentation: off       
        tx-tcp6-segmentation: off [requested on]
udp-fragmentation-offload: off                  
generic-segmentation-offload: on                
generic-receive-offload: on                     
large-receive-offload: off [fixed]              
rx-vlan-offload: on                             
tx-vlan-offload: on                             
ntuple-filters: off [fixed]                     
receive-hashing: on                             
highdma: on [fixed]                             
rx-vlan-filter: off [fixed]                     
vlan-challenged: off [fixed]                    
tx-lockless: off [fixed]                        
netns-local: off [fixed]                        
tx-gso-robust: off [fixed]                      
tx-fcoe-segmentation: off [fixed]               
tx-gre-segmentation: off [fixed]                
tx-gre-csum-segmentation: off [fixed]           
tx-ipxip4-segmentation: off [fixed]             
tx-ipxip6-segmentation: off [fixed]             
tx-udp_tnl-segmentation: off [fixed]            
tx-udp_tnl-csum-segmentation: off [fixed]       
tx-gso-partial: off [fixed]                     
tx-sctp-segmentation: off [fixed]               
tx-esp-segmentation: off [fixed]                
tx-udp-segmentation: off [fixed]                
fcoe-mtu: off [fixed]                           
tx-nocache-copy: off                            
loopback: off [fixed]                           
rx-fcs: off                                     
rx-all: off                                     
tx-vlan-stag-hw-insert: off [fixed]             
rx-vlan-stag-hw-parse: off [fixed]              
rx-vlan-stag-filter: off [fixed]                
l2-fwd-offload: off [fixed]                     
hw-tc-offload: off [fixed]                      
esp-hw-offload: off [fixed]                     
esp-tx-csum-hw-offload: off [fixed]             
rx-udp_tunnel-port-offload: off [fixed]         
tls-hw-tx-offload: off [fixed]                  
rx-gro-hw: off [fixed]                          
tls-hw-record: off [fixed]                      

答案1

第一次尝试电源循环拔下路由器的电源插头/等待 10 秒钟/从交流电源重新插入。重新检查掉线问题。

对于以太网掉线问题...虽然这不是首选的解决方案,但您可以尝试一下,看看它是否能解决问题...

在 中terminal,使用nm-connection-editor,将“链路协商”设置为“手动/100Mb/完整”。

在此处输入图片描述

答案2

解决方案是在每次启动后运行以下命令(将 INTERFACENAME 替换为以太网接口的实际名称):

/usr/sbin/ethtool --change INTERFACENAME speed 100 duplex half autoneg off

我使用这个 systemd 服务单元在启动时运行命令:

[Unit]
Description=Ethernet Fix
After=network-online.target

[Service]
ExecStart=PATH_TO_BASH_SCRIPT

[Install]
WantedBy=multi-user.target

相关内容