我安装了 Ubuntu 18.04 和 22.04 双启动。当我登录 18.04 时,网络设置中的有线连接显示链接速度为 1000 Mb/s,而在 22.04 中则显示 100 Mb/s。
有关 Ubuntu 22.04 的信息:
> uname -a
Linux cc 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
> sudo lshw -C network
*-network
description: Wireless interface
product: RTL8812AE 802.11ac PCIe Wireless Network Adapter
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:07:00.0
logical name: wlp7s0
version: 01
serial: d0:37:45:4c:0f:b3
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=rtl8821ae driverversion=5.19.0-35-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11
resources: irq:79 ioport:e000(size=256) memory:fcb00000-fcb03fff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:08:00.0
logical name: enp8s0
version: 15
serial: 04:d9:f5:76:15:b0
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.19.0-35-generic duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 ip=192.168.0.100 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:39 ioport:d000(size=256) memory:fca04000-fca04fff memory:fca00000-fca03fff
> sudo ethtool enp8s0
Settings for enp8s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 100baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: slave
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: d
Link detected: yes
> sudo ethtool -i enp8s0
version: 5.19.0-35-generic
firmware-version: rtl8168h-2_0.0.2 02/26/15
expansion-rom-version:
bus-info: 0000:08:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
> lspci | awk '/[Nn]et/ {print $1}' | xargs -i% lspci -ks %
07:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8812AE 802.11ac PCIe Wireless Network Adapter (rev 01)
Subsystem: Realtek Semiconductor Co., Ltd. RTL8812AE 802.11ac PCIe Wireless Network Adapter
Kernel driver in use: rtl8821ae
Kernel modules: rtl8821ae
08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: ASUSTeK Computer Inc. PRIME B450M-A Motherboard
Kernel driver in use: r8169
Kernel modules: r8169
> sudo dmesg | grep r8169 # the up and down links are me setting the speed to 1000 and 100
[ 1.021751] r8169 0000:08:00.0 eth0: RTL8168h/8111h, 04:d9:f5:76:15:b0, XID 541, IRQ 54
[ 1.021756] r8169 0000:08:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
[ 2.775004] r8169 0000:08:00.0 enp8s0: renamed from eth0
[ 5.878614] Generic FE-GE Realtek PHY r8169-0-800:00: attached PHY driver (mii_bus:phy_addr=r8169-0-800:00, irq=MAC)
[ 6.066748] r8169 0000:08:00.0 enp8s0: Link is Down
[ 22.934280] Generic FE-GE Realtek PHY r8169-0-800:00: Downshift occurred from negotiated speed 1Gbps to actual speed 100Mbps, check cabling!
[ 22.934294] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full (downshifted) - flow control rx/tx
[ 298.818969] r8169 0000:08:00.0 enp8s0: Link is Down
[ 325.940383] r8169 0000:08:00.0 enp8s0: Link is Down
[ 344.602188] Generic FE-GE Realtek PHY r8169-0-800:00: Downshift occurred from negotiated speed 1Gbps to actual speed 100Mbps, check cabling!
[ 344.602201] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full (downshifted) - flow control rx/tx
[ 892.022066] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1021.829180] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1033.732636] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1070.106381] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1082.716879] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1085.513138] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 1485.561946] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1587.331448] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1590.190212] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 1674.111292] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1843.666686] r8169 0000:08:00.0 enp8s0: Link is Down
[ 1846.453070] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 2403.530799] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2439.863622] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2442.743673] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 2453.224431] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2457.465233] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2550.292449] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2553.750133] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 2602.361706] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2692.932207] r8169 0000:08:00.0 enp8s0: Link is Down
[ 2695.792083] r8169 0000:08:00.0 enp8s0: Link is Up - 100Mbps/Full - flow control rx/tx
> ip link | grep enpip # on speed 100
2: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
我已经尝试过运行sudo ethtool -s enp8s0 speed 1000 autoneg off duplex full
,但是这样做会断开我的连接。
> sudo ethtool enp8s0 # on speed 1000
Settings for enp8s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 100baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: off
master-slave cfg: preferred slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: d
Link detected: no
> ip link | grep enp # on speed 1000
2: enp8s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
只有当我使用 将速度设置为 100 时,我的连接才会恢复ethtool -s
。我排除了硬件问题,因为当我在 Ubuntu 18.04 中启动时,链接在同一台机器上以 1000 Mb/s 的速度工作。
我怎样才能让它在 Ubuntu 22.04 中以 1000 Mb/s 的速度运行?
编辑:
我跑了:
> sudo apt install r8168-dkms
> sudo rmmod r8169
rmmod: ERROR: Module r8169 is not currently loaded
>echo "blacklist r8169" | sudo tee -a /etc/modprobe.d/blacklist.conf
blacklist r8169
并执行了硬电源循环。这些是日志中的差异(基本上只是将几个地方从 更改为r8169
)r8168
但问题仍然存在:
> sudo lshw -C network
*-network
description: Wireless interface
product: RTL8812AE 802.11ac PCIe Wireless Network Adapter
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:07:00.0
logical name: wlp7s0
version: 01
serial: d0:37:45:4c:0f:b3
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=rtl8821ae driverversion=5.19.0-35-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11
resources: irq:79 ioport:e000(size=256) memory:fcb00000-fcb03fff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:08:00.0
logical name: enp8s0
version: 15
serial: 04:d9:f5:76:15:b0
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix 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.049.02-NAPI duplex=full ip=192.168.0.100 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:46 ioport:d000(size=256) memory:fca04000-fca04fff memory:fca00000-fca03fff
> sudo ethtool enp8s0
Settings for enp8s0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 100baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Auto-negotiation: on
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
drv probe ifdown ifup
Link detected: yes
> sudo ethtool -i enp8s0
driver: r8168
version: 8.049.02-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:08:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
> lspci | awk '/[Nn]et/ {print $1}' | xargs -i% lspci -ks %
07:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8812AE 802.11ac PCIe Wireless Network Adapter (rev 01)
Subsystem: Realtek Semiconductor Co., Ltd. RTL8812AE 802.11ac PCIe Wireless Network Adapter
Kernel driver in use: rtl8821ae
Kernel modules: rtl8821ae
08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: ASUSTeK Computer Inc. PRIME B450M-A Motherboard
Kernel driver in use: r8168
Kernel modules: r8168
> sudo ethtool enp8s0 # on speed 1000
Settings for enp8s0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Auto-negotiation: on
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
drv probe ifdown ifup
答案1
我确实设法使用 5.19 内核按照以下步骤解决了该问题:
- 下载“适用于内核 5.19 的 GBE 以太网 LINUX 驱动程序 r8168”https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
- 提取并运行该
autorun.sh
文件sudo
- 重启计算机
- 跑步
sudo ethtool -s enp8s0 speed 1000 autoneg on duplex full
- 拔下以太网电缆并重新插入
我不确定这些步骤哪些是必要的,哪些不是必要的,但现在看来它正在发挥作用。
编辑
我也关注了https://askubuntu.com/a/1334101/231142正如@Terrance 在评论中所建议的那样。
答案2
Ubuntu 22.04 的最新更新似乎已修复此问题。我刚刚安装了内核 5.19.0-38,这使我的 r8168 上的速度恢复到 1 GB。测试将文件传输到存储卡,速度高达 500 Mb(高清读取速度受限)。