Multiple Wifi interfaces on the same node

856 views
Skip to first unread message

Sonu Mishra

unread,
Nov 28, 2015, 4:56:21 AM11/28/15
to ns-3-users
Hi All,

Problem Statement: I have some randomly moving nodes of type A. In the same area there are two type B static nodes, n0 and n1 (very far from each other). I want n0 to send a message to n1 using type A nodes as routers. All communications are wireless, but channel c1 for type B<->type A communication HAS to be different from the c2 for type A<->type A communication.

One way would be to install channel c1 on ALL nodes and channel c2 on only type A nodes. 

Questions:
1. How can i create two wireless channels c1 and c2 that are orthogonal?
2. How to restrict type A nodes from using channel c2 for type A<->type A communication?

PS: I am new to NS-3, so some codes snippets will be highly appreciated.

Thanks for the help!





Tommaso Pecorella

unread,
Nov 28, 2015, 6:07:18 AM11/28/15
to ns-3-users
Hi,

answer to Q1 is: when you create the wifi NetDevice you have to set the channel. if you use different channels, they'll be orthogonal (no interference). As a consequence, the answer is simply: use two different Wi-Fi NetDevices.

Answer to Q2 is far more complex, and it can be summarized as: "you are not prepared". Literally.
In order to do what you're thinking you'll probably need a (multihop) routing algorithm, an addressing scheme, etc. First you must design your system (in a way that is reasonably right), then you'll have to implement it. No "snippets" can help you in this.
there could be an easy way to do this, but I'm not going to explain it (sorry) as it would be MY way, and not your. it's not a matter of coding, it's research.
I mean, one thing is to ask how to setup OLRS to use different interfaces, another thing is to build a whole system. isn't it ?

Summarizing: design first, then you'll find a way.

T.

Sonu Mishra

unread,
Nov 28, 2015, 2:15:10 PM11/28/15
to ns-3-users
Hi,
Thanks for Q1.

For Q2, my design is simple. I am using OLSR routing scheme. I have separate addresses for 

  NetDeviceContainer typeADevices = wifi_1.Install (wifiPhy, wifiMac, typeANodes); //wifi_1 has channel c1
  NetDeviceContainer allNodeDevices = wifi_2.Install (wifiPhy, wifiMac, allNodes); //wifi_2 has channel c2
  
    //Routing Scheme
  OlsrHelper olsr;
  Ipv4StaticRoutingHelper staticRouting;

  Ipv4ListRoutingHelper list;
  list.Add (staticRouting, 0);
  list.Add (olsr, 10);

  InternetStackHelper internet;
  internet.SetRoutingHelper (list);
  internet.Install (allNodes);
  
    //Addressing Scheme  
  Ipv4AddressHelper ipv4;
  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
  Ipv4InterfaceContainer typeAInterfaces = ipv4.Assign (typeADevices);
  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
  Ipv4InterfaceContainer allNodeInterfaces = ipv4.Assign (allNodeDevices);
  
  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
  Ptr<Socket> recvSink = Socket::CreateSocket (allNodes.Get (sinkNode), tid);
  InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
  recvSink->Bind (local);
  recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));

  Ptr<Socket> source = Socket::CreateSocket (allNodes.Get (sourceNode), tid);
  InetSocketAddress remote = InetSocketAddress (allNodeInterfaces.GetAddress (sinkNode, 0), 80);
  source->Connect (remote);

I have done this much. But if I run this, type A nodes will use wifi 2 channel. I don't know how to tell type A nodes to use only wifi 1 channel for type A<->A communication. So now my question is: How to setup OLRS to use different interfaces?

Thanks
Sonu Mishra

Tommaso Pecorella

unread,
Nov 28, 2015, 4:45:05 PM11/28/15
to ns-3-users
Hi,


You should have OLSR on all the TypeA interfaces, and consider the type B<->type A communication as a non-OLSR one.
The problem is... it won't work. Think to it: all the type A nodes will have an interface apparently able to route packets toward Type B nodes, and they'll try to use it even if there's no Type B node in proximity.

Moreover... are you sure it's a good idea to have 2 different interfaces on the very same network ? Think to it, one will never be used.
You should go back to the drawing board, I guess. A suggestion: this is NOT a simple routing problem. You'll have to poke the NetDevice status to know if you can use it or not.

T.

Sonu Mishra

unread,
Dec 2, 2015, 11:30:50 PM12/2/15
to ns-3-...@googlegroups.com
Hi Tomasso,

I understand your point. I had unnecessarily complicated the problem. All I wanted was to have the transmission range of type B nodes different from type A nodes -- they can use the same channel. 

So now I can merge the type A and B nodes into one container nodes. The scenario now reduces to what is given in examples/wifi/wifi-simple-adhoc.cc. But there are two problems:

1. How to reduce the transmission range or power of a particular node?
2. How to use the same code for TCP? If I change the "UdpFactory" to "TcpFactory", all packets get dropped.

Could you help me with these?

Sonu





Sonu K. Mishra
Graduate Student (MS)
UCLA Computer Science Dept
Los Angeles, CA, USA




--
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/Q2gNPX9caFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages