[lxc-users] nat networking with fixed (dhcp ) IP addresses

Fajar A. Nugraha list at fajar.net
Fri May 25 01:58:30 UTC 2018


On Thu, May 24, 2018 at 11:56 PM, Michel Jansens
<michel.jansens at ulb.ac.be> wrote:
>
> Hi all,
>
> I’m running lxd 3.0.0 on Ubuntu 18.04 and I would like to use NAT/bridge
> networking for most containers, but with the possibility to fix the IP
> address myself (to ease some cluster config in Ansible).
>
> I’ve tried many things and read a lot around, but didn’t find anything that
> works.
>
> I tried "lxc config device set mycontainer eth0 ipv4.address 10.25.240.139”
> it returns: Error: The device doesn't exist  (source:
> https://blog.ubuntu.com/2017/02/14/network-management-with-lxd-2-3)
>
> The lxdbr0 bridged network is inherited by the container from the ‘default
> profile’ and lxdbr0 config is:


One way that works is to specify eth0 in the container config file,
overriding the profile.
While you're at it you might wan to set host_name as well, so that the
veth device name on the host side stays the same.

Example:
devices:
  eth0:
    host_name: c1-0
    ipv4.address: 10.0.3.203
    name: eth0
    nictype: bridged
    parent: lxdbr0
    type: nic

-- 
Fajar


More information about the lxc-users mailing list