IP address usage while installing onoff or udp application on NS-3

55 views
Skip to first unread message

Mallesh Yadhav

unread,
Jun 19, 2015, 9:46:13 AM6/19/15
to ns-3-...@googlegroups.com
Hi,

       I am trying to install applications based on source and destination ip addresses including port numbers, rather than based on the node container or node ids. Is there any way to do this. Please let me know.

Thanks & regards,
     Mallesh

Konstantinos

unread,
Jun 19, 2015, 9:59:14 AM6/19/15
to ns-3-...@googlegroups.com, dasari.m...@gmail.com
What do you mean? You want to have an application pair between the nodes that have specific IPs e.g. you want source the node with IP 10.10.10.10 and destination the one with 9.9.9.9? I can not understand the port number part of the question. When you create an application you specify on which IP/port it will send or receive traffic. 

-- In a generally small/non-complex scenario, and since you define the IPs, you know beforehand which node has which IP.
-- If your scenario is more complex and/or the IP assignment is not standard, then you need to create a 'look-up' method to match an IP to a Node. It has been discussed several times in the list how you can get a node from an IP.

In any case, applications are installed on nodes, not on IPs. How you identify the node based on IP or node ID is your design.

Regards,
K.

Mallesh Yadhav

unread,
Jun 19, 2015, 10:25:34 AM6/19/15
to ns-3-...@googlegroups.com, dasari.m...@gmail.com
Hi,

       Thank you very much for the quick response sir. I have the below code for application installation.


                 ApplicationContainer apps = server.Install (m_nodes.Get(serverNode));
                 apps.Start (Seconds (0+itr));
                 apps.Stop (Seconds (150+itr));
                 UdpClientHelper client (I.GetAddress (serverNode), port+itr*10);
                 client.SetAttribute ("MaxPackets", UintegerValue (numPackets));
                 client.SetAttribute ("Interval", TimeValue (interPacketInterval));
                 client.SetAttribute ("PacketSize", UintegerValue (packetSize));
                 apps = client.Install (m_nodes.Get(clientNode));
                 apps.Start (Seconds (1+10*itr));
                 apps.Stop (Seconds (140+itr));

      Here, instead of using "m_nodes.Get(serverNode)" in first line, I want to use the ip address of the server node.

Thanks & regards,
   Mallesh

Konstantinos

unread,
Jun 19, 2015, 10:35:37 AM6/19/15
to ns-3-...@googlegroups.com, dasari.m...@gmail.com
As I said in my previous post, applications are installed on nodes, hence you can not change this. This is the 'signature' of the method Install(). 

However, before this line, you can 'search' which node has the IP address you are interested and install the application on that node.

Mallesh Yadhav

unread,
Jun 22, 2015, 2:19:14 AM6/22/15
to ns-3-...@googlegroups.com, dasari.m...@gmail.com
Hi Konstantinos,

          Thanks for the reply. Basically I have multiple interfaces on nodes. Suppose if a Node with two interfaces of ips 10.10.1.1 and 10.10.2.1, when installing application from 10.10.2.2  to that node using node id, the destination is becoming 10.10.1.1 always instead of 10.10.2.1.

Please let me know what to do.

Thanks & regards,
  Mallesh

Tommaso Pecorella

unread,
Jun 22, 2015, 3:49:44 AM6/22/15
to ns-3-...@googlegroups.com
Hi,

you should triple check if you did fully understand how you install an application and what are your IP addresses. That's what you should do.

Examples of statements that needs to be fixed:

"when installing application from 10.10.2.2  to that node using node id"
You do not install an application FROM an address. The application constructor accepts an IP address and considers it as the IP address of the other node (the one to send the packets to).

"the destination is becoming 10.10.1.1 always instead of 10.10.2.1"
Again, YOU are defining the destination. if it's not what you are expecting it to be, then you did a mistake in the initialization.

Stop trying to do random stuff and use a scientific approach. Study the documentation and double check the parameters you are passing to the applications.

T.

Mallesh Yadhav

unread,
Jun 22, 2015, 4:34:26 AM6/22/15
to ns-3-...@googlegroups.com
Hi sir thank you very much for the response,

      I am using the below code.

                 ApplicationContainer apps = server.Install (m_nodes.Get(serverNode));
                 apps.Start (Seconds (0+itr));
                 apps.Stop (Seconds (150+itr));
                 UdpClientHelper client (I.GetAddress (serverNode), port+itr*10);
                 client.SetAttribute ("MaxPackets", UintegerValue (numPackets));
                 client.SetAttribute ("Interval", TimeValue (interPacketInterval));
                 client.SetAttribute ("PacketSize", UintegerValue (packetSize));
                 apps = client.Install (m_nodes.Get(clientNode));
                 apps.Start (Seconds (1+10*itr));
                 apps.Stop (Seconds (140+itr));

                 As you said, I am using node ids only. However, as I said, the nodes have two Net device instances having the subnet ips (10.10.1.0 and 10.10.2.0). If we give node ids, the application is always installing on device 1 i.e, on the first instance of 10.10.1.0. I want to install separate applications on two instances.

Tommaso Pecorella

unread,
Jun 22, 2015, 4:40:49 AM6/22/15
to ns-3-...@googlegroups.com
Deterior surdus eo nullus, qui renuit audire.
Please study your own code.

You are NOT using nodes IDs. You are using node's pointers.
What you are calling node IDs is just an index in the node container. What about changing that index? Have you even tried ?
Did you read (and understand) the tutorial? How to install applications on nodes is clearly explained there.

I start to suspect that you need a C++ book, as you seems to be confused on the language syntax and semantics.
Mind, there's nothing wrong in not being fluent in C++, but to write a ns-3 script you must understand C++ at least decently.

T.
Reply all
Reply to author
Forward
0 new messages