[lxc-users] Network configuration for multiple IP adresses

Moritz Kobel mailinglists at kobelnet.ch
Tue Nov 11 10:02:44 UTC 2014


Am Tuesday den 11. November 2014 schrieb Fajar A. Nugraha:

> On Tue, Nov 11, 2014 at 4:02 PM, Moritz Kobel <mailinglists at kobelnet.ch>
> wrote:
> 
> > Hello,
> >
> > I would like to configure several IPv4 and IPv6 adresses for one
> > container. This works basically with the configuration below.
> > But it configures only one network interface (eth0) with all addresses.
> > (One primary and the others as seconday).
> >
> >
> > What do I have to modify to get several interfaces (eth0,eth0:0,eth0:1,..
> > or eth0,eth1,eth2,...)?
> >
> >
> > lxc.network.type = veth
> > lxc.network.flags = up
> > lxc.network.link = br0
> > lxc.network.hwaddr = <REMOVED>
> >
> 
> 
> Delete everything from here ...
> 
> 
> > lxc.network.ipv4.gateway = <REMOVED>
> > lxc.network.ipv6.gateway = <REMOVED>
> > lxc.network.name = eth0
> > lxc.network.ipv4 = <REMOVED>.106/27
> > lxc.network.ipv6 = <REMOVED>:106/64
> > lxc.network.ipv4 = <REMOVED>.108/27
> > lxc.network.ipv6 = <REMOVED>:108/64
> > lxc.network.ipv4 = <REMOVED>.109/27
> > lxc.network.ipv6 = <REMOVED>:109/64
> >
> 
> to here, and instead setup your IP addresses from the container OS
> configuration script (e.g. /etc/network/interfaces,
> /etc/sysconfig/network-scripts/ifcfg-eth*). That should give only one
> interface, and you can configure eth0:1, eth0:2, etc from inside the
> container.
> 
> 
> If you instead want eth0, eth1, eth2, etc, then repeat the network block
> block several times, e.g.
> 
> lxc.network.type = veth
> lxc.network.flags = up
> lxc.network.link = br0
> lxc.network.hwaddr = <MAC1>
> 
> lxc.network.type = veth
> lxc.network.flags = up
> lxc.network.link = br0
> lxc.network.hwaddr = <MAC2>
> 
 
Thank you very much for your reply. I can confirm both methods
working. I will chose the second variant to have the complete config in
the lxc container config file.

- Moritz


-- 
                           <\         __@  __@
                             \ __   _-\<, -\<,_
http://www.tandemblog.ch    0<==`-(-)/---|/-(_)


More information about the lxc-users mailing list