昨天我格式化了我的计算机并设置了 Windows 和 Ubuntu 19.04。以前我有 Ubuntu 16.04 和 Windows,一切正常。
但是现在,当我访问大型网站或下载某些内容时,互联网就会停止,恢复互联网的唯一方法是关闭 wifi 然后再打开。但正如您可能想到的那样,这非常烦人。
当我 ping google.com 并在运行它的过程中开始下载任何内容时,出现“无可用缓冲区空间”消息。
$ ping google.com
64 bytes from waw02s17-in-x0e.1e100.net (2a00:1450:401b:807::200e): icmp_seq=562 ttl=55 time=14.2 ms
64 bytes from waw02s17-in-x0e.1e100.net (2a00:1450:401b:807::200e): icmp_seq=563 ttl=55 time=9.76 ms
64 bytes from waw02s17-in-x0e.1e100.net (2a00:1450:401b:807::200e): icmp_seq=564 ttl=55 time=10.8 ms
ping: sendmsg: No buffer space available
我尝试用谷歌搜索并找到了很多潜在的解决方案但都没有用。
我尝试通过改变值来增加缓冲区
proc/sys/net/core/wmem_max
我更改了此文件中的配置
/etc/sysctl.conf
并添加了以下内容:
net.core.rmem_max = 12582912
net.core.wmem_default = 524288
net.core.wmem_max = 12582912
net.ipv4.tcp_wmem = 10240 87380 12582912
net.ipv4.tcp_rmem = 10240 87380 12582912
net.ipv4.tcp_mem = 524288 524288 524288
net.core.netdev_max_backlog = 5000
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1
当然,应用之后我运行sudo sysctl -p
并重新启动了计算机。
- 最后我尝试重新安装以太网驱动程序
调试信息:我的网卡是 Realtek RTL8111/8168/8411。我发现很多人也遇到了这个问题;但正如我之前在同一台笔记本电脑上使用 Ubuntu 时所说,我没有遇到这样的问题。
$ lspci | grep -i ethernet
04:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12)
$ ifconfig
enp4s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 54:ab:3a:9b:f0:57 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 128 base 0x5000
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 5936 bytes 557194 (557.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5936 bytes 557194 (557.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.129 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 2a02:a310:462:b200:ac14:df84:b0f4:c30e prefixlen 64 scopeid 0x0<global>
inet6 fe80::4124:86b0:667a:ce5e prefixlen 64 scopeid 0x20<link>
inet6 2a02:a310:462:b200:cdec:11a8:1953:57c7 prefixlen 64 scopeid 0x0<global>
ether 40:49:0f:6f:93:21 txqueuelen 1000 (Ethernet)
RX packets 319194 bytes 420767039 (420.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 59135 bytes 11130642 (11.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
这是我重新安装的驱动程序
$ ethtool -i enp4s0f1
driver: r8168
version: 8.047.04-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:04:00.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
我知道这个问题已经被问过好几次了,但说实话我不知道我是不是做错了什么(比如重新安装驱动程序)或者我没有找到一些明显的解决方案。所以任何帮助都会很棒!
编辑1
$free -h
total used free shared buf/cache available
Mem: 7,7Gi 1,5Gi 4,2Gi 436Mi 2,0Gi 5,4Gi
Swap: 1,9Gi 0B 1,9Gi
$sudo lshw -C network
*-network
description: Wireless interface
product: QCA9377 802.11ac Wireless Network Adapter
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:03:00.0
logical name: wlp3s0
version: 31
serial: 40:49:0f:6f:93:21
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ath10k_pci driverversion=5.0.0-31-generic firmware=WLAN.TF.2.1-00021-QCARMSWP-1 ip=192.168.0.129 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:132 memory:94200000-943fffff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0.1
bus info: pci@0000:04:00.1
logical name: enp4s0f1
version: 12
serial: 54:ab:3a:9b:f0:57
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.047.04-NAPI latency=0 link=no multicast=yes port=twisted pair
resources: irq:127 ioport:3000(size=256) memory:94404000-94404fff memory:94400000-94403fff
编辑2
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda7 during installation
UUID=6f325414-8363-4321-accd-293a9df2c941 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda4 during installation
UUID=80E4-D98C /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda10 during installation
UUID=1a73b541-6f90-495e-8e9a-62d5ee51348d /home ext4 defaults 0 2
# swap was on /dev/sda9 during installation
UUID=a759fb41-aee4-44ff-8122-99c8fa2f2ce9 none swap sw 0 0
$ free -h
total used free shared buf/cache available
Mem: 7,7Gi 1,4Gi 4,3Gi 378Mi 2,0Gi 5,6Gi
Swap: 1,9Gi 0B 1,9Gi
答案1
从 2G 交换分区切换到 4G /swapfile,并更改 vm.swappiness。
注意:所有这些改变都可以轻松撤销。
在terminal
...中创建一个新的 4G /swapfile...
sudo swapoff -a
sudo rm /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
使用free -h
或swapon
命令确认4G交换。
编辑/etc/fstab
( sudo -H gedit /etc/fstab
),并更改此...
# swap was on /dev/sda9 during installation
UUID=a759fb41-aee4-44ff-8122-99c8fa2f2ce9 none swap sw 0 0
对此...
# swap was on /dev/sda9 during installation
# UUID=a759fb41-aee4-44ff-8122-99c8fa2f2ce9 none swap sw 0 0
并添加此...
# swap was moved to /swapfile
/swapfile none swap sw 0 0
保存文件并退出 gedit。
对于 vm.swappiness 的临时更改...
sudo sysctl vm.swappiness=80
对于 vm.swappiness 永久改变...
- 编辑
/etc/sysctl.conf
(sudo -H gedit /etc/sysctl.conf
) - 添加
vm.swappiness=80
- 保存文件并退出 gedit
- 重启
答案2
我有同样的问题。
在我的情况下,这是 wifi 切换频道造成的错误。我在路由器设置中强制使用稳定频道和 20MHz 的频道宽度(而不是 80/40/20),wifi 工作正常,没有崩溃。