Debian

無法通過乙太網連接訪問網路

  • May 9, 2021

我在嘗試從執行 Proxmox (Debian Buster) 和5.11 核心的新機器連接到我的網路時遇到問題。這個核心是支持我主機板上的 Intel I219V 乙太網連接所必需的。以下是網路配置,以及嘗試 ping 路由器和 8.8.8.8 時失敗的日誌。

root@pve:~# ip addr show
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 pfifo_fast master vmbr0 state UP group default qlen 1000
   link/ether a8:a1:59:6a:fe:3e brd ff:ff:ff:ff:ff:ff
4: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
   link/ether d2:32:44:29:bc:6e brd ff:ff:ff:ff:ff:ff
   inet 192.168.42.43/24 brd 192.168.42.255 scope global vmbr0
      valid_lft forever preferred_lft forever
   inet6 fe80::d032:44ff:fe29:bc63/64 scope link
      valid_lft forever preferred_lft forever

root@pve:~# dhcp enp0s31f6

root@pve:~# ip addr show
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 pfifo_fast master vmbr0 state UP group default qlen 1000
   link/ether a8:a1:59:6a:fe:3e brd ff:ff:ff:ff:ff:ff
   inet 192.168.0.10/24 brd 192.168.0.255 scope global dynamic enp0s31f6
      valid_lft 85711sec preferred_lft 85711sec
   inet6 fe80::aaa1:59ff:fe6a:fe3e/64 scope link
      valid_lft forever preferred_lft forever
4: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
   link/ether d2:32:44:29:bc:6e brd ff:ff:ff:ff:ff:ff
   inet 192.168.42.43/24 brd 192.168.42.255 scope global vmbr0
      valid_lft forever preferred_lft forever
   inet6 fe80::d032:44ff:fe29:bc63/64 scope link
      valid_lft forever preferred_lft forever

root@pve:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface enp0s31f6 inet manual

auto vmbr0
iface vmbr0 inet static
       address 192.168.42.43/24
       gateway 192.168.0.1
       bridge_ports enp0s31f6
       bridge_stp off
       bridge_fd 0

root@pve:~# ip route
default via 192.168.0.1 dev vmbr0 onlink
192.168.0.0/24 dev enp0s31f6 proto kernel scope link src 192.168.0.10
192.168.42.0/24 dev vmbr0 proto kernel scope link src 192.168.42.43

root@pve:~# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.10 icmp_seq=1 Destination Host Unreachable
From 192.168.0.10 icmp_seq=2 Destination Host Unreachable
From 192.168.0.10 icmp_seq=3 Destination Host Unreachable
From 192.168.0.10 icmp_seq=4 Destination Host Unreachable

root@pve:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
# hangs here indefinitely...

您的介面 vmbr0 在與 IP 地址不同的子網(換句話說,另一個邏輯範圍)中配置了預設網關。網關 IP 告訴系統如何到達另一個子網,沒有它,數據包將不會離開目前子網。

例如,192.168.42.0/24 子網具有以下可用 IP 地址範圍:

192.168.42.1 - 192.168.42.254

引用自:https://unix.stackexchange.com/questions/648870