- `lxc.mount.entry`
LXC namespaces configuration keys by using single dots. This means complex
-configuration keys such as `lxc.network` expose various subkeys such as
-`lxc.network.type`, `lxc.network.link`, `lxc.network.ipv6`, and others for even
+configuration keys such as `lxc.net.0` expose various subkeys such as
+`lxc.net.0.type`, `lxc.net.0.link`, `lxc.net.0.ipv6`, and others for even
more fine-grained configuration.
LXC is used as the default runtime for [LXD](https://github.com/lxc/lxd),
-lxc.network.type = veth
-lxc.network.link = virbr0
-lxc.network.flags = up
+lxc.net.0.type = veth
+lxc.net.0.link = virbr0
+lxc.net.0.flags = up
-lxc.network.type = empty
+lxc.net.0.type = empty
local BRNAME try flags br
[ -f "$sysconfdir"/lxc/default.conf ] || { return 0; }
- BRNAME=`grep '^[ ]*lxc.network.link' "$sysconfdir"/lxc/default.conf | sed 's/^.*=[ ]*//'`
+ BRNAME=`grep '^[ ]*lxc.net.0.link' "$sysconfdir"/lxc/default.conf | sed 's/^.*=[ ]*//'`
if [ -z "$BRNAME" ]; then
return 0
fi
# Container with network a complex network mixing macvlan, veth and
# physical network devices
lxc.utsname = complex
-lxc.network.type = veth
-lxc.network.flags = up
-lxc.network.link = br0
-lxc.network.hwaddr = 4a:49:43:49:79:bf
-lxc.network.ipv4 = 10.2.3.5/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+lxc.net.0.type = veth
+lxc.net.0.flags = up
+lxc.net.0.link = br0
+lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+lxc.net.0.ipv4 = 10.2.3.5/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
-lxc.network.type = macvlan
-lxc.network.flags = up
-lxc.network.link = eth0
-lxc.network.hwaddr = 4a:49:43:49:79:bd
-lxc.network.ipv4 = 10.2.3.4/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+lxc.net.0.type = macvlan
+lxc.net.0.flags = up
+lxc.net.0.link = eth0
+lxc.net.0.hwaddr = 4a:49:43:49:79:bd
+lxc.net.0.ipv4 = 10.2.3.4/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
-lxc.network.type = phys
-lxc.network.flags = up
-lxc.network.link = dummy0
-lxc.network.hwaddr = 4a:49:43:49:79:ff
-lxc.network.ipv4 = 10.2.3.6/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
+lxc.net.0.type = phys
+lxc.net.0.flags = up
+lxc.net.0.link = dummy0
+lxc.net.0.hwaddr = 4a:49:43:49:79:ff
+lxc.net.0.ipv4 = 10.2.3.6/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
# Container with new network withtout network devices
lxc.utsname = omega
-lxc.network.type = empty
-lxc.network.flags = up
+lxc.net.0.type = empty
+lxc.net.0.flags = up
# Container with network virtualized using the macvlan device driver
lxc.utsname = alpha
-lxc.network.type = macvlan
-lxc.network.flags = up
-lxc.network.link = eth0
-lxc.network.hwaddr = 4a:49:43:49:79:bd
-lxc.network.ipv4 = 10.2.3.4/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+lxc.net.0.type = macvlan
+lxc.net.0.flags = up
+lxc.net.0.link = eth0
+lxc.net.0.hwaddr = 4a:49:43:49:79:bd
+lxc.net.0.ipv4 = 10.2.3.4/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
# Container with non-virtualized network
-lxc.network.type = none
+lxc.net.0.type = none
lxc.utsname = delta
# Container with network virtualized using a physical network device with name
# 'eth0'
lxc.utsname = gamma
-lxc.network.type = phys
-lxc.network.flags = up
-lxc.network.link = eth0
-lxc.network.hwaddr = 4a:49:43:49:79:ff
-lxc.network.ipv4 = 10.2.3.6/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
+lxc.net.0.type = phys
+lxc.net.0.flags = up
+lxc.net.0.link = eth0
+lxc.net.0.hwaddr = 4a:49:43:49:79:ff
+lxc.net.0.ipv4 = 10.2.3.6/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
# Container with network virtualized using a pre-configured bridge named br0 and
# veth pair virtual network devices
lxc.utsname = beta
-lxc.network.type = veth
-lxc.network.flags = up
-lxc.network.link = br0
-lxc.network.hwaddr = 4a:49:43:49:79:bf
-lxc.network.ipv4 = 10.2.3.5/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+lxc.net.0.type = veth
+lxc.net.0.flags = up
+lxc.net.0.link = br0
+lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+lxc.net.0.ipv4 = 10.2.3.5/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
# Container with network virtualized using the vlan device driver
lxc.utsname = alpha
-lxc.network.type = vlan
-lxc.network.vlan.id = 1234
-lxc.network.flags = up
-lxc.network.link = eth0
-lxc.network.hwaddr = 4a:49:43:49:79:bd
-lxc.network.ipv4 = 10.2.3.4/24
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+lxc.net.0.type = vlan
+lxc.net.0.vlan.id = 1234
+lxc.net.0.flags = up
+lxc.net.0.link = eth0
+lxc.net.0.hwaddr = 4a:49:43:49:79:bd
+lxc.net.0.ipv4 = 10.2.3.4/24
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
</varlistentry>
<varlistentry>
- <term>lxc-info -n foo -c lxc.network.0.veth.pair</term>
+ <term>lxc-info -n foo -c lxc.net.0.veth.pair</term>
<listitem>
<para>
<!--
<para>
<!--
LXC namespaces configuration keys by using single dots. This means complex
- configuration keys such as <option>lxc.network</option> expose various
- subkeys such as <option>lxc.network.type</option>,
- <option>lxc.network.link</option>, <option>lxc.network.ipv6</option>, and
+ configuration keys such as <option>lxc.net.0</option> expose various
+ subkeys such as <option>lxc.net.0.type</option>,
+ <option>lxc.net.0.link</option>, <option>lxc.net.0.ipv6</option>, and
others for even more fine-grained configuration.
-->
- LXC は、シングルドットを使って設定キーの名前空間を表します。<option>lxc.network</option> のような複雑な設定キーは、<option>lxc.network.type</option>、<option>lxc.network.link</option>、<option>lxc.network.ipv6</option> や、さらに細分化された設定向けの色々なサブキーを持つことを意味します。
+ LXC は、シングルドットを使って設定キーの名前空間を表します。<option>lxc.net.0</option> のような複雑な設定キーは、<option>lxc.net.0.type</option>、<option>lxc.net.0.link</option>、<option>lxc.net.0.ipv6</option> や、さらに細分化された設定向けの色々なサブキーを持つことを意味します。
</para>
<refsect2>
<variablelist>
<varlistentry>
<term>
- <option>lxc.network</option>
+ <option>lxc.net</option>
</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.[i].type</option>
+ <option>lxc.net.[i].type</option>
</term>
<listitem>
<para>
for the container.
Multiple networks can be specified by using an additional index
<option>i</option>
- after all <option>lxc.network.*</option> keys. For example,
- <option>lxc.network.0.type = veth</option> and
- <option>lxc.network.1.type = veth</option> specify two different
+ after all <option>lxc.net.*</option> keys. For example,
+ <option>lxc.net.0.type = veth</option> and
+ <option>lxc.net.1.type = veth</option> specify two different
networks of the same type. All keys sharing the same index
<option>i</option> will be treated as belonging to the same
- network. For example, <option>lxc.network.0.link = br0</option>
- will belong to <option>lxc.network.0.type</option>.
+ network. For example, <option>lxc.net.0.link = br0</option>
+ will belong to <option>lxc.net.0.type</option>.
Currently, the different virtualization types can be:
-->
- コンテナがどの種類のネットワーク仮想化を使うかを指定します。すべての <option>lxc.network.*</option> キーに、追加のインデックス <option>i</option> を使うと、複数のネットワークを指定できます。例えば、<option>lxc.network.0.type = veth</option> と <option>lxc.network.1.type = veth</option> は、同じタイプの異なるネットワークを 2 つ指定します。
- 同じインデックスを指定したキーはすべて同じネットワークの指定になります。例えば、<option>lxc.network.0.link = br0</option> は <option>lxc.network.0.type</option> と同じネットワークの設定になります。
+ コンテナがどの種類のネットワーク仮想化を使うかを指定します。すべての <option>lxc.net.*</option> キーに、追加のインデックス <option>i</option> を使うと、複数のネットワークを指定できます。例えば、<option>lxc.net.0.type = veth</option> と <option>lxc.net.1.type = veth</option> は、同じタイプの異なるネットワークを 2 つ指定します。
+ 同じインデックスを指定したキーはすべて同じネットワークの指定になります。例えば、<option>lxc.net.0.link = br0</option> は <option>lxc.net.0.type</option> と同じネットワークの設定になります。
現時点では、以下のネットワーク仮想化のタイプが使えます:
</para>
<option>veth:</option> a virtual ethernet pair
device is created with one side assigned to the container
and the other side attached to a bridge specified by
- the <option>lxc.network.link</option> option.
+ the <option>lxc.net.[i].link</option> option.
If the bridge is not specified, then the veth pair device
will be created but not attached to any bridge.
Otherwise, the bridge has to be created on the system
container, but if you wish to handle
this name yourselves, you can tell <command>lxc</command>
to set a specific name with
- the <option>lxc.network.veth.pair</option> option (except for
+ the <option>lxc.net.[i].veth.pair</option> option (except for
unprivileged containers where this option is ignored for security
reasons).
-->
- <option>veth:</option > 一方がコンテナに、もう一方が <option>lxc.network.link</option> オプションで指定されたブリッジに接続されるペアの仮想イーサネットデバイスを作成します。
+ <option>veth:</option > 一方がコンテナに、もう一方が <option>lxc.net.[i].link</option> オプションで指定されたブリッジに接続されるペアの仮想イーサネットデバイスを作成します。
もし、ブリッジが指定されていない場合、veth ペアデバイスは作成されますが、ブリッジには接続されません。
ブリッジはコンテナが開始する前にシステムで事前に設定しておく必要があります。
<command>lxc</command> はコンテナ外の設定を扱うことはありません。
デフォルトでは、<command>lxc</command> がコンテナの外部に属するネットワークデバイスに対する名前を決定します。
- しかし、もしこの名前を自分で指定したい場合、<option>lxc.network.veth.pair</option> オプションを使って名前を設定し、lxc に対して指定をすることができます (非特権コンテナの場合をのぞきます。セキュリティ上の理由からこのオプションは無視されます)。
+ しかし、もしこの名前を自分で指定したい場合、<option>lxc.net.[i].veth.pair</option> オプションを使って名前を設定し、lxc に対して指定をすることができます (非特権コンテナの場合をのぞきます。セキュリティ上の理由からこのオプションは無視されます)。
</para>
<para>
<!--
<option>vlan:</option> a vlan interface is linked with
the interface specified by
- the <option>lxc.network.link</option> and assigned to
+ the <option>lxc.net.[i].link</option> and assigned to
the container. The vlan identifier is specified with the
- option <option>lxc.network.vlan.id</option>.
+ option <option>lxc.net.[i].vlan.id</option>.
-->
- <option>vlan:</option> vlan インターフェースは <option>lxc.network.link</option> で指定されたインターフェースとリンクし、コンテナに割り当てられます。
- vlan の指定は <option>lxc.network.vlan.id</option> オプションで指定します。
+ <option>vlan:</option> vlan インターフェースは <option>lxc.net.[i].link</option> で指定されたインターフェースとリンクし、コンテナに割り当てられます。
+ vlan の指定は <option>lxc.net.[i].vlan.id</option> オプションで指定します。
</para>
<para>
<!--
<option>macvlan:</option> a macvlan interface is linked
with the interface specified by
- the <option>lxc.network.link</option> and assigned to
+ the <option>lxc.net.[i].link</option> and assigned to
the container.
- <option>lxc.network.macvlan.mode</option> specifies the
+ <option>lxc.net.[i].macvlan.mode</option> specifies the
mode the macvlan will use to communicate between
different macvlan on the same upper device. The accepted
modes are <option>private</option>, <option>vepa</option>,
interface. Only one macvlan interface in <option>passthru</option>
mode is possible for one physical interface.
-->
- <option>macvlan:</option> macvlan インターフェースは <option>lxc.network.link</option> により指定されるインターフェースとリンクし、コンテナに割り当てられます。
- <option>lxc.network.macvlan.mode</option> でモードを指定すると、その macvlan の指定を、同じ上位デバイスで異なる macvlan の間の通信をする時に使います。
+ <option>macvlan:</option> macvlan インターフェースは <option>lxc.net.[i].link</option> により指定されるインターフェースとリンクし、コンテナに割り当てられます。
+ <option>lxc.net.[i].macvlan.mode</option> でモードを指定すると、その macvlan の指定を、同じ上位デバイスで異なる macvlan の間の通信をする時に使います。
指定できるモードは <option>private</option>、<option>vepa</option>、<option>bridge</option>、<option>passthru</option> のいずれかです。
<option>private</option> モードの場合、デバイスは同じ上位デバイスの他のデバイスとの通信を行いません (デフォルト)。
新しい仮想イーサネットポート集約モード (Virtual Ethernet Port Aggregator (VEPA)) である <option>vepa</option> モードの場合、隣接したポートが、ソースとデスティネーションの両方が macvlan ポートに対してローカルであるフレームを全て返すと仮定します。
<para>
<!--
<option>phys:</option> an already existing interface
- specified by the <option>lxc.network.link</option> is
+ specified by the <option>lxc.net.[i].link</option> is
assigned to the container.
-->
- <option>phys:</option> <option>lxc.network.link</option> で指定された、すでに存在しているインターフェースがコンテナに割り当てられます。
+ <option>phys:</option> <option>lxc.net.[i].link</option> で指定された、すでに存在しているインターフェースがコンテナに割り当てられます。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.[i].flags</option>
+ <option>lxc.net.[i].flags</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].link</option>
+ <option>lxc.net.[i].link</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].mtu</option>
+ <option>lxc.net.[i].mtu</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].name</option>
+ <option>lxc.net.[i].name</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].hwaddr</option>
+ <option>lxc.net.[i].hwaddr</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv4</option>
+ <option>lxc.net.[i].ipv4</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv4.gateway</option>
+ <option>lxc.net.[i].ipv4.gateway</option>
</term>
<listitem>
<para>
Can also have the special value <option>auto</option>,
which means to take the primary address from the bridge
interface (as specified by the
- <option>lxc.network.link</option> option) and use that as
+ <option>lxc.net.[i].link</option> option) and use that as
the gateway. <option>auto</option> is only available when
using the <option>veth</option> and
<option>macvlan</option> network types.
-->
コンテナでゲートウェイとして使う IPv4 アドレスを指定します。アドレスは x.y.z.t というフォーマットです。例) 192.168.1.123
- <option>auto</option> という特別な値を指定できます。これは (<option>lxc.network.link</option> で指定した) ブリッジインターフェースの最初のアドレスを使用し、それをゲートウェイに使うという意味になります。<option>auto</option> はネットワークタイプとして <option>veth</option> と <option>macvlan</option> を指定している時だけ有効となります。
+ <option>auto</option> という特別な値を指定できます。これは (<option>lxc.net.[i].link</option> で指定した) ブリッジインターフェースの最初のアドレスを使用し、それをゲートウェイに使うという意味になります。<option>auto</option> はネットワークタイプとして <option>veth</option> と <option>macvlan</option> を指定している時だけ有効となります。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv6</option>
+ <option>lxc.net.[i].ipv6</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv6.gateway</option>
+ <option>lxc.net.[i].ipv6.gateway</option>
</term>
<listitem>
<para>
Can also have the special value <option>auto</option>,
which means to take the primary address from the bridge
interface (as specified by the
- <option>lxc.network.link</option> option) and use that as
+ <option>lxc.net.[i].link</option> option) and use that as
the gateway. <option>auto</option> is only available when
using the <option>veth</option> and
<option>macvlan</option> network types.
-->
コンテナでゲートウェイとして使う IPv6 アドレスを指定します。アドレスは x::y というフォーマットです。例) 2003:db8:1:0::1
- <option>auto</option> という特別な値を記述する事も可能です。これは (<option>lxc.network.link</option> で指定した) ブリッジインターフェースの最初のアドレスを使用し、それをゲートウェイに使うという意味になります。<option>auto</option> はネットワークタイプとして <option>veth</option> と <option>macvlan</option> を指定している時だけ有効となります。
+ <option>auto</option> という特別な値を記述する事も可能です。これは (<option>lxc.net.[i].link</option> で指定した) ブリッジインターフェースの最初のアドレスを使用し、それをゲートウェイに使うという意味になります。<option>auto</option> はネットワークタイプとして <option>veth</option> と <option>macvlan</option> を指定している時だけ有効となります。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.[i].script.up</option>
+ <option>lxc.net.[i].script.up</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].script.down</option>
+ <option>lxc.net.[i].script.down</option>
</term>
<listitem>
<para>
</para>
<programlisting>
lxc.utsname = myhostname
- lxc.network.type = veth
- lxc.network.flags = up
- lxc.network.link = br0
- lxc.network.name = eth0
- lxc.network.hwaddr = 4a:49:43:49:79:bf
- lxc.network.ipv4 = 1.2.3.5/24 1.2.3.255
- lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+ lxc.net.0.type = veth
+ lxc.net.0.flags = up
+ lxc.net.0.link = br0
+ lxc.net.0.name = eth0
+ lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+ lxc.net.0.ipv4 = 1.2.3.5/24 1.2.3.255
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
</programlisting>
</refsect2>
</para>
<programlisting>
lxc.utsname = complex
- lxc.network.0.type = veth
- lxc.network.0.flags = up
- lxc.network.0.link = br0
- lxc.network.0.hwaddr = 4a:49:43:49:79:bf
- lxc.network.0.ipv4 = 10.2.3.5/24 10.2.3.255
- lxc.network.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
- lxc.network.0.ipv6 = 2003:db8:1:0:214:5432:feab:3588
- lxc.network.1.type = macvlan
- lxc.network.1.flags = up
- lxc.network.1.link = eth0
- lxc.network.1.hwaddr = 4a:49:43:49:79:bd
- lxc.network.1.ipv4 = 10.2.3.4/24
- lxc.network.1.ipv4 = 192.168.10.125/24
- lxc.network.1.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
- lxc.network.2.type = phys
- lxc.network.2.flags = up
- lxc.network.2.link = dummy0
- lxc.network.2.hwaddr = 4a:49:43:49:79:ff
- lxc.network.2.ipv4 = 10.2.3.6/24
- lxc.network.2.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
+ lxc.net.0.type = veth
+ lxc.net.0.flags = up
+ lxc.net.0.link = br0
+ lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+ lxc.net.0.ipv4 = 10.2.3.5/24 10.2.3.255
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:5432:feab:3588
+ lxc.net.1.type = macvlan
+ lxc.net.1.flags = up
+ lxc.net.1.link = eth0
+ lxc.net.1.hwaddr = 4a:49:43:49:79:bd
+ lxc.net.1.ipv4 = 10.2.3.4/24
+ lxc.net.1.ipv4 = 192.168.10.125/24
+ lxc.net.1.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+ lxc.net.2.type = phys
+ lxc.net.2.flags = up
+ lxc.net.2.link = dummy0
+ lxc.net.2.hwaddr = 4a:49:43:49:79:ff
+ lxc.net.2.ipv4 = 10.2.3.6/24
+ lxc.net.2.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.deny = a
</varlistentry>
<varlistentry>
- <term>lxc-info -n foo -c lxc.network.0.veth.pair</term>
+ <term>lxc-info -n foo -c lxc.net.0.veth.pair</term>
<listitem>
<para>
<!--
<variablelist>
<varlistentry>
<term>
- <option>lxc.network</option>
+ <option>lxc.net</option>
</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.type</option>
+ <option>lxc.net.[i].type</option>
</term>
<listitem>
<para>
<!--
specify what kind of network virtualization to be used
for the container. Each time
- a <option>lxc.network.type</option> field is found a new
+ a <option>lxc.net.[i].type</option> field is found a new
round of network configuration begins. In this way,
several network virtualization types can be specified
for the same container, as well as assigning several
virtualization types can be:
-->
컨테이너가 어떤 종류의 네트워크 가상화를 사용할지 지정한다.
- <option>lxc.network.type</option> 필드부터 새로운 네트워크 설정이 시작된다. 이 방법으로 여러개의 네트워크 가상화 형태를 같은 컨테이너에 지정할 수 있다. 그리고 여러개의 네트워크 인터페이스를 하나의 컨테이너에 지정할 수도 있다.
+ <option>lxc.net.[i].type</option> 필드부터 새로운 네트워크 설정이 시작된다. 이 방법으로 여러개의 네트워크 가상화 형태를 같은 컨테이너에 지정할 수 있다. 그리고 여러개의 네트워크 인터페이스를 하나의 컨테이너에 지정할 수도 있다.
지정 가능한 형태는 아래와 같다.
</para>
<option>veth:</option> a virtual ethernet pair
device is created with one side assigned to the container
and the other side attached to a bridge specified by
- the <option>lxc.network.link</option> option.
+ the <option>lxc.net.[i].link</option> option.
If the bridge is not specified, then the veth pair device
will be created but not attached to any bridge.
Otherwise, the bridge has to be created on the system
container, but if you wish to handle
this name yourselves, you can tell <command>lxc</command>
to set a specific name with
- the <option>lxc.network.veth.pair</option> option (except for
+ the <option>lxc.net.[i].veth.pair</option> option (except for
unprivileged containers where this option is ignored for security
reasons).
-->
- <option>veth:</option> 한 쪽은 컨테이너로, 다른 한쪽은 <option>lxc.network.link</option> 옵션으로 지정한 브리지로 붙은 가상 이더넷(veth) 장치 쌍을 생성한다.
+ <option>veth:</option> 한 쪽은 컨테이너로, 다른 한쪽은 <option>lxc.net.[i].link</option> 옵션으로 지정한 브리지로 붙은 가상 이더넷(veth) 장치 쌍을 생성한다.
만약 브리지가 지정되지 않았다면, 어떤 브리지에도 붙지 않은 veth 장치 쌍을 만든다. 브리지는 컨테이너 시작전에 시스템에서 생성해야 한다.
- <command>lxc</command>는 컨테이너 이외의 설정에 대해서는 다루지 않는다. 기본값으로 <command>lxc</command>는 컨테이너 바깥에 속할 네트워크 디바이스의 이름을 정해준다. 이름을 변경하기 원한다면, <command>lxc</command>가 지정한 이름으로 설정하도록 <option>lxc.network.veth.pair</option> 옵션을 사용하여야 한다. (비특권 컨테이너는 불가능하다. 이 옵션은 보안상의 이유로 무시될 것이다)
+ <command>lxc</command>는 컨테이너 이외의 설정에 대해서는 다루지 않는다. 기본값으로 <command>lxc</command>는 컨테이너 바깥에 속할 네트워크 디바이스의 이름을 정해준다. 이름을 변경하기 원한다면, <command>lxc</command>가 지정한 이름으로 설정하도록 <option>lxc.net.[i].veth.pair</option> 옵션을 사용하여야 한다. (비특권 컨테이너는 불가능하다. 이 옵션은 보안상의 이유로 무시될 것이다)
</para>
<para>
<!--
<option>vlan:</option> a vlan interface is linked with
the interface specified by
- the <option>lxc.network.link</option> and assigned to
+ the <option>lxc.net.[i].link</option> and assigned to
the container. The vlan identifier is specified with the
- option <option>lxc.network.vlan.id</option>.
+ option <option>lxc.net.[i].vlan.id</option>.
-->
- <option>vlan:</option> vlan 인터페이스는 <option>lxc.network.link</option>로 지정한 인터페이스에 연결되고, 컨테이너로 할당된다. vlan의 식별자는 <option>lxc.network.vlan.id</option> 옵션으로 지정한다.
+ <option>vlan:</option> vlan 인터페이스는 <option>lxc.net.[i].link</option>로 지정한 인터페이스에 연결되고, 컨테이너로 할당된다. vlan의 식별자는 <option>lxc.net.[i].vlan.id</option> 옵션으로 지정한다.
</para>
<para>
<!--
<option>macvlan:</option> a macvlan interface is linked
with the interface specified by
- the <option>lxc.network.link</option> and assigned to
+ the <option>lxc.net.[i].link</option> and assigned to
the container.
- <option>lxc.network.macvlan.mode</option> specifies the
+ <option>lxc.net.[i].macvlan.mode</option> specifies the
mode the macvlan will use to communicate between
different macvlan on the same upper device. The accepted
modes are <option>private</option>, <option>vepa</option>,
interface. Only one macvlan interface in <option>passthru</option>
mode is possible for one physical interface.
-->
- <option>macvlan:</option> macvlan 인터페이스는 <option>lxc.network.link</option>로 지정한 인터페이스에 연결되고, 컨테이너로 할당된다.
- <option>lxc.network.macvlan.mode</option>은 같은 상위 디바이스에 있는 다른 macvlan과 통신할 때 사용하는 모드를 지정한다.
+ <option>macvlan:</option> macvlan 인터페이스는 <option>lxc.net.[i].link</option>로 지정한 인터페이스에 연결되고, 컨테이너로 할당된다.
+ <option>lxc.net.[i].macvlan.mode</option>은 같은 상위 디바이스에 있는 다른 macvlan과 통신할 때 사용하는 모드를 지정한다.
지정할 수 있는 모드는 <option>private</option>、<option>vepa</option>、<option>bridge</option>、<option>passthru</option>이다.
<option>private</option>모드는 디바이스가 같은 상위디바이스의 어떤 장치와도 통신하지 않는다. (기본값)
새로운 가상 이더넷 포트 통합모드(Virtual Ethernet Port Aggregator), 즉 <option>vepa</option> 모드는 인접한 브리지가 소스와 목적지가 로컬인 모든 프레임들을 macvlan 포트로 반환한다고 가정한다. 즉, 브리지가 reflective relay로 설정되어 있다는 것이다.
<para>
<!--
<option>phys:</option> an already existing interface
- specified by the <option>lxc.network.link</option> is
+ specified by the <option>lxc.net.[i].link</option> is
assigned to the container.
-->
- <option>phys:</option> <option>lxc.network.link</option>로 지정한 이미 존재하는 인터페이스를 컨테이너로 할당된다.
+ <option>phys:</option> <option>lxc.net.[i].link</option>로 지정한 이미 존재하는 인터페이스를 컨테이너로 할당된다.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.flags</option>
+ <option>lxc.net.[i].flags</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.link</option>
+ <option>lxc.net.[i].link</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.mtu</option>
+ <option>lxc.net.[i].mtu</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.name</option>
+ <option>lxc.net.[i].name</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.hwaddr</option>
+ <option>lxc.net.[i].hwaddr</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.ipv4</option>
+ <option>lxc.net.[i].ipv4</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.ipv4.gateway</option>
+ <option>lxc.net.[i].ipv4.gateway</option>
</term>
<listitem>
<para>
Can also have the special value <option>auto</option>,
which means to take the primary address from the bridge
interface (as specified by the
- <option>lxc.network.link</option> option) and use that as
+ <option>lxc.net.[i].link</option> option) and use that as
the gateway. <option>auto</option> is only available when
using the <option>veth</option> and
<option>macvlan</option> network types.
주소 형식은 x.y.z.t로, 예를 들면 192.168.1.123이다.
<option>auto</option>라는 특별한 값을 지정할 수있다.
- 이것은 (<option>lxc.network.link</option> 에서 지정된) 브리지 인터페이스의 첫번째 주소를 가져와 게이트 주소로 사용한다.
+ 이것은 (<option>lxc.net.[i].link</option> 에서 지정된) 브리지 인터페이스의 첫번째 주소를 가져와 게이트 주소로 사용한다.
<option>auto</option>는 네트워크 형태가 <option>veth</option>나 <option>macvlan</option>일 때만 지정 가능하다.
</para>
</listitem>
<varlistentry>
<term>
- <option>lxc.network.ipv6</option>
+ <option>lxc.net.[i].ipv6</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.ipv6.gateway</option>
+ <option>lxc.net.[i].ipv6.gateway</option>
</term>
<listitem>
<para>
Can also have the special value <option>auto</option>,
which means to take the primary address from the bridge
interface (as specified by the
- <option>lxc.network.link</option> option) and use that as
+ <option>lxc.net.[i].link</option> option) and use that as
the gateway. <option>auto</option> is only available when
using the <option>veth</option> and
<option>macvlan</option> network types.
주소 형식은 x::y로, 예를 들면 2003:db8:1:0::1이다.
<option>auto</option>라는 특별한 값을 지정할 수있다.
- 이것은 (<option>lxc.network.link</option> 에서 지정된) 브리지 인터페이스의 첫번째 주소를 가져와 게이트 주소로 사용한다.
+ 이것은 (<option>lxc.net.[i].link</option> 에서 지정된) 브리지 인터페이스의 첫번째 주소를 가져와 게이트 주소로 사용한다.
<option>auto</option>는 네트워크 형태가 <option>veth</option>나 <option>macvlan</option>일 때만 지정 가능하다.
</para>
</listitem>
<varlistentry>
<term>
- <option>lxc.network.script.up</option>
+ <option>lxc.net.[i].script.up</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.script.down</option>
+ <option>lxc.net.[i].script.down</option>
</term>
<listitem>
<para>
</para>
<programlisting>
lxc.utsname = myhostname
- lxc.network.type = veth
- lxc.network.flags = up
- lxc.network.link = br0
- lxc.network.name = eth0
- lxc.network.hwaddr = 4a:49:43:49:79:bf
- lxc.network.ipv4 = 1.2.3.5/24 1.2.3.255
- lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+ lxc.net.0.type = veth
+ lxc.net.0.flags = up
+ lxc.net.0.link = br0
+ lxc.net.0.name = eth0
+ lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+ lxc.net.0.ipv4 = 1.2.3.5/24 1.2.3.255
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
</programlisting>
</refsect2>
</para>
<programlisting>
lxc.utsname = complex
- lxc.network.type = veth
- lxc.network.flags = up
- lxc.network.link = br0
- lxc.network.hwaddr = 4a:49:43:49:79:bf
- lxc.network.ipv4 = 10.2.3.5/24 10.2.3.255
- lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
- lxc.network.ipv6 = 2003:db8:1:0:214:5432:feab:3588
- lxc.network.type = macvlan
- lxc.network.flags = up
- lxc.network.link = eth0
- lxc.network.hwaddr = 4a:49:43:49:79:bd
- lxc.network.ipv4 = 10.2.3.4/24
- lxc.network.ipv4 = 192.168.10.125/24
- lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
- lxc.network.type = phys
- lxc.network.flags = up
- lxc.network.link = dummy0
- lxc.network.hwaddr = 4a:49:43:49:79:ff
- lxc.network.ipv4 = 10.2.3.6/24
- lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
+ lxc.net.0.type = veth
+ lxc.net.0.flags = up
+ lxc.net.0.link = br0
+ lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+ lxc.net.0.ipv4 = 10.2.3.5/24 10.2.3.255
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:5432:feab:3588
+ lxc.net.1.type = macvlan
+ lxc.net.1.flags = up
+ lxc.net.1.link = eth0
+ lxc.net.1.hwaddr = 4a:49:43:49:79:bd
+ lxc.net.1.ipv4 = 10.2.3.4/24
+ lxc.net.1.ipv4 = 192.168.10.125/24
+ lxc.net.1.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+ lxc.net.2.type = phys
+ lxc.net.2.flags = up
+ lxc.net.2.link = dummy0
+ lxc.net.2.hwaddr = 4a:49:43:49:79:ff
+ lxc.net.2.ipv4 = 10.2.3.6/24
+ lxc.net.2.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.deny = a
</varlistentry>
<varlistentry>
- <term>lxc-info -n foo -c lxc.network.0.veth.pair</term>
+ <term>lxc-info -n foo -c lxc.net.0.veth.pair</term>
<listitem>
<para>
prints the veth pair name of foo.
# should be an existing interface, usually it is eth0
# * phys : the network will use a physical network device, the specified
# link should be an existing interface
-lxc.network.type = macvlan
+lxc.net.0.type = macvlan
# specify the flags to be used for the network, actually only <up> is allowed
# which mean the network should be set up when created. If the network is set
# up, the loopback is automatically set up too.
-lxc.network.flags = up
+lxc.net.0.flags = up
# specify the physical network device which will communicate with the
# outside world
-lxc.network.link = eth0
+lxc.net.0.link = eth0
# NIC ethernet mac address
-lxc.network.hwaddr = 4a:49:43:49:79:bd
+lxc.net.0.hwaddr = 4a:49:43:49:79:bd
# specify the ipv4 address of the container. Several lines are allowed and
# will mean several addresses will be assigned to the interface
-lxc.network.ipv4 = 1.2.3.5/24
+lxc.net.0.ipv4 = 1.2.3.5/24
# specify the ipv6 address of the container. Several lines are allowed and
# will mean several addresses will be assigned to the interface
-lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
<para>
LXC namespaces configuration keys by using single dots. This means complex
- configuration keys such as <option>lxc.network</option> expose various
- subkeys such as <option>lxc.network.type</option>,
- <option>lxc.network.link</option>, <option>lxc.network.ipv6</option>, and
+ configuration keys such as <option>lxc.net.0</option> expose various
+ subkeys such as <option>lxc.net.0.type</option>,
+ <option>lxc.net.0.link</option>, <option>lxc.net.0.ipv6</option>, and
others for even more fine-grained configuration.
</para>
<variablelist>
<varlistentry>
<term>
- <option>lxc.network</option>
+ <option>lxc.net</option>
</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
<term>
- <option>lxc.network.[i].type</option>
+ <option>lxc.net.[i].type</option>
</term>
<listitem>
<para>
for the container.
Multiple networks can be specified by using an additional index
<option>i</option>
- after all <option>lxc.network.*</option> keys. For example,
- <option>lxc.network.0.type = veth</option> and
- <option>lxc.network.1.type = veth</option> specify two different
+ after all <option>lxc.net.*</option> keys. For example,
+ <option>lxc.net.0.type = veth</option> and
+ <option>lxc.net.1.type = veth</option> specify two different
networks of the same type. All keys sharing the same index
<option>i</option> will be treated as belonging to the same
- network. For example, <option>lxc.network.0.link = br0</option>
- will belong to <option>lxc.network.0.type</option>.
+ network. For example, <option>lxc.net.0.link = br0</option>
+ will belong to <option>lxc.net.0.type</option>.
Currently, the different virtualization types can be:
</para>
<option>veth:</option> a virtual ethernet pair
device is created with one side assigned to the container
and the other side attached to a bridge specified by
- the <option>lxc.network.link</option> option.
+ the <option>lxc.net.[i].link</option> option.
If the bridge is not specified, then the veth pair device
will be created but not attached to any bridge.
Otherwise, the bridge has to be created on the system
container, but if you wish to handle
this name yourselves, you can tell <command>lxc</command>
to set a specific name with
- the <option>lxc.network.veth.pair</option> option (except for
+ the <option>lxc.net.[i].veth.pair</option> option (except for
unprivileged containers where this option is ignored for security
reasons).
</para>
<para>
<option>vlan:</option> a vlan interface is linked with
the interface specified by
- the <option>lxc.network.link</option> and assigned to
+ the <option>lxc.net.[i].link</option> and assigned to
the container. The vlan identifier is specified with the
- option <option>lxc.network.vlan.id</option>.
+ option <option>lxc.net.[i].vlan.id</option>.
</para>
<para>
<option>macvlan:</option> a macvlan interface is linked
with the interface specified by
- the <option>lxc.network.link</option> and assigned to
+ the <option>lxc.net.[i].link</option> and assigned to
the container.
- <option>lxc.network.macvlan.mode</option> specifies the
+ <option>lxc.net.[i].macvlan.mode</option> specifies the
mode the macvlan will use to communicate between
different macvlan on the same upper device. The accepted
modes are <option>private</option>, <option>vepa</option>,
<para>
<option>phys:</option> an already existing interface
- specified by the <option>lxc.network.link</option> is
+ specified by the <option>lxc.net.[i].link</option> is
assigned to the container.
</para>
</listitem>
<varlistentry>
<term>
- <option>lxc.network.[i].flags</option>
+ <option>lxc.net.[i].flags</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].link</option>
+ <option>lxc.net.[i].link</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].mtu</option>
+ <option>lxc.net.[i].mtu</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].name</option>
+ <option>lxc.net.[i].name</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].hwaddr</option>
+ <option>lxc.net.[i].hwaddr</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv4</option>
+ <option>lxc.net.[i].ipv4</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv4.gateway</option>
+ <option>lxc.net.[i].ipv4.gateway</option>
</term>
<listitem>
<para>
Can also have the special value <option>auto</option>,
which means to take the primary address from the bridge
interface (as specified by the
- <option>lxc.network.link</option> option) and use that as
+ <option>lxc.net.[i].link</option> option) and use that as
the gateway. <option>auto</option> is only available when
using the <option>veth</option> and
<option>macvlan</option> network types.
<varlistentry>
<term>
- <option>lxc.network.[i].ipv6</option>
+ <option>lxc.net.[i].ipv6</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].ipv6.gateway</option>
+ <option>lxc.net.[i].ipv6.gateway</option>
</term>
<listitem>
<para>
Can also have the special value <option>auto</option>,
which means to take the primary address from the bridge
interface (as specified by the
- <option>lxc.network.link</option> option) and use that as
+ <option>lxc.net.[i].link</option> option) and use that as
the gateway. <option>auto</option> is only available when
using the <option>veth</option> and
<option>macvlan</option> network types.
<varlistentry>
<term>
- <option>lxc.network.[i].script.up</option>
+ <option>lxc.net.[i].script.up</option>
</term>
<listitem>
<para>
<varlistentry>
<term>
- <option>lxc.network.[i].script.down</option>
+ <option>lxc.net.[i].script.down</option>
</term>
<listitem>
<para>
eth0.</para>
<programlisting>
lxc.utsname = myhostname
- lxc.network.type = veth
- lxc.network.flags = up
- lxc.network.link = br0
- lxc.network.name = eth0
- lxc.network.hwaddr = 4a:49:43:49:79:bf
- lxc.network.ipv4 = 10.2.3.5/24 10.2.3.255
- lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+ lxc.net.0.type = veth
+ lxc.net.0.flags = up
+ lxc.net.0.link = br0
+ lxc.net.0.name = eth0
+ lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+ lxc.net.0.ipv4 = 10.2.3.5/24 10.2.3.255
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
</programlisting>
</refsect2>
mounting some locations and a changing root file system.</para>
<programlisting>
lxc.utsname = complex
- lxc.network.0.type = veth
- lxc.network.0.flags = up
- lxc.network.0.link = br0
- lxc.network.0.hwaddr = 4a:49:43:49:79:bf
- lxc.network.0.ipv4 = 10.2.3.5/24 10.2.3.255
- lxc.network.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
- lxc.network.0.ipv6 = 2003:db8:1:0:214:5432:feab:3588
- lxc.network.1.type = macvlan
- lxc.network.1.flags = up
- lxc.network.1.link = eth0
- lxc.network.1.hwaddr = 4a:49:43:49:79:bd
- lxc.network.1.ipv4 = 10.2.3.4/24
- lxc.network.1.ipv4 = 192.168.10.125/24
- lxc.network.1.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
- lxc.network.2.type = phys
- lxc.network.2.flags = up
- lxc.network.2.link = dummy0
- lxc.network.2.hwaddr = 4a:49:43:49:79:ff
- lxc.network.2.ipv4 = 10.2.3.6/24
- lxc.network.2.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
+ lxc.net.0.type = veth
+ lxc.net.0.flags = up
+ lxc.net.0.link = br0
+ lxc.net.0.hwaddr = 4a:49:43:49:79:bf
+ lxc.net.0.ipv4 = 10.2.3.5/24 10.2.3.255
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
+ lxc.net.0.ipv6 = 2003:db8:1:0:214:5432:feab:3588
+ lxc.net.1.type = macvlan
+ lxc.net.1.flags = up
+ lxc.net.1.link = eth0
+ lxc.net.1.hwaddr = 4a:49:43:49:79:bd
+ lxc.net.1.ipv4 = 10.2.3.4/24
+ lxc.net.1.ipv4 = 192.168.10.125/24
+ lxc.net.1.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
+ lxc.net.2.type = phys
+ lxc.net.2.flags = up
+ lxc.net.2.link = dummy0
+ lxc.net.2.hwaddr = 4a:49:43:49:79:ff
+ lxc.net.2.ipv4 = 10.2.3.6/24
+ lxc.net.2.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.deny = a
function test_container_cmd()
log(0, "Test get config from running container...")
- veth_pair = lxc.cmd_get_config_item(optarg["n"], "lxc.network.0.veth.pair")
+ veth_pair = lxc.cmd_get_config_item(optarg["n"], "lxc.net.0.veth.pair")
log(0, " veth.pair:%s", veth_pair)
end
log(0, "Test network %d config...", net_nr)
local netcfg
- netcfg = container:get_keys("lxc.network." .. net_nr)
+ netcfg = container:get_keys("lxc.net." .. net_nr)
if (netcfg == nil) then
return
end
log(0, " %s = %s", k, v or "")
end
assert(netcfg["flags"] == "up")
- assert(container:get_config_item("lxc.network."..net_nr..".type") == "veth")
+ assert(container:get_config_item("lxc.net."..net_nr..".type") == "veth")
end
* lxc_cmd_get_config_item: Get config item the running container
*
* @name : name of container to connect to
- * @item : the configuration item to retrieve (ex: lxc.network.0.veth.pair)
+ * @item : the configuration item to retrieve (ex: lxc.net.0.veth.pair)
* @lxcpath : the lxcpath in which the container is running
*
* Returns the item on success, NULL on failure. The caller must free() the
/*
* Defines a structure to configure a network device
- * @link : lxc.network.link, name of bridge or host iface to attach if any
- * @name : lxc.network.name, name of iface on the container side
+ * @link : lxc.net.[i].link, name of bridge or host iface to attach if any
+ * @name : lxc.net.[i].name, name of iface on the container side
* @flags : flag of the network device (IFF_UP, ... )
* @ipv4 : a list of ipv4 addresses to be set on the network device
* @ipv6 : a list of ipv6 addresses to be set on the network device
}
/*
- * If we find a lxc.network.hwaddr in the original config file, we expand it in
+ * If we find a lxc.net.hwaddr in the original config file, we expand it in
* the unexpanded_config, so that after a save_config we store the hwaddr for
* re-use.
* This is only called when reading the config file, not when executing a
if (!key)
return lxc_listconfigs(retv, inlen);
/*
- * Support 'lxc.network.<idx>', i.e. 'lxc.network.0'
+ * Support 'lxc.net.<idx>', i.e. 'lxc.net.0'
* This is an intelligent result to show which keys are valid given
* the type of nic it is
*/
char buf[256];
for(netnr = 0; ;netnr++) {
- sprintf(buf, "lxc.network.%d.type", netnr);
+ sprintf(buf, "lxc.net.%d.type", netnr);
type = c->get_running_config_item(c, buf);
if (!type)
break;
if (!strcmp(type, "veth")) {
- sprintf(buf, "lxc.network.%d.veth.pair", netnr);
+ sprintf(buf, "lxc.net.%d.veth.pair", netnr);
} else {
- sprintf(buf, "lxc.network.%d.link", netnr);
+ sprintf(buf, "lxc.net.%d.link", netnr);
}
free(type);
ifname = c->get_running_config_item(c, buf);
print("Testing the networking")
# A few basic checks of the current state
-assert("name" in container.get_keys("lxc.network.0"))
+assert("name" in container.get_keys("lxc.net.0"))
assert(len(container.network) == 1)
## Starting the container
self.container = container
self.index = index
- for key in self.container.get_keys("lxc.network.%s" % self.index):
+ for key in self.container.get_keys("lxc.net.%s" % self.index):
if "." in key:
self.props[key.replace(".", "_")] = key
else:
def __clear_network_item(self, key):
if key in ("ipv4", "ipv6"):
- return self.container.clear_config_item("lxc.network.%s.%s" % (
+ return self.container.clear_config_item("lxc.net.%s.%s" % (
self.index, key))
else:
- return self.container.set_config_item("lxc.network.%s.%s" % (
+ return self.container.set_config_item("lxc.net.%s.%s" % (
self.index, key), "")
def __get_network_item(self, key):
- return self.container.get_config_item("lxc.network.%s.%s" % (
+ return self.container.get_config_item("lxc.net.%s.%s" % (
self.index, key))
def __set_network_item(self, key, value):
- return self.container.set_config_item("lxc.network.%s.%s" % (
+ return self.container.set_config_item("lxc.net.%s.%s" % (
self.index, key), value)
return ContainerNetwork(self.container, index)
def __len__(self):
- values = self.container.get_config_item("lxc.network")
+ values = self.container.get_config_item("lxc.net")
if values:
return len(values)
def add(self, network_type):
index = len(self)
- return self.container.set_config_item("lxc.network.%s.type" % index,
+ return self.container.set_config_item("lxc.net.%s.type" % index,
network_type)
def remove(self, index):
if index >= count:
raise IndexError("list index out of range")
- return self.container.clear_config_item("lxc.network.%s" % index)
+ return self.container.clear_config_item("lxc.net.%s" % index)
class Container(_lxc.Container):
fprintf(stderr, "%d: %s thought it was defined\n", __LINE__, MYNAME);
goto err;
}
- if (!c->set_config_item(c, "lxc.network.type", "empty")) {
+ if (!c->set_config_item(c, "lxc.net.0.type", "empty")) {
fprintf(stderr, "%s: %d: failed to set network type\n", __FILE__, __LINE__);
goto err;
}
c->destroy(c);
c = lxc_container_new(name, lxcpath);
}
- c->set_config_item(c, "lxc.network.type", "empty");
+ c->set_config_item(c, "lxc.net.0.type", "empty");
if (!c->createl(c, template, NULL, NULL, 0, NULL)) {
TSTERR("creating container %s", name);
goto out2;
goto out;
}
- if (!c->set_config_item(c, "lxc.network.type", "veth")) {
+ if (!c->set_config_item(c, "lxc.net.0.type", "veth")) {
fprintf(stderr, "%d: failed to set network type\n", __LINE__);
goto out;
}
- c->set_config_item(c, "lxc.network.link", "lxcbr0");
- c->set_config_item(c, "lxc.network.flags", "up");
+ c->set_config_item(c, "lxc.net.0.link", "lxcbr0");
+ c->set_config_item(c, "lxc.net.0.flags", "up");
if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
fprintf(stderr, "%d: failed to create a trusty container\n", __LINE__);
goto out;
printf("%d: get_config_item(lxc.cap.drop) returned %d %s\n", __LINE__, ret, v2);
ret = c->get_config_item(c, "lxc.network", v2, 255);
if (ret < 0) {
- fprintf(stderr, "%d: get_config_item returned %d\n", __LINE__, ret);
+ fprintf(stderr, "%d: get_config_item(lxc.network) returned %d\n", __LINE__, ret);
goto out;
}
printf("%d: get_config_item(lxc.network) returned %d %s\n", __LINE__, ret, v2);
mkdir -p $HDIR/.config/lxc/
cat > $HDIR/.config/lxc/default.conf << EOF
-lxc.network.type = veth
-lxc.network.link = lxcbr0
+lxc.net.0.type = veth
+lxc.net.0.link = lxcbr0
lxc.id_map = u 0 910000 9999
lxc.id_map = g 0 910000 9999
EOF
}
verify_numnics() {
- verify_unchanged_number lxc.network.type "network defs"
+ verify_unchanged_number lxc.net.0.type "network defs"
}
verify_hwaddr() {
- verify_unchanged_number lxc.network.hwaddr "hwaddr defs"
- grep ^lxc.network.hwaddr $CONTAINER_PATH/config | while read line; do
+ verify_unchanged_number lxc.net.0.hwaddr "hwaddr defs"
+ grep ^lxc.net.0.hwaddr $CONTAINER_PATH/config | while read line; do
addr=`echo $line | awk -F= { print $2 }`
echo "looking for $addr in $CONTAINER2_PATH/config"
if grep -q $addr $CONTAINER2_PATH/config; then
# Simple nic
cat > $s/1.conf << EOF
-lxc.network.type = veth
-lxc.network.link = lxcbr0
+lxc.net.0.type = veth
+lxc.net.0.link = lxcbr0
EOF
# Simple nic with hwaddr; verify hwaddr changed
cat > $s/2.conf << EOF
-lxc.network.type = veth
-lxc.network.link = lxcbr0
+lxc.net.0.type = veth
+lxc.net.0.link = lxcbr0
EOF
# No nics, but nic from include
cat > $s/1.include << EOF
-lxc.network.type = veth
-lxc.network.link = lxcbr0
+lxc.net.0.type = veth
+lxc.net.0.link = lxcbr0
lxc.hook.start = /bin/bash
EOF
cat > $s/3.conf << EOF
trap cleanup EXIT
cat > $f << EOF
-lxc.network.type = veth
-lxc.network.hwaddr = 00:16:3e:xx:xx:xx
+lxc.net.0.type = veth
+lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
EOF
lxc-create -t busybox -f $f -n lxctestc
grep -q "xx:xx" /var/lib/lxc/lxctestc/config && { echo "hwaddr not expanded"; exit 1; }
mkdir -p /etc/lxc/
cat > /etc/lxc/default.conf << EOF
-lxc.network.type = veth
-lxc.network.link = lxcbr0
+lxc.net.0.type = veth
+lxc.net.0.link = lxcbr0
EOF
ARCH=i386
mkdir -p $HDIR/.config/lxc/
cat > $HDIR/.config/lxc/default.conf << EOF
-lxc.network.type = veth
-lxc.network.link = lxcbr0
+lxc.net.0.type = veth
+lxc.net.0.link = lxcbr0
lxc.id_map = u 0 910000 9999
lxc.id_map = g 0 910000 9999
EOF
mkdir -p /home/usernic-user/.config/lxc/
cat > /home/usernic-user/.config/lxc/default.conf << EOF
-lxc.network.type = empty
+lxc.net.0.type = empty
lxc.id_map = u 0 910000 10000
lxc.id_map = g 0 910000 10000
EOF
goto out;
}
- if (!c->set_config_item(c, "lxc.network.type", "veth")) {
+ if (!c->set_config_item(c, "lxc.net.0.type", "veth")) {
fprintf(stderr, "%d: failed to set network type\n", __LINE__);
goto out;
}
- c->set_config_item(c, "lxc.network.link", "lxcbr0");
- c->set_config_item(c, "lxc.network.flags", "up");
+ c->set_config_item(c, "lxc.net.0.link", "lxcbr0");
+ c->set_config_item(c, "lxc.net.0.flags", "up");
if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
fprintf(stderr, "%d: failed to create a container\n", __LINE__);
goto out;
fprintf(stderr, "%d: %s thought it was defined\n", __LINE__, MYNAME);
(void) c->destroy_with_snapshots(c);
}
- if (!c->set_config_item(c, "lxc.network.type", "empty")) {
+ if (!c->set_config_item(c, "lxc.net.0.type", "empty")) {
fprintf(stderr, "%s: %d: failed to set network type\n", __FILE__, __LINE__);
goto err;
}
#lxc.aa_profile = unconfined
#networking
-#lxc.network.type = $lxc_network_type
-#lxc.network.flags = up
-#lxc.network.link = $lxc_network_link
-#lxc.network.name = veth0
-#lxc.network.mtu = 1500
+#lxc.net.0.type = $lxc_network_type
+#lxc.net.0.flags = up
+#lxc.net.0.link = $lxc_network_link
+#lxc.net.0.name = veth0
+#lxc.net.0.mtu = 1500
EOF
if [ ! -z ${ipv4} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv4 = $ipv4
+lxc.net.0.ipv4 = $ipv4
EOF
fi
if [ ! -z ${gw} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv4.gateway = $gw
+lxc.net.0.ipv4.gateway = $gw
EOF
fi
if [ ! -z ${ipv6} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv6 = $ipv6
+lxc.net.0.ipv6 = $ipv6
EOF
fi
if [ ! -z ${gw6} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv6.gateway = $gw6
+lxc.net.0.ipv6.gateway = $gw6
EOF
fi
cat <<EOF >> $config_path/config
# Seems that \s doesn't work in brackets.
KEY=$(expr "${LINE}" : '\s*\([^ ]*\)\s*=')
- if [[ "${KEY}" != "lxc.network.hwaddr" ]]
+ if [[ "${KEY}" != "lxc.net.0.hwaddr" ]]
then
echo ${LINE} >> $config_path/config
- if [[ "${KEY}" == "lxc.network.link" ]]
+ if [[ "${KEY}" == "lxc.net.0.link" ]]
then
- echo "lxc.network.hwaddr = $(create_hwaddr)" >> $config_path/config
+ echo "lxc.net.0.hwaddr = $(create_hwaddr)" >> $config_path/config
fi
fi
done < $config_path/config.def
#lxc.aa_profile = unconfined
# example simple networking setup, uncomment to enable
-#lxc.network.type = $lxc_network_type
-#lxc.network.flags = up
-#lxc.network.link = $lxc_network_link
-#lxc.network.name = eth0
+#lxc.net.0.type = $lxc_network_type
+#lxc.net.0.flags = up
+#lxc.net.0.link = $lxc_network_link
+#lxc.net.0.name = eth0
# Additional example for veth network type
# static MAC address,
-#lxc.network.hwaddr = 00:16:3e:77:52:20
+#lxc.net.0.hwaddr = 00:16:3e:77:52:20
# persistent veth device name on host side
# Note: This may potentially collide with other containers of same name!
-#lxc.network.veth.pair = v-$name-e0
+#lxc.net.0.veth.pair = v-$name-e0
EOF
# Generate the configuration file
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
- nics=$(grep -ce '^lxc\.network\.type[ \t]*=[ \t]*veth' "$path/config")
+ nics=$(grep -ce '^lxc\.net\.0\.type[ \t]*=[ \t]*veth' "$path/config")
if [ "$nics" -eq 1 ]; then
- grep -q "^lxc.network.hwaddr" "$path/config" || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" "$path/config"
+ grep -q "^lxc.net.0.hwaddr" "$path/config" || sed -i -e "/^lxc\.net\.0\.type[ \t]*=[ \t]*veth/a lxc.net.0.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" "$path/config"
fi
## Add all the includes
fi
## Extract all the network config entries
-sed -i -e "/lxc.network/{w ${LXC_PATH}/config-network" -e "d}" \
+sed -i -e "/lxc.net.0/{w ${LXC_PATH}/config-network" -e "d}" \
${LXC_PATH}/config
## Extract any other config entry
# Seems that \s doesn't work in brackets.
KEY=$(expr "${LINE}" : '\s*\([^ ]*\)\s*=')
- if [[ "${KEY}" != "lxc.network.hwaddr" ]]
+ if [[ "${KEY}" != "lxc.net.0.hwaddr" ]]
then
echo "${LINE}" >> $config_path/config
- if [[ "${KEY}" == "lxc.network.link" ]]
+ if [[ "${KEY}" == "lxc.net.0.link" ]]
then
- echo "lxc.network.hwaddr = $(create_hwaddr)" >> $config_path/config
+ echo "lxc.net.0.hwaddr = $(create_hwaddr)" >> $config_path/config
fi
fi
done < $config_path/config.def
#lxc.aa_profile = unconfined
# example simple networking setup, uncomment to enable
-#lxc.network.type = $lxc_network_type
-#lxc.network.flags = up
-#lxc.network.link = $lxc_network_link
-#lxc.network.name = eth0
+#lxc.net.0.type = $lxc_network_type
+#lxc.net.0.flags = up
+#lxc.net.0.link = $lxc_network_link
+#lxc.net.0.name = eth0
# Additional example for veth network type
# static MAC address,
-#lxc.network.hwaddr = 00:16:3e:77:52:20
+#lxc.net.0.hwaddr = 00:16:3e:77:52:20
# persistent veth device name on host side
# Note: This may potentially collide with other containers of same name!
-#lxc.network.veth.pair = v-$name-e0
+#lxc.net.0.veth.pair = v-$name-e0
EOF
# Seems that \s doesn't work in brackets.
key=$(expr "${line}" : '\s*\([^ ]*\)\s*=')
- if [ "${key}" != "lxc.network.hwaddr" ]
+ if [ "${key}" != "lxc.net.0.hwaddr" ]
then
echo "${line}" >> "${config}"
- if [ "${key}" == "lxc.network.link" ]
+ if [ "${key}" == "lxc.net.0.link" ]
then
- echo "lxc.network.hwaddr = $(create_hwaddr)" >> "${config}"
+ echo "lxc.net.0.hwaddr = $(create_hwaddr)" >> "${config}"
fi
fi
done < "${config}.orig"
#lxc.aa_profile = unconfined
# example simple networking setup, uncomment to enable
-#lxc.network.type = ${lxc_network_type}
-#lxc.network.flags = up
-#lxc.network.link = ${lxc_network_link}
-#lxc.network.name = eth0
+#lxc.net.0.type = ${lxc_network_type}
+#lxc.net.0.flags = up
+#lxc.net.0.link = ${lxc_network_link}
+#lxc.net.0.name = eth0
# Additional example for veth network type
# static MAC address,
-#lxc.network.hwaddr = $(create_hwaddr)
+#lxc.net.0.hwaddr = $(create_hwaddr)
# persistent veth device name on host side
# Note: This may potentially collide with other containers of same name!
-#lxc.network.veth.pair = v-${name}-e0
+#lxc.net.0.veth.pair = v-${name}-e0
EOF
if [ $? -ne 0 ]
value=$(echo "${line}" | sed 's/^.*_real_ugly_sep_42_//')
#new nic !
- if [[ "${key}" == "lxc.network.type" ]]; then
+ if [[ "${key}" == "lxc.net.0.type" ]]; then
#we don't know what to do with it.
[[ "${value}" == "empty" ]] && continue
nic_type="${value}"
fi
- if [[ "${key}" == "lxc.network.hwaddr" ]]; then
+ if [[ "${key}" == "lxc.net.0.hwaddr" ]]; then
nic_hwaddr=1
fi
- if [[ "${key}" =~ ^lxc.network.ipv(4|6) ]]; then
+ if [[ "${key}" =~ ^lxc.net.0.ipv(4|6) ]]; then
#tell openrc to not manage this NIC as LXC set there address
nic_conf="null"
fi
- if [[ "${key}" =~ ^lxc.network.name ]]; then
+ if [[ "${key}" =~ ^lxc.net.0.name ]]; then
nic_name="${value}"
let nic_named=nic_named+1
fi
store_user_message "No network interface for this container
It's a pitty, you have bridge, ${bridge}.
If it is for Lxc, use it next time by adding this to your default.conf :
-lxc.network.type = veth
-lxc.network.link = ${bridge}
-lxc.network.flags = up
-lxc.network.hwaddr = fe:xx:xx:xx:xx:xx"
+lxc.net.0.type = veth
+lxc.net.0.link = ${bridge}
+lxc.net.0.flags = up
+lxc.net.0.hwaddr = fe:xx:xx:xx:xx:xx"
return 0
else
store_user_message "No network interface for this container"
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
- nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' ${conf_file} | wc -l`
+ nics=`grep -e '^lxc\.net\.0\.type[ \t]*=[ \t]*veth' ${conf_file} | wc -l`
if [ $nics -eq 1 ]; then
- grep -q "^lxc.network.hwaddr" ${conf_file} || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" ${conf_file}
+ grep -q "^lxc.net.0.hwaddr" ${conf_file} || sed -i -e "/^lxc\.net\.0\.type[ \t]*=[ \t]*veth/a lxc.net.0.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" ${conf_file}
fi
if grep -q "^lxc.rootfs" "${conf_file}" ; then
#lxc.aa_profile = unconfined
#networking
-lxc.network.type = $lxc_network_type
-lxc.network.flags = up
-lxc.network.link = $lxc_network_link
-lxc.network.name = eth0
-lxc.network.mtu = 1500
+lxc.net.0.type = $lxc_network_type
+lxc.net.0.flags = up
+lxc.net.0.link = $lxc_network_link
+lxc.net.0.name = eth0
+lxc.net.0.mtu = 1500
EOF
if [ ! -z ${ipv4} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv4 = $ipv4
+lxc.net.0.ipv4 = $ipv4
EOF
fi
if [ ! -z ${gw} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv4.gateway = $gw
+lxc.net.0.ipv4.gateway = $gw
EOF
fi
if [ ! -z ${ipv6} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv6 = $ipv6
+lxc.net.0.ipv6 = $ipv6
EOF
fi
if [ ! -z ${gw6} ]; then
cat <<EOF >> $config_path/config
-lxc.network.ipv6.gateway = $gw6
+lxc.net.0.ipv6.gateway = $gw6
EOF
fi
cat <<EOF >> $config_path/config
# Seems that \s doesn't work in brackets.
KEY=$(expr "${LINE}" : '\s*\([^ ]*\)\s*=')
- if [[ "${KEY}" != "lxc.network.hwaddr" ]]
+ if [[ "${KEY}" != "lxc.net.0.hwaddr" ]]
then
echo "${LINE}" >> $path/config
- if [[ "${KEY}" == "lxc.network.link" ]]
+ if [[ "${KEY}" == "lxc.net.0.link" ]]
then
- echo "lxc.network.hwaddr = $(create_hwaddr)" >> $path/config
+ echo "lxc.net.0.hwaddr = $(create_hwaddr)" >> $path/config
fi
fi
done < $path/config.def
lxc.aa_profile = unconfined
# example simple networking setup, uncomment to enable
-#lxc.network.type = $lxc_network_type
-#lxc.network.flags = up
-#lxc.network.link = $lxc_network_link
-#lxc.network.name = eth0
+#lxc.net.0.type = $lxc_network_type
+#lxc.net.0.flags = up
+#lxc.net.0.link = $lxc_network_link
+#lxc.net.0.name = eth0
# Additional example for veth network type
# static MAC address,
-#lxc.network.hwaddr = 00:16:3e:77:52:20
+#lxc.net.0.hwaddr = 00:16:3e:77:52:20
# persistent veth device name on host side
# Note: This may potentially collide with other containers of same name!
-#lxc.network.veth.pair = v-$name-e0
+#lxc.net.0.veth.pair = v-$name-e0
EOF
echo "# Networking" >>$cfg_dir/config
# see if the default network settings were already specified
- lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_type=`grep '^lxc.net.0.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_type" ]; then
- echo "lxc.network.type = veth" >>$cfg_dir/config
+ echo "lxc.net.0.type = veth" >>$cfg_dir/config
lxc_network_type=veth
fi
- lxc_network_link=`grep '^lxc.network.link' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_link=`grep '^lxc.net.0.link' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_link" ]; then
- echo "lxc.network.link = lxcbr0" >>$cfg_dir/config
+ echo "lxc.net.0.link = lxcbr0" >>$cfg_dir/config
lxc_network_link=lxcbr0
fi
- lxc_network_hwaddr=`grep '^lxc.network.hwaddr' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_hwaddr=`grep '^lxc.net.0.hwaddr' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_hwaddr" ]; then
# generate a hwaddr for the container
# see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
local hwaddr="00:16:3e:`dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
head -n1 | awk '{print $2}' | cut -c1-6 | \
sed 's/\(..\)/\1:/g; s/.$//'`"
- echo "lxc.network.hwaddr = $hwaddr" >>$cfg_dir/config
+ echo "lxc.net.0.hwaddr = $hwaddr" >>$cfg_dir/config
fi
- lxc_network_flags=`grep '^lxc.network.flags' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_flags=`grep '^lxc.net.0.flags' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_flags" ]; then
- echo "lxc.network.flags = up" >>$cfg_dir/config
+ echo "lxc.net.0.flags = up" >>$cfg_dir/config
fi
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
-lxc.network.name = eth0
-lxc.network.mtu = 1500
+lxc.net.0.name = eth0
+lxc.net.0.mtu = 1500
EOF
}
echo "# Networking" >>$cfg_dir/config
# see if the default network settings were already specified
- lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_type=`grep '^lxc.net.0.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_type" ]; then
- echo "lxc.network.type = veth" >>$cfg_dir/config
+ echo "lxc.net.0.type = veth" >>$cfg_dir/config
lxc_network_type=veth
fi
- lxc_network_link=`grep '^lxc.network.link' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_link=`grep '^lxc.net.0.link' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_link" ]; then
- echo "lxc.network.link = lxcbr0" >>$cfg_dir/config
+ echo "lxc.net.0.link = lxcbr0" >>$cfg_dir/config
lxc_network_link=lxcbr0
fi
- lxc_network_hwaddr=`grep '^lxc.network.hwaddr' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_hwaddr=`grep '^lxc.net.0.hwaddr' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_hwaddr" ]; then
# generate a hwaddr for the container
# see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
local hwaddr="00:16:3e:`dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
head -n1 | awk '{print $2}' | cut -c1-6 | \
sed 's/\(..\)/\1:/g; s/.$//'`"
- echo "lxc.network.hwaddr = $hwaddr" >>$cfg_dir/config
+ echo "lxc.net.0.hwaddr = $hwaddr" >>$cfg_dir/config
fi
- lxc_network_flags=`grep '^lxc.network.flags' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+ lxc_network_flags=`grep '^lxc.net.0.flags' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
if [ -z "$lxc_network_flags" ]; then
- echo "lxc.network.flags = up" >>$cfg_dir/config
+ echo "lxc.net.0.flags = up" >>$cfg_dir/config
fi
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
-lxc.network.name = eth0
-lxc.network.mtu = 1500
+lxc.net.0.name = eth0
+lxc.net.0.mtu = 1500
EOF
}
fi
# if no .ipv4 section in config, then have the container run dhcp
- grep -q "^lxc.network.ipv4" $path/config || touch $rootfs/run-dhcp
+ grep -q "^lxc.net.0.ipv4" $path/config || touch $rootfs/run-dhcp
if [ "$(uname -m)" = "x86_64" ]; then
cat <<EOF >> $path/config
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
- nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
+ nics=`grep -e '^lxc\.net\.0\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
if [ $nics -eq 1 ]; then
- grep -q "^lxc.network.hwaddr" $path/config || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config
+ grep -q "^lxc.net.0.hwaddr" $path/config || sed -i -e "/^lxc\.net\.0\.type[ \t]*=[ \t]*veth/a lxc.net.0.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config
fi
# Generate the configuration file
## Relocate all the network config entries
- sed -i -e "/lxc.network/{w ${path}/config-network" -e "d}" $path/config
+ sed -i -e "/lxc.net.0/{w ${path}/config-network" -e "d}" $path/config
## Relocate any other config entries
sed -i -e "/lxc./{w ${path}/config-auto" -e "d}" $path/config
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
- nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
+ nics=`grep -e '^lxc\.net\.0\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
if [ $nics -eq 1 ]; then
- grep -q "^lxc.network.hwaddr" $path/config || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config
+ grep -q "^lxc.net.0.hwaddr" $path/config || sed -i -e "/^lxc\.net\.0\.type[ \t]*=[ \t]*veth/a lxc.net.0.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config
fi
# Generate the configuration file
## Relocate all the network config entries
- sed -i -e "/lxc.network/{w ${path}/config-network" -e "d}" $path/config
+ sed -i -e "/lxc.net.0/{w ${path}/config-network" -e "d}" $path/config
## Relocate any other config entries
sed -i -e "/lxc./{w ${path}/config-auto" -e "d}" $path/config