Connecting LXC (linux containers - virtual machines) to NS3 and Physical LAN machine

388 views
Skip to first unread message

Gelli Ravikumar

unread,
Oct 7, 2016, 1:54:42 AM10/7/16
to ns-3-users
Dear ns-3-users,

I have been working on ns-3 in the emulation-mode (tap-bridge), and successfully accomplished the creation of Linux containers (virtual machines) and their connection to the ns-3 tap devices as explained in the "HOWTO Use Linux Containers to set up virtual networks (https://www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks)". The linux containers and the ns-3 are executed in the Host machine. With this setup, having the ns-3 simulator ON, ping between the two linux containers are achieved. Now, I would like to connect the linux containers created in the Host machine from a physical LAN computer. The LAN computer can ping the Host machine but could not the linux containers that are inside the Host machine, which is due to the linux containers doesn't have visibility (IP visibility) to the physical LAN. Can anyone help in this regard.

-- Gelli

Tommaso Pecorella

unread,
Oct 8, 2016, 4:47:57 AM10/8/16
to ns-3-users
Hi,

no idea, but I guess that they'll have to have a 2nd virtual interface to be connected to the physical LAN.

Cheers,

T.

Tom Henderson

unread,
Oct 8, 2016, 11:27:51 AM10/8/16
to ns-3-...@googlegroups.com
On 10/08/2016 01:47 AM, Tommaso Pecorella wrote:
> Hi,
>
> no idea, but I guess that they'll have to have a 2nd virtual interface
> to be connected to the physical LAN.

In general, the most straightforward way to do this typically is to
create a bridge device on the host machine and add both the physical
interface on the host and the (2nd) virtual device on the container to
the bridge group. Something like this:
https://wiki.debian.org/LXC/SimpleBridge

Then if you add an IP address, within the same subnetwork as the IP
address of the host, on the container's 2nd virtual device, both the
host interface and the container interface should be reachable from
another computer.

- Tom


>
> Cheers,
>
> T.
>
>
> On Friday, October 7, 2016 at 7:54:42 AM UTC+2, Gelli Ravikumar wrote:
>
> Dear ns-3-users,
>
> I have been working on ns-3 in the emulation-mode (tap-bridge), and
> successfully accomplished the creation of Linux containers (virtual
> machines) and their connection to the ns-3 tap devices as explained
> in the "HOWTO Use Linux Containers to set up virtual networks
> (https://www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks)
> <https://www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks)>".
> The linux containers and the ns-3 are executed in the Host machine.
> With this setup, having the ns-3 simulator ON, ping between the two
> linux containers are achieved. Now, I would like to connect the
> linux containers created in the Host machine from a physical LAN
> computer. The LAN computer can ping the Host machine but could not
> the linux containers that are inside the Host machine, which is due
> to the linux containers doesn't have visibility (IP visibility) to
> the physical LAN. Can anyone help in this regard.
>
> -- Gelli
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> ---
> You received this message because you are subscribed to the Google
> Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To post to this group, send email to ns-3-...@googlegroups.com
> <mailto:ns-3-...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/d/optout.

Gelli Ravikumar

unread,
Oct 8, 2016, 2:20:14 PM10/8/16
to ns-3-...@googlegroups.com
Dear Tommaso and Tom,

Thanks for your response. I have just achieved a bridge interface between the br-left and the lxcbr0 (which is created by linux container, and is binded with the physical eth0) by Veth pairs, which is also a similar way of the answers mentioned above. Now, the linux containers (virtual nodes) can communicate through ns-3 as well as across LAN computers. Thanks once again for your answers that have used for validating my approach. 

I have used brctl for creating bridges and tunctl for creating taps. Each linux container (lxc) connects ns3 (ghost node - tapBridge) through a bridge and a tap interface. As far as my best knowledge, tunctl has a significant limitationwhich is a tunctl can support 16 taps, and it can further extend to 32 taps by some customization. I am not sure about the brctl, yet to be tested. My question is about how to address this scalability problem if we want to have more (greater than 32) linux containers (virtual nodes) to connect with ns-3. Please do let me know a possible solution or a better alternative. 

-- Gelli





 Sent with Mailtrack

--
with Regards
----------------------------------------------------
Dr. Gelli Ravikumar
Institute Research Associate
Field Computations Lab,
Dept. of Electrical Engineering,
IIT Bombay, Powai, Mumbai 400076
Ph: 022-2576 4424, 089 765 983 96

POSOCO Power System Award: PPSA - 2016 (Doctoral category)
Gandhian Young Technological Innovation Award - 2013
POSOCO Power System Award: PPSA - 2013 (MTech category)
IITB PhD Executive Member - 2013-14
IITB SARC Core Technical Member - 2014-15







To post to this group, send email to ns-3-...@googlegroups.com
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
--- You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/tA4zQWu441U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.

Gelli Ravikumar

unread,
Nov 10, 2016, 1:12:55 AM11/10/16
to ns-3-users
Can anyone help me in the following case:
  1. How the physical LAN-connected machines or remote machines can be connected to the taps created and interfaced to ns-3 through the TapBridge mode in a Host machine?

To post to this group, send email to ns-3-...@googlegroups.com
<mailto:ns-3-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Sidharth Sreekumar

unread,
Nov 9, 2017, 4:45:58 AM11/9/17
to ns-3-users

Hello Mr Gelli Ravikumar,
    I am also following the instructions given in https://www.nsnam.org/wiki/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks for creating the LXC and running the emulation. But after creating the container I'm not able to get into the console after giving the command:

$ sudo lxc-start -n right /bin/bash

As an  alternative I have tried using the command


$ sudo lxc-console -n right 

This has given me this result.

The configuration file contains legacy configuration keys.
Please update your configuration file!

Connected to tty 1
                  Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself

Im not getting the console even after this. It would be a great help if you can provide me with a workaround.

Thank you
Reply all
Reply to author
Forward
0 new messages