need some help in IPv6

278 views
Skip to first unread message

Agnes Ling

unread,
Apr 2, 2014, 7:45:56 AM4/2/14
to ns-3-...@googlegroups.com
HI everyone,


i have faced some problem in my program....

i had created 4nodes (which node0, node1, node2, node3) which can send packets to each others.And wanted to get the Tx,Rx and Throughput by using the Flowmonitor.

But there is a problem, it only can send the packets for not more than 2seconds (i.e it has stopped sending packets) . Perhaps, i have set the simulation time for 100seconds.

i tried to find and wanted  to fix the errors, but i still can't find where is the errors.

it just looks fine.

so, I need some guides here.... to point out where is my mistake.

can anyone please help me have a look on my program?

Thanks in advanced.

regards,
Agnes




v6.cc

Tommaso Pecorella

unread,
Apr 2, 2014, 4:09:42 PM4/2/14
to ns-3-...@googlegroups.com
Hi,

it seems correct, but it isn't. Of course (otherwise you wouldn't have posted).

  ping6.SetLocal (i1.GetAddress (0, 1));
  ping6
.SetLocal (i2.GetAddress (0, 1));

Setting the local address twice is a bad idea. Only the first one is correct (since you're installing the Ping application on node 0 of i1).

  i3.SetForwarding (1, true);
This should be:
  i3.SetForwarding (0, true);
Node 2 is the first one in i3. Since it's the node at the star center, all its interfaces should be forwarding.

There, all working as intended.

However, you'd better double check the source code before posting...
  monitor->SerializeToXmlFile("node2", true, true);
Monitor is not defined.

Moreover, the gnuplot part is just plotting an example graph, useless and confusing for whoever was debugging it (I needed a good 5 seconds to figure out it was useless).

Last but not least, I added FlowMonitor to it. Of course it's showing nothing. Zero. No packet traced.
Error? Bug? Nope, a feature.
ICMP isn't tracked by FlowMonitor, so there's nothing to track, and no results.

Hence, before you ask about it... you have to use UDP or TCP to see something tracked by FlowMonitor.

And before you (or someone) ask this one... No, I'm not going to add support to ICMP in FlowMonitor. The reason is: ICMP packets are not a "flow", they're just single packets. There's no real way to say if two ICMP packets are part of a flow, as there's no port in ICMP, and without ports there's no flow.


Cheers,

T.

Agnes Ling

unread,
Apr 8, 2014, 12:19:42 PM4/8/14
to ns-3-...@googlegroups.com
Hi Tommaso,


I have one question here.


How can i edit my coding so that the Node 0 will send the packet to Node1 through Node2 start from the beginning til end of simulation time?

I have tried for few times, but there are no any changes. Still the same as before the nodes will sent packets to each other.

But at 2 second, only node 0 is sending packet to node2 til the end of simulation time.

so, can u please guide me here?


thanks in advance.

Regards,
Agnes

Tommaso Pecorella

unread,
Apr 8, 2014, 12:44:50 PM4/8/14
to ns-3-...@googlegroups.com
Hi,

can you please reformulate the question ? I'm deeply sorry but I didn't understand what's the problem and what you want to have.

Cheers,

T

Agnes Ling

unread,
Apr 9, 2014, 5:59:24 AM4/9/14
to ns-3-...@googlegroups.com
Hi Tom,

so sorry for late reply..

I have fixed the problem...

would like to ask you, do you have any recommended method for me to collect the throughput , delay, and etc, for ipv6?

regards,
Agnes

Tommaso Pecorella

unread,
Apr 9, 2014, 4:33:04 PM4/9/14
to ns-3-...@googlegroups.com
Hi,

I'd say FlowMonitor... update to the latest ns-3-dev and apply this patch.

Cheers,

T.
Ipv6FlowMon.diff

Agnes Ling

unread,
Apr 10, 2014, 1:16:47 AM4/10/14
to ns-3-...@googlegroups.com
Hi Tom,

i have applied the patch.

but still i can't get any result.

i had included the below coding in my program,

#include "ns3/flow-monitor-module.h"
#include "ns3/flow-monitor-helper.h"

bool enableFlowMonitor = false;
  cmd.AddValue ("EnableMonitor", "Enable Flow Monitor", enableFlowMonitor);

 FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor = flowmon.InstallAll ();


monitor->CheckForLostPackets ();
  Ptr<Ipv6FlowClassifier> classifier = DynamicCast<Ipv6FlowClassifier> (flowmon.GetClassifier ());
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator iter = stats.begin (); iter != stats.end (); ++iter)
    {
 Ipv6FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);

      if (t.sourceAddress == Ipv6Address("2001:1::") && t.destinationAddress == Ipv6Address("2001:2::"))
        {
     NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress);
     NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets);
     NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets);
     NS_LOG_UNCOND("Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024  << " Kbps");
        }
    }
 
can you please point out where is my mistake ?


Thanks,

Regards,
Agnes

Tommaso Pecorella

unread,
Apr 10, 2014, 2:32:52 AM4/10/14
to ns-3-...@googlegroups.com
Hi,

no wonder it doesn't show anything...

     if (t.sourceAddress == Ipv6Address("2001:1::") && t.destinationAddress == Ipv6Address("2001:2::"))

You're comparing a source address with a network address. This will always be false. Try printing all the flows, it should show you what's being transmitted and received.

Also, mind that ICMPs are not tracked. As a consequence, if you're using Ping... nothing will be shown.

Cheers,

T.

Agnes Ling

unread,
Apr 10, 2014, 8:59:42 AM4/10/14
to ns-3-...@googlegroups.com
Hi Tom,

Thanks for replying...

I don't understand about the Ping...

Does it mean i should not use Ping6 in my program?


regards,
Agnes

Tommaso Pecorella

unread,
Apr 10, 2014, 3:29:23 PM4/10/14
to ns-3-...@googlegroups.com
Hi,

you can use Ping6, but FlowMonitor will not track it. Ping6 is using ICMP Echo for the ping, so it's not tracked. Just that.
In order to "see" something with FlowMonitor, you'll have to use UDP or TCP. As an example, you can use UdpClient and UdpServer.

Cheers,

T.

Agnes Ling

unread,
Apr 13, 2014, 1:43:56 AM4/13/14
to ns-3-...@googlegroups.com
Hi Tommaso,

i have used "udp-client-server.cc" as my reference to change from ICMP to Udp...

And also applied Flowmonitor in my program.

But i still can't get any results from Flowmonitor after i had compiled it and the terminal shows the below comment til the simulation time end..
 
    :
    :
    :

TraceDelay TX 1024 bytes to 10.1.1.2 Uid: 1090 Time: 990
TraceDelay TX 1024 bytes to 10.1.1.2 Uid: 1091 Time: 991
TraceDelay TX 1024 bytes to 10.1.1.2 Uid: 1092 Time: 992
TraceDelay TX 1024 bytes to 10.1.1.2 Uid: 1093 Time: 993
TraceDelay TX 1024 bytes to 10.1.1.2 Uid: 1094 Time: 994
TraceDelay TX 1024 bytes to 10.1.1.2 Uid: 1095 Time: 995
    :
    :
    :


here i have attached my latest coding...


can you please point out where is my mistake?


thanks in advanced.

regards,
Agnes
node2.cc
Screenshot from 2014-04-13 13:42:12.png

Tommaso Pecorella

unread,
Apr 13, 2014, 6:50:58 AM4/13/14
to ns-3-...@googlegroups.com
Hi,

no, the simulation isn't ending at all.

Next time you post code, make sure you have identified the issue. Moreover, there are so many problems in your code that... well, let's say I was astonished.

1) AnimationInterface WARNING:Node:0 Does not have a mobility model. Use SetConstantPosition if it is stationary
This have a meaning. And it's a problem.

2) Simulation::Stop() have to be called before Simulation::Run() - otherwise the simulation will not stop.

3) bool useV6 = false; but at the end of the script...  Ptr<Ipv6FlowClassifier> classifier = DynamicCast<Ipv6FlowClassifier> (flowmon.GetClassifier ());
Which is wrong in any case, as it would have to be flowmon.GetClassifier6 ()

4) There's no routing protocol, and no manual routing injection.

5) Node forwarding is not set. In IPv6 this means that no node will be forwarding.

Shall I continue ? I could...

Debug your program. The fact that it's compiling doesn't mean it's right.

T.

Agnes Ling

unread,
Apr 15, 2014, 12:17:11 PM4/15/14
to ns-3-...@googlegroups.com
Hi Tom,

 sorry about that. i m newbie for using NS3 and still learning how to write a coding for IPv6.

 i have a question here..

from the example "udp-client-server.cc" , the way of declaring for creating nodes and channels.

"  NodeContainer n;
    n.Create (4);
   InternetStackHelper internet;
  internet.Install (n);
   :
   :
   NetDeviceContainer d = csma.Install (n)

   ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
      Ipv6InterfaceContainer i6 = ipv6.Assign (d);
      serverAddress = Address(i6.GetAddress (1,1));  " " 

 while the way i had declared for  the nodes and channels
 "
  NS_LOG_INFO ("Create nodes.");
  Ptr<Node> n0 = CreateObject<Node> ();
  Ptr<Node> n1 = CreateObject<Node> ();
  Ptr<Node> n2 = CreateObject<Node> ();
  Ptr<Node> n3 = CreateObject<Node> ();

  NodeContainer net1 (n0, n2);
  NodeContainer net2 (n1, n2);
  NodeContainer net3 (n2, n3);
  NodeContainer all (n0, n1, n2, n3);
 
  NS_LOG_INFO ("Create IPv6 Internet Stack");
  InternetStackHelper internetv6;
  internetv6.Install (all);
    :
    :
    :
   NetDeviceContainer d1 = csma.Install (net1);
  NetDeviceContainer d2 = csma.Install (net2);
  NetDeviceContainer d3 = csma.Install (net3);

  NS_LOG_INFO ("Create networks and assign IPv6 Addresses.");
  Ipv6AddressHelper ipv6;
  ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
  Ipv6InterfaceContainer i1 = ipv6.Assign (d1);
  i1.SetForwarding (1, true);
  i1.SetDefaultRouteInAllNodes (1);

 
  ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
  Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
   i2.SetForwarding (1, true);
  i2.SetDefaultRouteInAllNodes (1);  
    :
   :
   :

  ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
      Ipv6InterfaceContainer i6 = ipv6.Assign (d);
      serverAddress = Address(i6.GetAddress (1,1));  ""  "



of course there is an error because i did not declare what is "d"  ( "Ipv6InterfaceContainer i6 = ipv6.Assign (d); )"

so, can u please guide me how can i declare code together correctly?

 can i just  replace "d" by one of my NetDevicecontainer (d1, d2 ,or d3) ? or i should use  the declaration for nodes and channels as in the example?



regards,
Agnes

Tommaso Pecorella

unread,
Apr 15, 2014, 4:04:16 PM4/15/14
to ns-3-...@googlegroups.com
Hi Agnes,

I'm tempted to let you find all the (other) issues my yourself, but I think it would be a bit evil.
  • The "Assign" method have to be called on each NetDeviceContainer separately. That's because each NetDeviceContainer represent a different LAN, and each LAN will need its own subnet.
  • The 3rd "LAN" have the nodes position switched, so the router is the "0" in the container, while in the others it's the "1"
  • Thanks to the one-hop, you don't need any real routing. The only router is connected directly to all the networks, so it will do its job even if you don't specify an explicit routing table. Luck.
  • It will not work anyway. Because...
    • You did set the csma MTU to 100 bytes. IPv6 requires a 1024 minimum MTU.
Said so, attached you'll find the working version. Check the differences and understand them.

Cheers,

T.
node2.cc

Cuong Uong

unread,
May 6, 2014, 4:20:45 AM5/6/14
to ns-3-...@googlegroups.com
Hi Tommaso!
Can u tell me how to apply this patch? I don't know how to do.
Thank u very much.

Vào 03:33:04 UTC+7 Thứ năm, ngày 10 tháng tư năm 2014, Tommaso Pecorella đã viết:

Tommaso Pecorella

unread,
May 6, 2014, 4:38:44 AM5/6/14
to ns-3-...@googlegroups.com
Hi,

sorry, which patch in particular ?

T.

Mr. Uông

unread,
May 6, 2014, 5:38:36 AM5/6/14
to ns-3-...@googlegroups.com
It's Ipv6FlowMon.diff for IPv6. 
Thanks!


--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, 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.

Ipv6FlowMon.diff

Tommaso Pecorella

unread,
May 6, 2014, 6:11:02 AM5/6/14
to ns-3-...@googlegroups.com
Hi,

that patch requires other ones to be applied first. The best thing to do is to use ns-3-dev, where all those patches have been already merged, or 3.20 (which will be released soon).

Hope this helps,

T.
Message has been deleted

Jiping Li

unread,
Jul 24, 2019, 5:11:01 AM7/24/19
to ns-3-users
Dear Tom,

Thanks for your reply and upload the demo program node2.
Now i plan to simulate a lr-wpan (WSN) with 6 nodes, n0-n4 for senders, and n5 for sink.
To calculate the throughput of sink. Based on your uploaded demo node2, i develop my
program, which is posted.

when it runs on the computer, errors occur as "assert failed. cond="ipv6", msg="Ipv6AddressHelper::Allocate (): Bad ipv6", file=../src/internet/helper/ipv6-address-helper.cc, line=222
terminate called without an active exception
Command ['/home/oucljp/ns-allinone-3.29/ns-3.29/build/scratch/throughput_based_node2'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>")."


i tried to find and wanted  to fix the errors, but i still can't find where is the errors. 

so, I need some guides here.... to point out where is my mistake.

can anyone please help me have a look on my program?

Thanks in advanced.

regards,
ping

在 2014年4月16日星期三 UTC+8上午4:04:16,Tommaso Pecorella写道:
throughput_based_node2.cc
Reply all
Reply to author
Forward
0 new messages