ผมรู้ว่าผมสามารถกำหนด IP /etc/network/interfacesแบบคงที่ด้วยตนเองโดยใช้
ฉันยังรู้ว่าฉันสามารถอ่านที่อยู่ MAC ของภาชนะ LXC (เช่นโดยการมองหาlxc.network.hwaddrรายการใน/var/lib/lxc/<container-name>/configและกำหนดไอพีโดยใช้รายการในdhcp-host=<mac-addr>,10.0.3.3/etc/dnsmasq.d/<some file>
ในไฟล์ที่/etc/default/lxc-netฉันอ่าน
# Uncomment the next line if you'd like to use a conf-file for the lxcbr0
# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
# container 'mail1' always get ip address 10.0.3.100.
#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
นั่นจะเหมาะกับความต้องการของฉัน; น่าเสียดายที่การทำเช่นนั้นไม่มีผลกระทบ
lxc-netไม่ช่วยถ้าคุณไม่เอา lxcbr0 bridge ของคุณ ดูคำตอบของฉัน