how to remove a node from routing table

421 views
Skip to first unread message

Bilal Erman Bilgin

unread,
Apr 27, 2017, 8:35:04 AM4/27/17
to Network Simulator 2 (NS2)
Hello,

I have 10 nodes. For example sender is node 0 and receiver is node 8 and there node 5 is the malware node.
Since node 5 is between node node 0 and node 8, it is in the routing table.
I want to remove node 5 from routing table. Therefore the other nodes won't consider the reply from node 5.


knudfl

unread,
Apr 27, 2017, 12:58:23 PM4/27/17
to Network Simulator 2 (NS2)
I guess you can set the node (5) to idle (sleep) for a long time. ( Or for infinity ∞ ? ).
Idle http://stackoverflow.com/questions/33212410/how-to-set-a-node-to-sleep-in-ns2

Or you can stop the node :
https://askubuntu.com/questions/687596/how-to-set-a-node-to-sleep-in-ns2

set   Netif_0     [$node_(5) set netif_(0)]

I tried making an example : mal_mohawad_node5-off.tcl  (Attached.)
( The file mohawad-blackh.tcl was edited to "malicious" etc.)
... Be aware that the in the code I have used, malicious is defined as hacker.

-----------------------------------------------
mal_mohawad_node5-off.tcl

Bilal Erman Bilgin

unread,
Apr 27, 2017, 1:46:34 PM4/27/17
to Network Simulator 2 (NS2)
Hi,

netif_(0) isnt worked.
When I, write like "$ns at 2.5 {[$n5 set netif_(0)] set Pt_ 0.0001}" it worked.
I added the my tcl file. It works with "blackhole-MohitTahiliani__ns235.patch" that you post before.

But I want to make this improvement in aodv.cc file.

I added extra parameter in aodv_packet.h file. Like your old post in blackhole (mohittahiliani sample), I passed parameter like malicious in tcl file. (ex: $ns at 0.0 "[$n5 set ragent_] hacker")
In aodv.cc, I checked that parameter and make that nodes extra parameter true.
In the recvAodv function, I want to make some modification. If that node has malicious value true, other nodes doesnt consider the reply from that node.

Could you help me, the modification is enough in aodvRecv or should I modify other functions?

27 Nisan 2017 Perşembe 19:58:23 UTC+3 tarihinde knudfl yazdı:
blackhole.tcl

knudfl

unread,
Apr 27, 2017, 3:14:56 PM4/27/17
to Network Simulator 2 (NS2)
Your file blackhole.tcl : This file name was used already many years ago. (A configuration file in the 2005 code.)
Suggest name = blackhole-B.tcl

I don't see any attacks with Mohit Tahiliani´s blackhole-M.tcl, or with your edited file :
$ ns235-blackh-Mohit blackhole-M.tcl
$ ns235-blackh-Mohit blackhole-B.tcl
.... No difference in the nam animation .... as far as I can see.

But with the other aodv "hacker" code from "aodv-malicious_ns235.patch" there is an attack / no attack, I think.
$ ns235-malicious mal_mohawad.tcl
$ ns235-malicious mal_mohawad_node5-off.tcl


aodv-malicious_ns235.patch https://drive.google.com/file/d/0B7S255p3kFXNU0VNbUtIWlJpRk0/view?usp=sharing

You could  do this : Set up another ns-allinone-2.35 for aodv-malicious_ns235.patch.
* You can have as many ns-allinone-2* as you want, installed at the same time.
* But do never add any *PATH text to .bashrc . Not required.
And keep all the executable´s 'ns-any-name' in /usr/local/bin/.

The file mal_mohawad.tcl + all hacker examples, aodv-malicious-examples-04.17.tar.gz : Attached.

--------------------------------------
mal_mohawad.tcl
aodv-malicious-examples-04.17.tar.gz

Bilal Erman Bilgin

unread,
May 1, 2017, 8:27:57 AM5/1/17
to Network Simulator 2 (NS2)
I have used your patch.
It adds bool malicious parameter in aodv constructor and in rt_resolve function it drops packets.
To overcome this blackhole attack i want to drop requests or reply from malicious node.

I tried the following but it is not rational.

In forward function in aodv.cc, it checks it broadcast or not.
If it is broadcast pck, Scheduler::instance().schedule(target_, p, 0.01 * Random::uniform()); function is called. I added extra control like 
if(!malicious)
  Scheduler::instance().schedule(target_, p, 0.01 * Random::uniform());

Is it ok? 

The second solution, I called schedule function whether it is malicious or not. But on the recvRequest function, I called rt_update if node is not malicious.

Which one is good solution?

27 Nisan 2017 Perşembe 22:14:56 UTC+3 tarihinde knudfl yazdı:

knudfl

unread,
May 1, 2017, 10:30:07 AM5/1/17
to Network Simulator 2 (NS2)
»» To overcome this blackhole attack «« :
? Have you studied IDS-AODV  https://www.google.com/webhp?hl=all&gws_rd=ssl#hl=en&q=idsaodv

Patch, idsAODV for Mohit Tahiliani´s blackhole :  idsAODV-for-M-blackholeaodv_ns235.patch
https://drive.google.com/file/d/0B7S255p3kFXNOTQ3V2IwQlRjbFU/view?usp=sharing

There is not yet a path for "maliciousAODV  patched  ns235"

These are available ...
Patch for the BlackholeAODV 2005 .. 2013 code : 1) idsAODV-2-for-blackhole2013-patched_ns235.patch
https://drive.google.com/file/d/0B7S255p3kFXNT0FjUTBTR21sMzg/view?usp=sharing

2)  idsAODV+blackholeaodv_ns234.patch
https://drive.google.com/file/d/0B7S255p3kFXNMTZjNE0xV3QxRW8/view?usp=sharing

Please read the patches to know how it's done.

Other info  https://groups.google.com/forum/#!searchin/ns-users/idsaodv%7Csort:date
-----------------------------------------
idsaodv2.tcl

Sanaa Jafar

unread,
Nov 3, 2021, 8:15:08 PM11/3/21
to Network Simulator 2 (NS2)

Hello.. when using this code set   Netif_0     [$node_(5) set netif_(0)], how do I make sure that it works correctly?
 Also, is this code set   Netif_0     [$node_(5) set netif_(0) useful to stop the selfish node after detected it in MANET?
Reply all
Reply to author
Forward
0 new messages