LXC4 无网络 (Fc34)

问题描述

我尝试在 Fc34 下使用 LXC4,但在容器中没有网络:“网络无法访问。” (lxc-4.0.6-2.fc34.x86_64)

# fc34 container config:
# ...
# distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = x86_64

# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/fedora34/rootfs
lxc.uts.name = fedora34

# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = ......

# not working,it has IP,but no network:
#lxc.net.0.ipv4.address = 10.0.3.100/24
#lxc.net.0.ipv4.gateway = 10.0.3.1

容器中的手册:

ip addr add 10.0.3.100/24 dev eth0

ip route add default via 10.0.3.1 dev eth0

ip 路由

认通过 10.0.3.1 dev eth0

10.0.3.0/24 dev eth0 proto 内核范围链接 src 10.0.3.100

ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) 字节数据。 来自 8.8.8.8 的 64 个字节:icmp_seq=1 ttl=54 time=17.3 ms

vi /etc/systemd/resolved.conf

DNS=8.8.8.8

重启容器:cat /etc/resolv.conf

名称服务器 8.8.8.8 搜索

ping ns.google.com

ping:ns.google.com:名称或服务未知

我需要为自动设置配置什么?

解决方法

它有效。 firewalld 没有伪装规则:

firewall-cmd --zone=FedoraWorkstation --add-masquerade --permanent