Hi Folks,
In this post I shall tell about how to display routing table of nodes while using AODV protocol. I read various tutorials online but most of them failed to exactly display the routing tables or were unable to exactly specify where to put the print_routing_table() function. And by using these methods I kept getting segmentation faults or huge files displaying routing tables even when the node count was 5 with only 1 traffic source. However i have used some of those tutorials and modded them to work fine “cuz u know no one writes code from scratch”. My grandfather did that and he is old by now.
Let’s begin:
Step 1) Open file aodv_rtable.h . Go to class aodv_rtable and in its public scope declare a member function
void rt_display(nsaddr_t id);
Step 2) Open file aodv_rtable.cc . Go to end and type this (read copy-paste 🙂 )
void
aodv_rtable::rt_display(nsaddr_t id)
{
FILE *dumpFile;
dumpFile = fopen("rtable.txt", "a+");
aodv_rt_entry *rt = rthead.lh_first;
for(; rt; rt = rt->rt_link.le_next) {
// You can add more route table entries if you want to. See aodv_rtable.h for more entries.
fprintf(dumpFile, "NODE: %d \t %f \t %d \t %d \t %d \t %d \t %.4f \t %d \n", id, CURRENT_TIME,
rt->rt_dst, rt->rt_nexthop, rt->rt_hops, rt->rt_seqno, rt->rt_expire, rt->rt_flags);
}
fclose(dumpFile);
}
Step 3) (Important One) Open file aodv.cc . Go to the function
AODV::rt_update(aodv_rt_entry *rt, .... )
At the end of inside this function call the rt_display() function as:
rtable.rt_display(index);
Step 4) Compile using make and sudo make install inside the ns-2.34 directory.
Step 5) run your tcl file (here is the file if u want to test). The rtable.txt should look like this rtable.txt ..
Hi, i was past the (Display Routing Table of AODV in ns-2.34) command to my system, it works properly. But rtable.txt does not create. suggest me how to print routing table.
Its urgent plz……….
The file rtable.txt will be created in your home directory. Check it there. It would not be created in the AODV folder
what does the call Agent/AODV print-stats actually means??
that has nothing to with printing of routing table. I had just added some code to print simple network statistics and i was calling it from the tcl file.
Thanks for the reply… But where have you added that print-stats function? whether in aodv.cc or somewhere else?? Also please let me know if it is possible to call a function (my own function) i ‘ve written in aodv.cc from my tcl file… if so, how to make that call?
I tried these steps in ns2.33. No where its creating rtable.txt. plz help me! And i also want to create a txt file to print the path btwn source and destination.
the rtable.txt shall be in your home directory. Only after running ur simulations you will be able to get this file.
Thank you!! rtable.txt is created 🙂
Do u hav coding for Implementation of ACO for routing in MANET…
Its urgent plz reply
@sowmya plz refer this blog http://antnetalgorithm.blogspot.in/2012/08/antnet-algorithm-source-code-on-github.html i hope it will help u furthure details you mail to viratharish921@gmail.com
Hello,
I need to print all neighbor of the node in aodv protocol. I have tried above procedure but the file is not created. And i have also tried rt->rt_nexthop gives only one next hop node. Please
Please help me….
it is not working on ns2.35….. plz help
it is working in ns2.35 .My rtable.txt file is generated in the location where my tcl script lays
May u explain rtable.txt file in which which column represent node and hope
rtable.txt is not generated in home directory in ns2.35
i have followed all steps. but no option no save copied code..
secondly make command isn’t working
error :make: *** No rule to make target `install’. Stop.
@ Muhammad Waleed Aftab first install your ns 2 packages correctly then u follow these instructions ok thk u
what is representation of routing table files…generated.
it works with me you should re make to save changes you’ve done by typing the following commands in ns2 directory in terminal “sudo make clean, sudo make , sudo make install” each one ata atime best wishes
thank u so much it is working!!!!!!!!
I have followed all the above steps in ns2.35 but i am unable to find the table.txt file please help me . I have a doubt in step 4 like we can run our .tcl code (ns simple-aodv.tcl) to get that table.txt file.
hello anyone plz explain me what is happening in rtable.txt thanks for advance
hai how can i add additional bits to routing table in aodv??
i have followed all the steps properly, but still m not getting “rtable.txt” file neither in the home directory nor in the folder containing the script. plzzz do suggest me the solution its urget
Hello please anyone tell me the c++ code for trust and print a trust table thanks in advance!!!!!!!!!!!!!!!!!!!
can you tell me what is the procedure of Display Routing Table of DSR in ns-2.35.
it’s urgent.
thanks in advance!!!!
how to print routing table for any other protocol like AntHocNet,protoname
how to print routing table for any other protocol like AntHocNet,Protoname .
Hello,
very thanks for your code.I need to print all neighbors of the node in aodv protocol. Please help me….(2.35)
Thanks for the post.
Can you tell me how to print residual energy of each node in the generated routing table?