我正在试用 LXD,并从头开始创建了一个基本的 Arch Linux 映像。第一次使用该映像时,它运行良好,但克隆容器或重复使用该映像会导致 networkd 不广播 DHCP 请求。
日志没有提到任何有趣的内容 - LXD 的 dnsmasq 日志没有提到来自克隆容器的任何请求,networkd 的容器日志除了分配链接本地地址之外没有提到任何内容,工作容器日志也没有提到任何特殊内容。
mac地址不同:
chloridecull@changeling:~$ lxc exec pythonhijinx -- ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
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
21: eth1@if22: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:62:f5:96 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::216:3eff:fe62:f596/64 scope link
valid_lft forever preferred_lft forever
23: eth0@if24: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:2d:21:de brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::216:3eff:fe2d:21de/64 scope link
valid_lft forever preferred_lft forever
chloridecull@changeling:~$ lxc exec drawpilesrv -- ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
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
17: eth0@if18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:9e:10:77 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 2a01:████:ffff:████::faff/48 scope global
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe9e:1077/64 scope link
valid_lft forever preferred_lft forever
19: eth1@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:32:33:70 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.0.3.143/24 brd 10.0.3.255 scope global dynamic eth1
valid_lft 3257sec preferred_lft 3257sec
inet6 fe80::216:3eff:fe32:3370/64 scope link
valid_lft forever preferred_lft forever
系统ID不同:
chloridecull@changeling:~$ lxc exec pythonhijinx -- cat /etc/machine-id
734bc201668745ff8259753d22fee54d
chloridecull@changeling:~$ lxc exec drawpilesrv -- cat /etc/machine-id
dec5bf32ce6b4017869fb872e7663e15
正在使用的配置文件:
chloridecull@changeling:~$ lxc profile show default
name: default
config: {}
devices:
eth0:
nictype: bridged
parent: br0
type: nic
eth1:
nictype: bridged
parent: lxcbr0
type: nic
答案1
解决方案比我想象的要简单——由于某种原因,接口交换了位置。
将无效的另一端eth1@if22
与有效的进行比较eth1@if20
:
20: veth7CJ8BF@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master lxcbr0 state UP mode DEFAULT group default qlen 1000
link/ether fe:ec:a2:e5:94:48 brd ff:ff:ff:ff:ff:ff link-netnsid 0
22: vethHK45MP@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT group default qlen 1000
link/ether fe:9b:42:ff:d7:99 brd ff:ff:ff:ff:ff:ff link-netnsid 3
name
可以通过向 LXD 配置文件添加密钥来解决此问题。