Dynamic Routing

45 views
Skip to first unread message

Amar Agrawal

unread,
Mar 28, 2014, 5:38:19 AM3/28/14
to ns-3-...@googlegroups.com
How to change the metric of node after 1s of simulation to send the packet from another path??

Konstantinos

unread,
Mar 28, 2014, 5:42:59 AM3/28/14
to ns-3-...@googlegroups.com
What type of routing do you use at the moment to route the packets? 

Amar Agrawal

unread,
Mar 28, 2014, 5:48:53 AM3/28/14
to ns-3-...@googlegroups.com
Sir I am using global routing to route the packets.


--
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/jZwnSyKYg14/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.

Konstantinos

unread,
Mar 28, 2014, 6:05:06 AM3/28/14
to ns-3-...@googlegroups.com
You can use the AddHostRouteTo to create a route to a specific IP.
I would suggest to remove the previous route first and then add the new. 

Example of creating a specific route (/examples/routing/static-routing-slash32) 
This is for static routing, but can be applied also in globalrouting because Ipv4GlobalRouting provides same methods.

In order to do that at a particular time, you need to use the Simulator::Schedule to create the event.


On Friday, March 28, 2014 9:48:53 AM UTC, Amar Agrawal wrote:
Sir I am using global routing to route the packets.

Amar Agrawal

unread,
Mar 28, 2014, 6:05:32 AM3/28/14
to ns-3-...@googlegroups.com
Sir scenario is like this.

n1-------2-------n2-------3-----n3
|_____1_____n4____2___|

I have used setMetric() for all the nodes. 
So at the starting in simulation its going through path n1->n2->n3 

Now after simulation I am changing the metric between nodes n1n2 to 1 and n2n3 to 1
So this time it going through path n1->n4->n3.

now I want to do both the things in one simulation.
Sir please tell me what function should I use to do it.

Konstantinos

unread,
Mar 28, 2014, 6:17:39 AM3/28/14
to ns-3-...@googlegroups.com


On Friday, March 28, 2014 10:05:32 AM UTC, Amar Agrawal wrote:
Sir scenario is like this.

n1-------2-------n2-------3-----n3
|_____1_____n4____2___|

I have used setMetric() for all the nodes. 
So at the starting in simulation its going through path n1->n2->n3 

Now after simulation I am changing the metric between nodes n1n2 to 1 and n2n3 to 1
So this time it going through path n1->n4->n3.
 

What do you mean AFTER the simulation ?
 
now I want to do both the things in one simulation.
Sir please tell me what function should I use to do it.


If you are using the SetMetric, then you can use this again.
Change the metric and re-calculate the routes using Ipv4GlobalRoutingHelper::RecomputeRoutingTables().
Using Simulator::Schedule() to do them after simulation has started.

Amar Agrawal

unread,
Mar 28, 2014, 6:25:51 AM3/28/14
to ns-3-...@googlegroups.com
Simulator::Schedule(Seconds(2.0),SetMetric,n1n4,0,6);
Simulator::Schedule(Seconds(2.0),SetMetric,n1n4,1,6);

I am writing this code but i am getting error. What I am doing wrong here?



Konstantinos

unread,
Mar 28, 2014, 6:36:07 AM3/28/14
to ns-3-...@googlegroups.com
Please refer to the ns-3 documentation for creating events and callbacks

Amar Agrawal

unread,
Mar 28, 2014, 6:43:21 AM3/28/14
to ns-3-...@googlegroups.com
Done!
Thank you sir for the links.


Reply all
Reply to author
Forward
0 new messages