On Sun, Dec 22, 2019 at 1:09 AM John Lane <l...@jelmail.com> wrote: > > On 21/12/2019 16:51, John Lane wrote: > > > > > I can't do this: > > > > $ lxc config device set mycontainer eth0 ipv4.address 192.168.21.2/24 > > Error: Invalid devices: > > Invalid value for device option ipv4.address: Not an IPv4 address: > > 192.168.21.2/24 > > > > Also there appears to be no setting for gateway: > > > > $ lxc config device set mycontainer eth0 ipv4.gateway 192.168.21.1 > > Error: Invalid devices: Invalid device option: ipv4.gateway > > > > Reading this > (https://github.com/lxc/lxd/issues/1259#issuecomment-166416979):
On that same page: https://github.com/lxc/lxd/issues/1259#ref-pullrequest-136128816 > I guess that it doesn't work. If you use lxd-managed bridge (e.g. lxdbr0), you can configure it's built-in dhcp server (dnsmasq) to allways allocate fixed ip using something like this (in this example lxdbr0 is 10.0.3.1/24) devices: eth0: host_name: c1-0 ipv4.address: 10.0.3.221 name: eth0 nictype: bridged parent: lxdbr0 type: nic If it's not on lxd-managed bridged (e.g. physical interface), you can simply configure it inside the container (which you did already), or do something like this on container config: config: raw.lxc: |- lxc.net.0.ipv4.address=10.0.4.2/24 lxc.net.0.ipv4.gateway=10.0.4.1 ... and tell the container OS to leave it alone # cat /etc/network/interfaces auto eth0 iface eth0 inet manual > > I also tried using "lxc.raw" to work around it but could not get that to > work. I kept getting "Config parsing error: Initialize LXC: Failed to > load raw.lxc". Does raw.lxc not work any more? It works, but you used deprecated lxc config lines, which didn't work starting lxc 3.0 > I don't know if there is a page accessible on the main LXD site > documentation that explains this kind of thing which would be useful to > help transitioning from plain-old lxc. https://github.com/lxc/lxd/issues/4393#issuecomment-378181793 https://linuxcontainers.org/lxc/manpages//man5/lxc.container.conf.5.html https://discuss.linuxcontainers.org/t/lxc-3-0-0-has-been-released/1449 https://discuss.linuxcontainers.org/t/lxc-2-1-has-been-released/487 -- Fajar _______________________________________________ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users