从 systemd nspawn 添加虚拟网络到容器

从 systemd nspawn 添加虚拟网络到容器

我有虚拟机 ubuntu 22.04。该虚拟机的网络接口处于桥接模式。在这个虚拟机中,我创建了buster容器(debian)并编辑了它的单元文件,我添加了--network-ipvlan=enp0s3。我重新加载了设备,但容器上仍然没有网络。

主机ubuntu 22.04的网络

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:2a:7c:33 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.229/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s3
       valid_lft 86357sec preferred_lft 86357sec
    inet6 fe80::c554:efd5:c2ca:824b/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

容器克星网络

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: iv-enp0s3@if2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 08:00:27:2a:7c:33 brd ff:ff:ff:ff:ff:ff link-netnsid 0

提前致谢

相关内容