微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

LXC4 无网络 (Fc34)

如何解决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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。