默认网桥上的 LXD 容器无法从网络 ping 通,也无法 ping 除主机之外的任何地址

默认网桥上的 LXD 容器无法从网络 ping 通,也无法 ping 除主机之外的任何地址

再会,

我遇到了以下情况,我在安装过程中允许 lxd 创建网桥 lxbr0。实际上,容器只能联系/ping 主机,而主机可以联系/ping 容器。网络上看不到容器,或者它们无法访问内部网络

我的容器上的 ifconfig

eth0      Link encap:Ethernet  HWaddr 00:16:3e:0f:c5:19
inet addr:192.168.100.120  Bcast:192.168.100.255  Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe0f:c519/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1606 (1.6 KB)  TX bytes:6694 (6.6 KB)

lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:75 errors:0 dropped:0 overruns:0 frame:0
      TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1
      RX bytes:7743 (7.7 KB)  TX bytes:7743 (7.7 KB)

容器上的路由表

default         192.168.100.2   0.0.0.0         UG    0      0        0 eth0
192.168.100.0   *               255.255.255.0   U     0      0        0 eth0

主机上的接口

ens160    Link encap:Ethernet  HWaddr 00:0c:29:64:78:f8
      inet addr:192.168.100.1  Bcast:192.168.100.255  Mask:255.255.255.0
      inet6 addr: fe80::20c:29ff:fe64:78f8/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:60944 errors:0 dropped:4075 overruns:0 frame:0
      TX packets:985 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:5309138 (5.3 MB)  TX bytes:125548 (125.5 KB)

lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:160 errors:0 dropped:0 overruns:0 frame:0
      TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1
      RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)

lxbr0     Link encap:Ethernet  HWaddr fe:7b:16:c9:4d:f1
      inet addr:192.168.100.2  Bcast:0.0.0.0  Mask:255.255.255.0
      inet6 addr: fe80::30f5:79ff:fe06:1dfd/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:139 errors:0 dropped:0 overruns:0 frame:0
      TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:5252 (5.2 KB)  TX bytes:1298 (1.2 KB)

vethX9FIBG Link encap:Ethernet  HWaddr fe:7b:16:c9:4d:f1
      inet6 addr: fe80::fc7b:16ff:fec9:4df1/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:139 errors:0 dropped:0 overruns:0 frame:0
      TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:7198 (7.1 KB)  TX bytes:1606 (1.6 KB)

主机上的路由表

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.100.247 0.0.0.0         UG    0      0        0 ens160
localnet        *               255.255.255.0   U     0      0        0 ens160
localnet        *               255.255.255.0   U     0      0        0 lxbr0   

有人可以给我提示吗?

编辑预期行为是让容器从本地网络可访问,并且容器能够访问本地网络或互联网,容器实际上无法安装新的打包程序或运行 apt-get update /upgrade/install

相关内容