[Lxc-users] [lxc-users] How to bridge network to connect to multiple containers
Sujay M
sujay.m17 at gmail.com
Fri Jan 11 08:50:05 UTC 2013
Hi all,
I am using Ubuntu 12.04 as Host OS. I have 4 LXC containers setup namely
vm0, vm1, vm2, vm3. I want to establish a network between these so that the
containers and host can communicate with each other. How can i do this? I
have pasted some of the outputs which may be useful.
*root at host:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface (VirtualBox Adapter 1 - NAT)
auto eth0
iface eth0 inet dhcp
*
*# To to ssh to the ubuntu host (VirtualBox Adapter 2 - Host only)
*
*auto eth1
iface eth1 inet static
address 192.168.56.2
netmask 255.255.255.0
auto lxcbr0
iface lxcbr0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_maxwait 5
post-up /usr/sbin/brtcl setfd lxcbr0 0
root at host:~# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:93:1c:ac
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe93:1cac/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:2877 errors:0 dropped:0 overruns:0 frame:0
TX packets:2584 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1691148 (1.6 MB) TX bytes:141792 (141.7 KB)
eth1 Link encap:Ethernet HWaddr 08:00:27:6c:2e:6a
inet addr:192.168.56.2 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe6c:2e6a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5684 errors:0 dropped:0 overruns:0 frame:0
TX packets:4444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:481447 (481.4 KB) TX bytes:648016 (648.0 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:671 errors:0 dropped:0 overruns:0 frame:0
TX packets:671 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:113342 (113.3 KB) TX bytes:113342 (113.3 KB)
lxcbr0 Link encap:Ethernet HWaddr 08:00:27:93:1c:ac
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe93:1cac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1262 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:60342 (60.3 KB) TX bytes:2442 (2.4 KB)
veth08H1r9 Link encap:Ethernet HWaddr ba:9b:26:18:6c:83
inet6 addr: fe80::b89b:26ff:fe18:6c83/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:1365 errors:0 dropped:0 overruns:0 frame:0
TX packets:1803 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:81055 (81.0 KB) TX bytes:1622144 (1.6 MB)
virbr0 Link encap:Ethernet HWaddr 8a:3b:79:38:63:9e
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
*
*
*
All vm0, vm1, vm2, vm3 have same config, IP address and all produce the
same output
*
*
*root at vm0:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3e:4b:89:83
inet addr:10.0.2.29 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe4b:8983/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1850 errors:0 dropped:0 overruns:0 frame:0
TX packets:1370 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1625024 (1.6 MB) TX bytes:81485 (81.4 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:672 (672.0 B) TX bytes:672 (672.0 B)
*
*root at vm0:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
root at vm0:~# ping 192.168.56.2
PING 192.168.56.2 (192.168.56.2) 56(84) bytes of data.
64 bytes from 192.168.56.2: icmp_req=1 ttl=63 time=1.63 ms
root at vm0:~# ping google.com
PING google.com (173.194.36.4) 56(84) bytes of data.
64 bytes from bom04s01-in-f4.1e100.net (173.194.36.4): icmp_req=1 ttl=63
time=172 ms
*
*
root at vm0:~# ping 10.0.2.15
PING 10.0.2.15 (10.0.2.15) 56(84) bytes of data.
>From 10.0.2.29 icmp_seq=1 Destination Host Unreachable
*
also,
*
root at ubuntu:~# ping 10.0.2.29
PING 10.0.2.29 (10.0.2.29) 56(84) bytes of data.
>From 10.0.2.15 icmp_seq=1 Destination Host Unreachable*
Please Help. Thanks in advance.
--
Best Regards,
Sujay M
Final year B.Tech
Computer Engineering
NITK Surathkal
contact: +918971897571
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130111/3e9505d7/attachment.html>
More information about the lxc-users
mailing list