我有 3 个物理网络适配器,“ip addr”收到此信息:
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: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 00:1b:21:e4:35:cd brd ff:ff:ff:ff:ff:ff
3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:2e:99:a4:1a:d8 brd ff:ff:ff:ff:ff:ff
4: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether b4:2e:99:a4:1a:da brd ff:ff:ff:ff:ff:ff
当我插入网线时,出现错误 - “激活网络连接失败”。tail -f var/log/syslog 我得到了这个:
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.8971] device (enp4s0): Activation: starting connection 'Wired connection 3' (4bdf56c2-e37a-39d4-a1f4-ddc769e5091f)
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.8973] audit: op="connection-activate" uuid="4bdf56c2-e37a-39d4-a1f4-ddc769e5091f" name="Wired connection 3" pid=1154 uid=1000 result="success"
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.8976] device (enp4s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.8979] manager: NetworkManager state is now CONNECTING
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.8985] device (enp4s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.8995] device (enp4s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.9000] dhcp4 (enp4s0): activation: beginning transaction (timeout in 45 seconds)
Sep 2 17:38:20 RobotControlSystem NetworkManager[780]: <info> [1599050300.9023] dhcp4 (enp4s0): dhclient started with pid 3388
Sep 2 17:38:20 RobotControlSystem avahi-daemon[779]: Joining mDNS multicast group on interface enp4s0.IPv6 with address fe80::d76:ca03:b6f:1993.
Sep 2 17:38:20 RobotControlSystem avahi-daemon[779]: New relevant interface enp4s0.IPv6 for mDNS.
Sep 2 17:38:20 RobotControlSystem avahi-daemon[779]: Registering new address record for fe80::d76:ca03:b6f:1993 on enp4s0.*.
Sep 2 17:38:20 RobotControlSystem dhclient[3388]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 3 (xid=0x9e8c266e)
Sep 2 17:38:23 RobotControlSystem dhclient[3388]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 5 (xid=0x9e8c266e)
Sep 2 17:38:28 RobotControlSystem dhclient[3388]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 5 (xid=0x9e8c266e)
Sep 2 17:38:33 RobotControlSystem dhclient[3388]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 7 (xid=0x9e8c266e)
Sep 2 17:38:40 RobotControlSystem dhclient[3388]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 16 (xid=0x9e8c266e)
Sep 2 17:38:51 RobotControlSystem ubuntu-report[936]: level=error msg="data were not delivered successfully to metrics server, retrying in 480s"
Sep 2 17:38:56 RobotControlSystem dhclient[3388]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 12 (xid=0x9e8c266e)
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <warn> [1599050345.8559] dhcp4 (enp4s0): request timed out
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <info> [1599050345.8559] dhcp4 (enp4s0): state changed unknown -> timeout
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <info> [1599050345.8722] dhcp4 (enp4s0): canceled DHCP transaction, DHCP client pid 3388
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <info> [1599050345.8722] dhcp4 (enp4s0): state changed timeout -> done
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <info> [1599050345.8727] device (enp4s0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <info> [1599050345.8730] manager: NetworkManager state is now DISCONNECTED
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <warn> [1599050345.8735] device (enp4s0): Activation: failed for connection 'Wired connection 3'
Sep 2 17:39:05 RobotControlSystem NetworkManager[780]: <info> [1599050345.8743] device (enp4s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Sep 2 17:39:05 RobotControlSystem avahi-daemon[779]: Withdrawing address record for fe80::d76:ca03:b6f:1993 on enp4s0.
Sep 2 17:39:05 RobotControlSystem avahi-daemon[779]: Leaving mDNS multicast group on interface enp4s0.IPv6 with address fe80::d76:ca03:b6f:1993.
Sep 2 17:39:05 RobotControlSystem avahi-daemon[779]: Interface enp4s0.IPv6 no longer relevant for mDNS.
Sep 2 17:42:52 RobotControlSystem NetworkManager[780]: <info> [1599050572.9419] policy: auto-activating connection 'Wired connection 3'
更新 1: 另外,我还可以手动设置 IP 地址、子网掩码、网关和 DNS 服务器,并得到以下信息:
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8209] device (enp4s0): Activation: starting connection 'Wired connection 3' (4bdf56c2-e37a-39d4-a1f4-ddc769e5091f)
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8211] audit: op="connection-activate" uuid="4bdf56c2-e37a-39d4-a1f4-ddc769e5091f" name="Wired connection 3" pid=4293 uid=1000 result="success"
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8214] device (enp4s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8217] manager: NetworkManager state is now CONNECTING
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8222] device (enp4s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8237] device (enp4s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Sep 2 19:51:03 RobotControlSystem avahi-daemon[779]: Joining mDNS multicast group on interface enp4s0.IPv6 with address fe80::d76:ca03:b6f:1993.
Sep 2 19:51:03 RobotControlSystem avahi-daemon[779]: New relevant interface enp4s0.IPv6 for mDNS.
Sep 2 19:51:03 RobotControlSystem avahi-daemon[779]: Registering new address record for fe80::d76:ca03:b6f:1993 on enp4s0.*.
Sep 2 19:51:03 RobotControlSystem avahi-daemon[779]: Joining mDNS multicast group on interface enp4s0.IPv4 with address 192.168.88.207.
Sep 2 19:51:03 RobotControlSystem avahi-daemon[779]: New relevant interface enp4s0.IPv4 for mDNS.
Sep 2 19:51:03 RobotControlSystem avahi-daemon[779]: Registering new address record for 192.168.88.207 on enp4s0.IPv4.
Sep 2 19:51:03 RobotControlSystem whoopsie[1555]: [19:51:03] Cannot reach: https://daisy.ubuntu.com
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8278] device (enp4s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8288] device (enp4s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8290] device (enp4s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8291] manager: NetworkManager state is now CONNECTED_LOCAL
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8386] manager: NetworkManager state is now CONNECTED_SITE
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8388] policy: set 'Wired connection 3' (enp4s0) as default for IPv4 routing and DNS
Sep 2 19:51:03 RobotControlSystem NetworkManager[3879]: <info> [1599058263.8394] device (enp4s0): Activation: successful, device activated.
Sep 2 19:51:03 RobotControlSystem dbus-daemon[751]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.121' (uid=0 pid=3879 comm="/usr/sbin/NetworkManager --no-daemon " label="unconfined")
Sep 2 19:51:03 RobotControlSystem systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 2 19:51:03 RobotControlSystem gsd-sharing[1290]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit gnome-user-share-webdav.service not loaded.
Sep 2 19:51:03 RobotControlSystem gsd-sharing[1290]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit rygel.service not loaded.
Sep 2 19:51:03 RobotControlSystem gsd-sharing[1290]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit gnome-remote-desktop.service not loaded.
Sep 2 19:51:03 RobotControlSystem dbus-daemon[751]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 2 19:51:03 RobotControlSystem systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 2 19:51:03 RobotControlSystem nm-dispatcher: req:1 'up' [enp4s0]: new request (1 scripts)
Sep 2 19:51:03 RobotControlSystem nm-dispatcher: req:1 'up' [enp4s0]: start running ordered scripts...
Sep 2 19:51:13 RobotControlSystem whoopsie[1555]: [19:51:13] Cannot reach: https://daisy.ubuntu.com
Sep 2 19:51:23 RobotControlSystem whoopsie[1555]: [19:51:23] Cannot reach: https://daisy.ubuntu.com
Sep 2 19:51:29 RobotControlSystem systemd-resolved[581]: Using degraded feature set (UDP) for DNS server 192.168.88.1.
Sep 2 19:51:33 RobotControlSystem whoopsie[1555]: [19:51:33] Cannot reach: https://daisy.ubuntu.com
答案1
您的网络接口似乎已关闭,您可以使用“sudo ifup 'interface' up”来启动它们,如果这些命令无法设置它们,还有其他几个命令。您可以在“50-cloud-init.yaml”中设置静态 IP 或 DHCP 租约。使用“sudo nano /etc/netplan/50-cloud-init.yaml”,然后使用“netplan try”,然后使用“netplan apply”。通过 ping 服务器(即“google.com”)进行测试。
答案2
我的问题出在路由器设置上。安全选项 - 访问控制已启用,并按 Mac 地址检查路由器客户端。