[lxc-users] LXD static IP in container
Michael Eager
eager at eagerm.com
Wed Feb 5 22:15:51 UTC 2020
I'm running LXD on a Centos 8 host. The container is Fedora 31.
I'm using a bridge (br0), not managed by LXD.
When I start the container, it receives an IP address from the DHCP
server on the LAN. I want to assign the container a static IP.
I removed the eth0 device from the profile and added it to the
container's config. Then I set the IP address.
devices:
eth0:
ipv4.address: 192.168.20.33
name: eth0
nictype: bridged
parent: br0
type: nic
ephemeral: false
profiles:
The container still gets an IP using DHCP.
I tried to set ipv4.dhcp to false, but this failed:
$ lxc config device set d1 eth0 ipv4.dhcp false
Error: Invalid devices: Invalid device option: ipv4.dhcp
I've found various "How-To's" which describe how to set a static
IP, but they depend on cloud-init or netplan. Is there a way
to set a static IP which doesn't require these packages?
--
Michael Eager eager at eagerm.com
1960 Park Blvd., Palo Alto, CA 94306
More information about the lxc-users
mailing list