WIFI network emulation

327 views
Skip to first unread message

Andre

unread,
May 15, 2009, 12:57:49 PM5/15/09
to ns-3-users
Hi all,

Does anyone know if it's possible to create a TapBridge using
"UseBridge" mode and 802.11 adhoc mode?
There is a example tap-wifi-dumbbell.cc where it works, but only for
WIFI on the AP node.


Thanks,
andre




Tom Henderson

unread,
May 16, 2009, 9:46:35 AM5/16/09
to ns-3-...@googlegroups.com

Yes, I have done this previously; I will try to type up an example and
HOWTO on Monday.

Tom

Tom Henderson

unread,
May 21, 2009, 1:28:17 AM5/21/09
to ns-3-...@googlegroups.com

I went to write this example and HOWTO, and it reminded me that this is
not yet fixed. Basically, USE_BRIDGE mode requires the underlying
device to support SendFrom(). Wifi adhoc mode does not support this, so
there needs to be support added to the TapBridge to allow it to use
Send() in this case.

(See bug 510 in the tracker if you are interested in more background).

I will try to elevate the priority of this.
http://www.nsnam.org/bugzilla/show_bug.cgi?id=569

- Tom

cra...@ee.washington.edu

unread,
May 21, 2009, 1:35:20 AM5/21/09
to ns-3-...@googlegroups.com


> >> Does anyone know if it's possible to create a TapBridge using
> >> "UseBridge" mode and 802.11 adhoc mode?
> >> There is a example tap-wifi-dumbbell.cc where it works,
> but only for
> >> WIFI on the AP node.
> >
> > Yes, I have done this previously; I will try to type up an
> example and
> > HOWTO on Monday.
>
> I went to write this example and HOWTO, and it reminded me
> that this is
> not yet fixed. Basically, USE_BRIDGE mode requires the underlying
> device to support SendFrom(). Wifi adhoc mode does not
> support this, so
> there needs to be support added to the TapBridge to allow it to use
> Send() in this case.

That was what USE_LOCAL was for. From tap-bridge.cc:

//
// If we are operating in USE_LOCAL mode, we may be attached to an
ns-3
// device that does not support bridging (SupportsSendFrom returns
false).
// The whole point of this mode is really to support this case. We
allow
// only packets from one source MAC to flow across the TapBridge in
this
// mode and will spoof that address when packets flow the other way.
// Since we will be doing this spoofing, we can relax the normal
bridged
// device requirement to support SendFrom and use Send.
//
NS_LOG_LOGIC ("Forwarding packet to ns-3 device via Send()");
m_bridgedDevice->Send (packet, dst, type);

Doesn't this work?

Andre

unread,
May 21, 2009, 5:58:12 PM5/21/09
to ns-3-users
I tried this way but i couldn't get it to work. I'm trying to use ns-3
with virtual machines, so i need to bridge the tap device connected to
ns to the VM tap device. At: http://www.nsnam.org/doxygen-releas/group___tap_bridge_model.html
saids that BridgedDevice mode should be used. It also says that for
wireless networks there is a TapBridge SingleSource Mode Operation,
but i couldn't find anything about it.
Anyway i'll try to again to use the USE_LOCAL mode and find out more
about the difference between then.

Thanks,
André

Andre

unread,
May 26, 2009, 10:05:10 AM5/26/09
to ns-3-users
I've created a new simulation using de USE_LOCAL mode. Using the CSMA
channel it works well, but when i try to use a wireless network it
does not work. I think the the configuration of the network, and the
bridge to the virtual machine is OK. The use LOCAL_MODE should work
like Craig said, because I am using only one MAC source.
Can someone help me, am I doing something wrong?

Thanks,
- André

#include <iostream>
#include <fstream>
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/core-module.h"
#include "ns3/wifi-module.h"
#include "ns3/helper-module.h"
#include "ns3/global-routing-module.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("Test");

int
main (int argc, char *argv[])
{

GlobalValue::Bind ("SimulatorImplementationType", StringValue
("ns3::RealtimeSimulatorImpl"));
NodeContainer c;
c.Create (2);

NetDeviceContainer devices;

//Change to 0 to use WIFI
if (1) {
CsmaHelper csmaRight;
csmaRight.SetChannelAttribute ("Delay", TimeValue (MilliSeconds
(5)));
devices = csmaRight.Install(c);
}
else {

WifiHelper wifi;
wifi.SetMac ("ns3::AdhocWifiMac");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue
("wifia-54mbs"));
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default
();
wifiPhy.SetChannel (wifiChannel.Create ());
devices = wifi.Install (wifiPhy, c);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc =
CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (5.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
YansWifiPhyHelper::EnablePcap ("log",c);
}

InternetStackHelper internet;
internet.Install(c);

Ipv4AddressHelper ipv4;
ipv4.SetBase("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = ipv4.Assign (devices);

TapBridgeHelper tapBridge1 (interfaces.GetAddress (0));
tapBridge1.SetAttribute ("Mode", StringValue ("ConfigureLocal"));
tapBridge1.SetAttribute ("DeviceName", StringValue ("tapx"));
tapBridge1.Install(c.Get (0), devices.Get (0));

TapBridgeHelper tapBridge2 (interfaces.GetAddress (1));
tapBridge2.SetAttribute ("Mode", StringValue ("UseLocal"));
tapBridge2.SetAttribute ("DeviceName", StringValue ("sim0"));
tapBridge2.Install(c.Get (1), devices.Get (1));


//GlobalRouteManager::PopulateRoutingTables ();

Simulator::Stop (Seconds (600.));
Simulator::Run ();
Simulator::Destroy ();

todaytomo

unread,
Dec 26, 2009, 7:38:38 AM12/26/09
to Andre, ns-3-...@googlegroups.com
Hi Andre and all,
I also met the same problem when deploying a Wi Fi network by ns-3
with openVZ. As configured in tap-wifi-dumbbell.cc, "UseBridge" mode
can only attached to AP node. When attaching the "UseBridge" TapBridge
to a STA node, say changing node 0 to 1 in line 167 of tap-wifi-
dembbell.cc, then the error will be as following:
TapBridge::SetBridgedDevice: Device does not support SendFrom:
cannot be added to bridge.

There is a document in doxygen to explain this problem:
http://www.nsnam.org/doxygen-release/group___tap_bridge_model.html
But I did not found the so-called SingleSource mode in latest
codes.

Any suggestion?

Thanks very much!
Best wishes!
Jinxue Zhang

Tom Henderson

unread,
Dec 26, 2009, 7:47:26 PM12/26/09
to ns-3-...@googlegroups.com
On 12/26/09 4:38 AM, todaytomo wrote:
> Hi Andre and all,
> I also met the same problem when deploying a Wi Fi network by ns-3
> with openVZ. As configured in tap-wifi-dumbbell.cc, "UseBridge" mode
> can only attached to AP node. When attaching the "UseBridge" TapBridge
> to a STA node, say changing node 0 to 1 in line 167 of tap-wifi-
> dembbell.cc, then the error will be as following:
> TapBridge::SetBridgedDevice: Device does not support SendFrom:
> cannot be added to bridge.

Yes, UseBridge mode only works with devices that support the SendFrom
method.

>
> There is a document in doxygen to explain this problem:
> http://www.nsnam.org/doxygen-release/group___tap_bridge_model.html
> But I did not found the so-called SingleSource mode in latest
> codes.

The documentation in tap.h is out of date. We'll get it up to date
early next week. These are the valid modes:


.AddAttribute ("Mode",
"The operating and configuration mode to use.",
EnumValue (USE_LOCAL),
MakeEnumAccessor (&TapBridge::SetMode),
MakeEnumChecker (CONFIGURE_LOCAL, "ConfigureLocal",
USE_LOCAL, "UseLocal",
USE_BRIDGE, "UseBridge"))


We'll try to give an update on the status of this type of emulation
(OpenVZ with ns-3) early next week.

- Tom

Jinxue Zhang

unread,
Dec 26, 2009, 8:27:18 PM12/26/09
to ns-3-...@googlegroups.com
Tom, thanks very much for your reply. Look forward to your plan~~

Best wishes!
Jinxue Zhang


--

You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



Jinxue Zhang

unread,
Jan 8, 2010, 10:46:52 PM1/8/10
to ns-3-...@googlegroups.com
Hi Craig,
      Thanks for your update for tap.h. In

One particular use case for this mode(UseLocal) is in the OpenVZ environment.  There it is possible to create a Tap device on the "Hardware Node" and move it into a Virtual Private Server.  If the TapBrige is able to use an existing tap device it is then possible to avoid the overhead of an OS bridge in that environment.

      What do you mean by create a Tap devie on the HN and move it into a VPS? Thanks very much!

      Best wishes
      Jinxue

On Sun, Dec 27, 2009 at 8:47 AM, Tom Henderson <to...@tomh.org> wrote:

cra...@ee.washington.edu

unread,
Jan 8, 2010, 11:40:18 PM1/8/10
to ns-3-...@googlegroups.com

> What do you mean by create a Tap devie on the HN and move it into a VPS? Thanks very much!

 

Create a tap on the hardware node using tunctl, and move it into the VPS using vzctl –netdev_add.  Something like this:

 

---------- Begin Snippet ----------

 

# create VPS 1000 and 1001

sudo vzctl start 1000

sudo vzctl start 1001

 

# create the taps

sudo tunctl -p -t t1000

sudo tunctl -p -t t1001

 

# set the taps up

sudo ifconfig t1000 promisc 10.1.1.1 up

sudo ifconfig t1001 promisc 10.1.1.2 up

 

# move the VPS-side taps into their respective VPSs

sudo vzctl set 1000 --netdev_add t1000

sudo vzctl set 1001 --netdev_add t1001

 

# Bring up the taps

sudo vzctl exec 1000 ifconfig t1000 10.1.1.1 up

sudo vzctl exec 1001 ifconfig t1001 10.1.1.2 up

 

---------- End Snippet ----------

Jinxue Zhang

unread,
Jan 9, 2010, 7:10:43 AM1/9/10
to ns-3-...@googlegroups.com
It seems that tun/tap devices created at HN can't be added to the VPS in OpenVZ. I have tried it, with the error:


root# vzctl set 101 --netdev_add tap101
root# Bad parameter for --netdev_add: tap101

And also there is a thread from OpenVZ community to confirm this restriction: http://forum.openvz.org/index.php?t=msg&goto=27326&&srch=netdev_add#msg_27326.

Now the situation of ns-3 for OpenVZ is:
1. If we want to use UseLocal mode, a Tap device needs to be created in HN and moved to VPS. But OpenVZ doesn't support this;
2. If we want to use UseBridge mode, STA node in Wi Fi needs support SednFrom() method. Yet this is not supported by ns-3.

Is that right? and any suggestion?

Best wishes!

Jinxue Zhang

Tom Henderson

unread,
Jan 9, 2010, 6:09:02 PM1/9/10
to ns-3-...@googlegroups.com
On 1/9/10 4:10 AM, Jinxue Zhang wrote:
> It seems that tun/tap devices created at HN can't be added to the VPS in
> OpenVZ. I have tried it, with the error:
>
>
> root# vzctl set 101 --netdev_add tap101
> root# Bad parameter for --netdev_add: tap101
>
> And also there is a thread from OpenVZ community to confirm this
> restriction:
> http://forum.openvz.org/index.php?t=msg&goto=27326&&srch=netdev_add#msg_27326
> <http://forum.openvz.org/index.php?t=msg&goto=27326&&srch=netdev_add#msg_27326>.

>
> Now the situation of ns-3 for OpenVZ is:
> 1. If we want to use UseLocal mode, a Tap device needs to be created in
> HN and moved to VPS. But OpenVZ doesn't support this;
> 2. If we want to use UseBridge mode, STA node in Wi Fi needs support
> SednFrom() method. Yet this is not supported by ns-3.
>
> Is that right? and any suggestion?

Craig knows more about this than I do, but tap appears to interact badly
with OpenVZ. It is possible to work around this restriction but the
system is very fragile and I wouldn't recommend it. So, probably the
documentation should not recommend OpenVZ when discussing use of TapBridge.

We have had much better success using netns than OpenVZ with ns-3.

- Tom

Jinxue Zhang

unread,
Jan 14, 2010, 6:08:25 AM1/14/10
to ns-3-...@googlegroups.com
So how to run Java applications on ns-3 MANET platform? Has anybody do this kind of practice?

Thanks very much!
Jinxue Zhang

Jinxue Zhang

unread,
Jan 16, 2010, 9:16:03 AM1/16/10
to ns-3-...@googlegroups.com
Hi Craig and all,
     Is it possible to create a mode in which TapBridge bridges to the OS bridge directly? The potential supports are:
  1. In the UseBridge mode now, IPC also extends the OS bridge to add the tap-bridge in ns-3
  2. In this new mode, there is one-to-one correspondence between Linux host and ns-3, resulting in adopting existing UseLocal mode
      Then we can solve the ns-3 emulation in openVZ by bridging. Is it reasonable?

      Best wishes
      Jinxue Zhang
Reply all
Reply to author
Forward
0 new messages