lxc-containers: allow fixed hwaddr

This commit is contained in:
Astro 2016-11-29 00:18:54 +01:00
parent 04f28303ec
commit 0d99dc4d56
2 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,8 @@ containers:
type: veth type: veth
up1: up1:
type: phys type: phys
# Change (eg. auto-generation) requires reboot of the cable modem
hwaddr: 00:23:74:D7:2D:7C
upstream2: upstream2:
interfaces: interfaces:

View File

@ -14,7 +14,11 @@ lxc.kmsg = 0
{%- for net, conf in container['interfaces'].items() %} {%- for net, conf in container['interfaces'].items() %}
lxc.network.type={{ conf['type'] }} lxc.network.type={{ conf['type'] }}
lxc.network.flags=up lxc.network.flags=up
{%- if conf.get('hwaddr') %}
lxc.network.hwaddr={{ conf['hwaddr'] }}
{%- else %}
lxc.network.hwaddr={{ hwaddr_prefix }}:{{ n.__str__().rjust(2, '0') }} lxc.network.hwaddr={{ hwaddr_prefix }}:{{ n.__str__().rjust(2, '0') }}
{%- endif %}
{%- if conf['type'] == 'veth' %} {%- if conf['type'] == 'veth' %}
lxc.network.veth.pair={{ id }}-{{ net }} lxc.network.veth.pair={{ id }}-{{ net }}
{%- endif %} {%- endif %}