[Lxc-users] LXC on "Virtual interfaces"

Daniel Lezcano daniel.lezcano at free.fr
Sun May 15 20:02:48 UTC 2011


On 05/15/2011 08:27 PM, David Touzeau wrote:
> Le dimanche 15 mai 2011 à 19:26 +0200, Daniel Lezcano a écrit :
>
>> On 05/15/2011 06:19 PM, David Touzeau wrote:
>>> Dear
>>>
>>> is it possible to point LXC container to a virtual interface ?
>>> I have only one interface 'eth1' and i would like LXC containers using
>>> "Virtual Interfaces"
>>> When running the LXC container the network card disapears and server
>>> network is down.
>>> I need to reboot the computer in order to retreive the eth1 main
>>> interface.
>>>
>>> I have these IP settings :
>>> eth1      Link encap:Ethernet  HWaddr 00:0C:29:AD:40:A7
>>>             inet adr:192.168.1.64  Bcast:192.168.1.255
>>> Masque:255.255.255.0
>>>             adr inet6: fe80::20c:29ff:fead:40a7/64 Scope:Lien
>>>             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>>             RX packets:1155 errors:0 dropped:0 overruns:0 frame:0
>>>             TX packets:615 errors:0 dropped:0 overruns:0 carrier:0
>>>             collisions:0 lg file transmission:1000
>>>             RX bytes:635343 (620.4 KiB)  TX bytes:61524 (60.0 KiB)
>>>             Interruption:18 Adresse de base:0x2000
>>>
>>> eth1:1    Link encap:Ethernet  HWaddr 00:0C:29:AD:40:A7
>>>             inet adr:192.168.1.65  Bcast:192.168.1.255
>>> Masque:255.255.255.0
>>>             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>>             Interruption:18 Adresse de base:0x2000
>>>
>>> eth1:2    Link encap:Ethernet  HWaddr 00:0C:29:AD:40:A7
>>>             inet adr:192.168.1.66  Bcast:192.168.1.255
>>> Masque:255.255.255.0
>>>             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>>             Interruption:18 Adresse de base:0x2000
>>>
>>> eth1:3    Link encap:Ethernet  HWaddr 00:0C:29:AD:40:A7
>>>             inet adr:192.168.1.67  Bcast:192.168.1.255
>>> Masque:255.255.255.0
>>>             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>>             Interruption:18 Adresse de base:0x200
>>>
>>> And this configuration file.
>>>
>>> lxc.utsname =vps-1
>>> lxc.tty = 4
>>> lxc.pts = 1024
>> Remove these 4 lines
>>> lxc.network.type = phys
>>> lxc.network.flags = up
>>> lxc.network.link = eth1:3
>>> lxc.network.flags = up
>> and replace by:
>>
>> lxc.network.type = macvlan
>> lxc.network.link = eth1
>> lxc.network.flags = up
>>
>> Note the container won't be able to communicate with the host.
>> Otherwise you can use a veth + bridge configuration described at:
>>
>> http://www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks
>>
>> Cheers
>>     -- Daniel
>
> Thanks Daniel
>
> So the "phys" is not compliance with "Virtual interfaces" ?

Hmm, yes. The word "phys" stands for physical as opposed to virtual.

> When you said : "Note the container won't be able to communicate with
> the host."
> is container can communicate with the world ? and is container should be
> contacted by the world (except the host) ?

That means you can ping the network from the container but not the host 
and the host can ping the network but not the container.

> i have tried using veth+ bridge but it is not compliance when running
> LXC containers on host virtualized by ESXi
> Containers can communicate with host but did not communicate with the
> entire network.

Oh, yes, I think this problem was already spotted in this mailing list. 
It is a configuration tweak on ESXi.

   -- Daniel




More information about the lxc-users mailing list