Multi-hop in ns-3 Wifi

591 views
Skip to first unread message

compu...@gmail.com

unread,
Mar 30, 2016, 2:38:22 PM3/30/16
to ns-3-users
Hello,

I have a question regarding Wi-Fi implementation in ns-3. 

  I am trying to test the IEEE 802.11b module in ns-3. I am using OLSR routing protocol on top of UDP application. I want to have node 0 send packets to node 5 via 1, 2, 3 and 4, but multi-hop isn't working at all for the following configuration. In this case, no packets are getting received. 

positionAlloc->Add (Vector(0.0, 0.0, 0.0));  // Node 0
positionAlloc->Add (Vector(500.0, 0.0, 0.0));  // Node 1
positionAlloc->Add (Vector(1000.0, 0.0, 0.0));  // Node 2
positionAlloc->Add (Vector(1500.0, 0.0, 0.0));  // Node 3
positionAlloc->Add (Vector(2000.0, 0.0, 0.0));  // Node 4
positionAlloc->Add (Vector(2500.0, 0.0, 0.0));  // Node 5

  But, if I do the following configuration, node 0 sends it directly to node 5 and not via 1, 2, 3 and 4. 

positionAlloc->Add (Vector(0.0, 0.0, 0.0));  // Node 0
positionAlloc->Add (Vector(100.0, 0.0, 0.0));  // Node 1
positionAlloc->Add (Vector(200.0, 0.0, 0.0));  // Node 2
positionAlloc->Add (Vector(300.0, 0.0, 0.0));  // Node 3
positionAlloc->Add (Vector(400.0, 0.0, 0.0));  // Node 4
positionAlloc->Add (Vector(500.0, 0.0, 0.0));  // Node 5  

  Can someone please guide me about accomplishing multi-hop routing via any wireless routing protocol using ns-3?

Thanks
Sriram

Tom Henderson

unread,
Mar 30, 2016, 7:01:24 PM3/30/16
to ns-3-...@googlegroups.com
I just tried your above scenario using the provided
examples/wireless/wifi-simple-adhoc-grid.cc program.

I made these two changes:

- uint32_t sourceNode = 24;
+ uint32_t sourceNode = 5;

- "GridWidth", UintegerValue (5),
+ "GridWidth", UintegerValue (6),

and then I ran it like this:

./waf --run "wifi-simple-adhoc-grid --distance=500 --numNodes=6 --tracing=1"

To inspect the path of the Udp packet, I then searched the trace file
produced as follows:

grep Udp wifi-simple-adhoc-grid.tr | grep -v olsr

It seems from this trace that the Udp packet goes hop-by-hop from node 5
to node 0.

If there is some behavior that you think is wrong, however, please
provide us with a test program.

- Tom


compu...@gmail.com

unread,
Mar 31, 2016, 7:48:41 AM3/31/16
to ns-3-users
Hello Tom,

   Thank you so much for the reply. I am constructing a topology where nodes are randomly deployed instead of a grid topology. 

   I have attached two of my scripts along with this thread. 

   When I do LogComponentEnable(UdpClient)  and LogComponentEnable(UdpServer), am I right in saying that what I observe from the output is the end-to-end behavior but not the information at the intermediate nodes? Please clarify. 

    In general, how would I model a random topology in ns-3? Can you please guide me on this?

   Again, thank you so much for all your help. 

Sriram
wifi_random5.cc
wifi_random4.cc

Konstantinos

unread,
Mar 31, 2016, 8:02:19 AM3/31/16
to ns-3-users
Hi Sriram,

The two scenarios you have attached do not have 'random' deployment. They are in a line, which can be represented in principle as a grid with only 'one grid'.
If you want to have a random deployment, you need to use one of the random position allocators. Details are included in the documentation (https://www.nsnam.org/docs/models/html/mobility.html)
  • RandomRectanglePositionAllocator
  • RandomBoxPositionAllocator
  • RandomDiscPositionAllocator

Also, from your setup, FlowMonitor is not expected to show any results. You have:
 if ((t.sourceAddress == Ipv4Address("10.1.1.1") && t.destinationAddress == Ipv4Address("10.1.1.25")) ||
(t.sourceAddress == Ipv4Address("10.1.1.11") && t.destinationAddress == Ipv4Address("10.1.1.15")) ||
(t.sourceAddress == Ipv4Address("10.1.1.21") && t.destinationAddress == Ipv4Address("10.1.1.5")))

There is no such pair/flow in your scenario. You only have six nodes, so IPs from 10.1.1.1 to 10.1.1.6 and a broadcast (which by default FlowMonitor does not classify)

As for the Logging of UdpClient, it is expected NOT to see intermediate nodes as the two applications (client/server) are installed at the end nodes and packets only reach the L3 of intermediate nodes where they are forwarded to next-hop. Hence, a L3 logging, as Tom suggested with e.g. OLSR, should give you intermediate nodes.

Regards,
K.
Reply all
Reply to author
Forward
0 new messages