为 lxc 容器设置 macvlan 桥

为 lxc 容器设置 macvlan 桥

我正在尝试创建可以从外部访问的容器。因此,我选择了 macvlan 网络模式,它可以为与主机位于同一网络中的容器分配 IP。
我已在我的 中添加了以下内容/etc/network/interfaces

auto macvlan0

iface macvlan0 inet static

pre-up route del default

pre-up route del -net aa.bb.cc.0 netmask 255.255.255.0

pre-up ip link add link eth0 name macvlan0 type macvlan mode bridge

address 192.168.171.141
this creates a macvlan bridge by the name macvlan0 but i am not able to ping it from inside the container

this is the conf file of my container (i've mentioned only the nerworking part)

 lxc.network.type = macvlan

 lxc.network.macvlan.mode = bridge

 lxc.network.flags = up

 lxc.network.link = eth0

 lxc.network.ipv4 = aa.bb.cc.155/24

谁能告诉我我做错了什么?

相关内容