Add multiple interface support in NS-2.33
Introduction:
Codes in this archive add multiple interface support in NS-2.33. I accomplished this work, thanks to Ramon's notes (http://personales.unican.es/aguerocr/). There are many places need to be modified, and there is one line need to be deleted form the legacy tcl code not be pointed out in Ramon's notes, I spent a lot of time to get it worked successfully. Therefor, I decided to share these codes with others who have the same requirement for NS
How to use:
Copy dirs in ns-2.33 to your own ns-2.33, then "make clean", "make"
Use "ns multi/single-interface.tcl" in example dir to run the simulation
Notice:
1. Single-interface scenario could be demonstrated correctly by nam, while multi-interface's nam file has some errors. However, the trace file of the multi-interface scenario shows that the multi-interface module works correctly. From the trace file we could find out that node 1 received data from mac address 0, and then forwarded to node 2. Node 2 received tcp packets from source MAC address 2, while in single-interface scenario the source MAC address would be 1.
Node 0 Node 1 Node 2
channel 0 channel 0 channel 2 channel 2
MAC 0 MAC 1 MAC 2 MAC 3
2. For the single-interface scenario, code generated by NSG2 or NSBench works well. However, for the multi-interface scenario, there would be some constraints for the variabe names in the scenario script.
1. set ns_ [new Simulator] ;# The simulator instance's variabe name must be ns_
2. set tracefd [open multi-interface.tr w] ;# The trace file handle's variabe name must be tracefd
,把这里改好,终于可以看到多接口收发的效果了。
最新评论