Added to ability to set mtu for lxcbr0

The lxc_host role overrides the configuration
done by the system administrator on the host.

If mtu was defined in /etc/lxc/ and in the
system network interfaces, then these configurations
will be overriden.

This commit should allow the deployer to set the
mtu for its lxcbr0 network, by setting the variable
lxc_net_mtu.

Fixes-Bug: #1518303

Change-Id: I42ab3d0a2c20ae94335de195cdb14579d9f59f5f
This commit is contained in:
Jean-Philippe Evrard 2015-12-02 17:13:24 +01:00
parent 2186669e0d
commit 513244b56b
3 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@ lxc_net_bridge_port: none
lxc_net_address: 10.0.3.1 lxc_net_address: 10.0.3.1
lxc_net_netmask: 255.255.255.0 lxc_net_netmask: 255.255.255.0
lxc_net_gateway: none ## if "none" no gateway will on the LXC bridge, nat must be "false" to use a gateway. lxc_net_gateway: none ## if "none" no gateway will on the LXC bridge, nat must be "false" to use a gateway.
#lxc_net_mtu: 1500 ##setting this variable will add mtu configuration for the lxc config and network bridge
# lxc container nat enabled # lxc container nat enabled
lxc_net_nat: true ## If "true" nat rules will be created with the lxc network. lxc_net_nat: true ## If "true" nat rules will be created with the lxc network.

View File

@ -7,6 +7,9 @@ iface {{ lxc_net_bridge }} inet static
{% if lxc_net_nat == "true" %} {% if lxc_net_nat == "true" %}
{% if lxc_net_gateway != "none" %} {% if lxc_net_gateway != "none" %}
gateway {{ lxc_net_gateway }} gateway {{ lxc_net_gateway }}
{% endif %}
{% if lxc_net_mtu is defined %}
mtu {{ lxc_net_mtu }}
{% endif %} {% endif %}
# nat rules start and stop # nat rules start and stop
post-up /usr/local/bin/lxc-system-manage iptables-create post-up /usr/local/bin/lxc-system-manage iptables-create

View File

@ -10,4 +10,7 @@ lxc.network.type = {{ lxc_container_net_type }}
lxc.network.name = {{ lxc_container_net_name }} lxc.network.name = {{ lxc_container_net_name }}
lxc.network.link = {{ lxc_container_net_link }} lxc.network.link = {{ lxc_container_net_link }}
lxc.network.flags = up lxc.network.flags = up
{% if lxc_net_mtu is defined %}
lxc.network.mtu = {{ lxc_net_mtu }}
{% endif %}
lxc.network.hwaddr = 00:16:3e:xx:xx:xx lxc.network.hwaddr = 00:16:3e:xx:xx:xx