[Lxc-users] LXC on "Virtual interfaces"
Daniel Lezcano
daniel.lezcano at free.fr
Sun May 15 17:26:12 UTC 2011
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
More information about the lxc-users
mailing list