![lxd 拥有自己的 br0 网络在 centos 容器中无法访问](https://linux22.com/image/115312/lxd%20%E6%8B%A5%E6%9C%89%E8%87%AA%E5%B7%B1%E7%9A%84%20br0%20%E7%BD%91%E7%BB%9C%E5%9C%A8%20centos%20%E5%AE%B9%E5%99%A8%E4%B8%AD%E6%97%A0%E6%B3%95%E8%AE%BF%E9%97%AE.png)
当我运行 lxd init 时,我选择此设置。
Would you like to create a new network bridge (yes/no)? no
因为我在 /etc/network/interfaces 中创建了自己的 br0
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address x.x.50.2
netmask 255.255.252.0
broadcast x.x.x.255
network x.x.x.0
gateway x.x.53.254
dns-nameservers 8.8.8.8
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
iface eth0 inet manual
然后我启动 lxd centos 并运行
lxc config device add first eth0 nic nictype=bridged parent=br0
lxc config device set first eth0 ipv4.address x.x.51.2
lxc config device set first eth0 security.mac_filtering true
并更改配置
/var/lib/lxd/containers/second/rootfs/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HOSTNAME=LXC_NAME
NM_CONTROLLED=no
TYPE=Ethernet
IPADDR=x.x.51.2
NETMASK=255.255.255.255
GATEWAY=x.x.53.254
DNS1=8.8.8.8
DNS2=x.x.x.x
MTU=
DHCP_HOSTNAME=x.x.50.2
当我尝试 ping 8.8.8.8 时,出现连接:网络无法访问
/etc/resolv.conf
nameserver 8.8.8.8
search lxd
nameserver x.x.x.x
我做错了什么我无法弄清楚,也许我错过了一些概念?