[lxc-users] How to set lxc.network.ipv4/hwaddr/ipv4.gateway=auto in LXD 2.6 managed container?

Mateusz Korniak mateusz-lists at ant.gliwice.pl
Fri Dec 2 12:32:57 UTC 2016


I am trying to move from LXC 1.1.x (macvlan) [1] containers to recent LXD [2].

I am stuck with problem:
- how can I set static ipv4/hwaddr and ipv4.gateway=auto?

I switched default profile to maclvan [3].
I created test container:

# lxc init ubuntu:16.04  ubuntu-1604-macvlan-test

Starting it confirms that macvlan iface works. Disbled DHCP configuration of 
eth0 at if2, and now setting IP# fails:

# lxc config device set ubuntu-1604-macvlan-test virt ipv4.address 10.30.3.205 
error: The device doesn't exist

It's confusing as virt device is visible in lxc config show [4], but not in 
lxc config device list ubuntu-1604-macvlan-test [5]?

TIA, regards,


[1]: Old LXC network config
lxc.network.type = macvlan
lxc.network.macvlan.mode = bridge
lxc.network.hwaddr = 00:16:3e:00:31:12                                                                                                                                                                                                                                 
lxc.network.ipv4 = 10.30.3.112/23                                                                                                                                                                                                                                      
lxc.network.ipv4.gateway = auto 

[2]: versions:
lxc-2.0.6
lxd-2.6


[3]: 
# lxc profile show default                                                                                                                                                                                                                              
name: default
config: {}
description: Default LXD profile
devices:
  virt:
    nictype: macvlan
    parent: eth0
    type: nic
usedby:
- /1.0/containers/ubuntu-1604-macvlan-test


[4]:
# lxc config show --expanded  ubuntu-1604-macvlan-test                                                                                                                                                                                                  
name: ubuntu-1604-macvlan-test
profiles:
- default
config:
  image.architecture: amd64
  image.description: ubuntu 16.04 LTS amd64 (release) (20161130)
  image.label: release
  image.os: ubuntu
  image.release: xenial
  image.serial: "20161130"
  image.version: "16.04"
  volatile.base_image: 
fc6d723a6e662a5a4fe213eae6b7f4c79ee7dd566c99856d96a5ca677a99b15d
  volatile.idmap.base: "0"
  volatile.idmap.next: 
'[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},
{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
  volatile.last_state.idmap: 
'[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},
{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
  volatile.last_state.power: STOPPED
  volatile.root.hwaddr: 00:16:3e:be:9b:1b
  volatile.root.name: eth1
  volatile.virt.hwaddr: 00:16:3e:e3:22:75
  volatile.virt.name: eth0
devices:
  root:
    path: /
    type: disk
  virt:
    nictype: macvlan
    parent: eth0
    type: nic
ephemeral: false


[5]:
# lxc config device list ubuntu-1604-macvlan-test                                                                                                                                                                                                       
root: disk


-- 
Mateusz Korniak
"(...) mam brata - poważny, domator, liczykrupa, hipokryta, pobożniś,
 	krótko mówiąc - podpora społeczeństwa."
				Nikos Kazantzakis - "Grek Zorba"



More information about the lxc-users mailing list