AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1171719
Accepted
shinobody
shinobody
Asked: 2019-09-09 04:07:28 +0800 CST2019-09-09 04:07:28 +0800 CST 2019-09-09 04:07:28 +0800 CST

Ubuntu 18.04 以太网无法连接

  • 772

我的 Ubuntu 18.04 拒绝通过以太网连接到互联网。无论我做什么和尝试,我的互联网连接似乎在 90% 的时间都无法正常工作,而且我没有 wifi 适配器。

我尝试了这个解决方案:以太网无法连接(18.04.2) - 它工作了......一次。然后再也没有。

作为记录,我的以太网电缆插入了另一端的路由器,而路由器使用的是移动 LTE 互联网,这有点不可靠。而且我确实弄乱了试图修复它的设置,但问题从安装一开始就一直存在 - 虽然以前互联网有时可以工作,但最近它似乎从来没有工作过。

试图ping 8.8.8.8 导致:

connect: Network is unreachable

键入ifconfig -a结果:

enp3s4f0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9c:8e:99:35:15:80  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 16  

enp3s4f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::5db5:ba12:c784:52de  prefixlen 64  scopeid 0x20<link>
        ether 9c:8e:99:35:15:81  txqueuelen 1000  (Ethernet)
        RX packets 10  bytes 736 (736.0 B)
        RX errors 168  dropped 0  overruns 0  frame 407
        TX packets 133  bytes 23931 (23.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 17  

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 1373  bytes 97213 (97.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1373  bytes 97213 (97.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

打字sudo service networking start结果如下:

Job for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.

键入这些命令会导致:

打字systemctl status networking.service

networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2019-09-08 13:48:04 CEST; 2min 44s ago
     Docs: man:interfaces(5)
  Process: 2560 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 2558 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environmen
 Main PID: 2560 (code=exited, status=1/FAILURE)

wrz 08 13:48:04 shino-ProLiant-ML310-G5p systemd[1]: Starting Raise network interfaces...
wrz 08 13:48:04 shino-ProLiant-ML310-G5p sh[2558]: /etc/network/interfaces:2: misplaced option
wrz 08 13:48:04 shino-ProLiant-ML310-G5p sh[2558]: ifquery: couldn't read interfaces file "/etc/network/interfac
wrz 08 13:48:04 shino-ProLiant-ML310-G5p ifup[2560]: /etc/network/interfaces:2: misplaced option
wrz 08 13:48:04 shino-ProLiant-ML310-G5p ifup[2560]: /sbin/ifup: couldn't read interfaces file "/etc/network/int
wrz 08 13:48:04 shino-ProLiant-ML310-G5p systemd[1]: networking.service: Main process exited, code=exited, statu
wrz 08 13:48:04 shino-ProLiant-ML310-G5p systemd[1]: networking.service: Failed with result 'exit-code'.
wrz 08 13:48:04 shino-ProLiant-ML310-G5p systemd[1]: Failed to start Raise network interfaces.
~
~
~
~
~
~
~

打字journalctl -xe

wrz 08 14:44:58 shino-ProLiant-ML310-G5p megasync[2307]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (devic
wrz 08 14:44:58 shino-ProLiant-ML310-G5p upowerd[1066]: unhandled action 'unbind' on /sys/devices/pci0000:00/000
wrz 08 14:44:58 shino-ProLiant-ML310-G5p update-notifier[2305]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gnome-software[2303]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE 
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gnome-terminal-[2125]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE
wrz 08 14:44:58 shino-ProLiant-ML310-G5p nautilus-deskto[1837]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-media-keys[1781]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE 
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-keyboard[1770]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (d
wrz 08 14:44:58 shino-ProLiant-ML310-G5p transmission-gt[1834]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-color[1767]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (devi
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-clipboard[1759]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-xsettings[1742]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-power[1724]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (devi
wrz 08 14:44:58 shino-ProLiant-ML310-G5p /usr/lib/gdm3/gdm-x-session[1163]: (II) UnloadModule: "libinput"
wrz 08 14:44:58 shino-ProLiant-ML310-G5p /usr/lib/gdm3/gdm-x-session[1163]: (II) systemd-logind: releasing fd fo
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gsd-wacom[1743]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (devi
wrz 08 14:44:58 shino-ProLiant-ML310-G5p gnome-shell[1573]: gdk_device_update_tool: assertion 'GDK_IS_DEVICE (de
wrz 08 14:44:58 shino-ProLiant-ML310-G5p /usr/lib/gdm3/gdm-x-session[1163]: (EE) systemd-logind: failed to relea
wrz 08 14:44:58 shino-ProLiant-ML310-G5p upowerd[1066]: unhandled action 'unbind' on /sys/devices/pci0000:00/000
wrz 08 14:44:58 shino-ProLiant-ML310-G5p upowerd[1066]: unhandled action 'unbind' on /sys/devices/pci0000:00/000
wrz 08 14:44:58 shino-ProLiant-ML310-G5p upowerd[1066]: unhandled action 'unbind' on /sys/devices/pci0000:00/000
wrz 08 14:44:58 shino-ProLiant-ML310-G5p upowerd[1066]: unhandled action 'unbind' on /sys/devices/pci0000:00/000
wrz 08 14:44:58 shino-ProLiant-ML310-G5p upowerd[1066]: unhandled action 'unbind' on /sys/devices/pci0000:00/000

我的 etc/network/interfaces 如下所示:

# interfaces(5) file used by ifup(8) and ifdown(8)
pre-up /usr/sbin/ethtool --change enp3s4f1 speed 100 duplex full autoneg off

“wrz”是九月的波兰语首字母缩写词。

在这一点上,我不知道该怎么办了,我正在考虑重新安装。

编辑:好的,它似乎确实有时会连接,但只是在启动 Ubuntu 后一段时间(20-30 分钟)。我注意到这是否与打字有关,sudo modprobe r8169我现在完全感到困惑。

编辑 2 (09.09.2019) 好的,所以。我正在运行 Ubuntu 桌面。有一条以太网电缆直接从我的路由器 TPLINK TL-MR3220 连接到我的计算机。该路由器有一个通过 USB 直接插入的移动 4G LTE 华为调制解调器。我没有 wifi 适配器,因此目前无法选择无线连接。

我注释掉 /etc/network/interfaces,重新启动并输入sudo lshw -C network

*-network:0               
       description: Ethernet interface
       product: NetXtreme BCM5715 Gigabit Ethernet
       vendor: Broadcom Inc. and subsidiaries
       physical id: 4
       bus info: pci@0000:03:04.0
       logical name: enp3s4f0
       version: a3
       serial: 9c:8e:99:35:15:80
       capacity: 1Gbit/s
       width: 64 bits
       clock: 66MHz
       capabilities: pcix pm vpd msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.137 firmware=5715-v3.29, UMP 1.23 latency=64 link=no mingnt=64 multicast=yes port=twisted pair
       resources: irq:32 memory:f9ff0000-f9ffffff memory:f9fe0000-f9feffff
  *-network:1
       description: Ethernet interface
       product: NetXtreme BCM5715 Gigabit Ethernet
       vendor: Broadcom Inc. and subsidiaries
       physical id: 4.1
       bus info: pci@0000:03:04.1
       logical name: enp3s4f1
       version: a3
       serial: 9c:8e:99:35:15:81
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 66MHz
       capabilities: pcix pm vpd msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.137 duplex=full firmware=5715-v3.29 latency=64 link=yes mingnt=64 multicast=yes port=twisted pair speed=10Mbit/s
       resources: irq:33 memory:f9fd0000-f9fdffff memory:f9fc0000-f9fcffff

然后我输入cat /etc/netplan/*.yaml

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

我还检查了crontab -e(不编辑任何内容)的内容,除了评论,只有一行是:

@reboot dhclient -r eth$ && dhclient eth$

似乎我有时可以在打字后建立连接,sudo modprobe r8169但它似乎有时只能工作,或者经过一段时间后才能工作。

输入dhclient enp3s4f1返回

RTNETLINK answers: Operation not permitted

再次键入sudo似乎可以成功运行它,但没有任何反应。我尝试了另一个以太网端口,结果相同。

编辑3:拔下电缆,关闭计算机,重新启动然后重新插入似乎可以完美且立即连接所有内容。

networking internet ethernet 18.04
  • 1 1 个回答
  • 3121 Views

1 个回答

  • Voted
  1. Best Answer
    heynnema
    2019-09-16T09:41:56+08:002019-09-16T09:41:56+08:00

    从评论...

    我检查了你路由器的规格,它只有 10/100 个 LAN 端口。您将获得 10Mb 连接。我怀疑是电缆问题或自动协商问题。尝试...

    sudo ethtool -s enp3s4f1 speed 100 duplex full autoneg off

    sudo dhclient enp3s4f1

    然后检查sudo lshw -C network参数size,它应该是100Mb. 然后ip a应该显示一个 ipv4 地址。重新启动并确认它仍然按预期工作。

    另外,编辑您的/etc/network/interfaces文件并删除...

    pre-up /usr/sbin/ethtool --change enp3s4f1 speed 100 duplex full autoneg off

    并添加...

    auto lo
    iface lo inet loopback
    
    • 1

相关问题

  • 如何设置 VLAN 转发?

  • 如何将主机 Ubuntu 上的 VPN (tun0) 网络适配器映射到 VirtualBox 来宾 Windows?

  • 如何限制下载/上传带宽?

  • 如何通过 Windows 网络共享文件?

  • 面板小程序以文本形式显示当前网络流量?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve