sorry to be late.
the following patch your issue, which means LinuxStackHelper
with Ipv4AddressHelper::Assign() has some bug (in DCE side).
the order matters: it's annoying...
i will look at the issue and hopefully fix it soon.
--- pfctest3.cc.orig 2015-03-12 15:20:40.314630601 +0900
+++ pfctest3.cc 2015-02-15 04:40:58.679518132 +0900
@@ -103,15 +103,15 @@
//Assigns IP addresses to the three different networks.
Ipv4AddressHelper address;
- address.SetBase("192.168.1.0", "255.255.255.0");
- Ipv4InterfaceContainer centralInterfaces = address.Assign (centralDevices);
-
address.SetBase("192.168.2.0", "255.255.255.0");
Ipv4InterfaceContainer leftInterfaces = address.Assign (leftDevices);
address.SetBase("192.168.3.0", "255.255.255.0");
Ipv4InterfaceContainer rightInterfaces = address.Assign (rightDevices);
+ address.SetBase("192.168.1.0", "255.255.255.0");
+ Ipv4InterfaceContainer centralInterfaces = address.Assign (centralDevices);
+
-- Hajime
At Sat, 14 Feb 2015 09:09:57 -0800 (PST),
Esteban . Coma wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; UTF-8 (7bit)>]
> --
> 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.
> [1.2 <text/html; UTF-8 (quoted-printable)>]
>
> [2 printnode.sh <text/x-sh; US-ASCII (7bit)>]
> #!/bin/bash
>
> RED='\033[1;31m'
> GREEN='\033[1;32m'
> YELLOW='\033[1;33m'
> PURPLE='\033[1;35m'
> NC='\033[0m' # No Color
> SLASH="/"
> AUX=var/log/
> LC=${1: -1}
>
> if [ "$#" -ne 1 ]; then
> echo "Usage: $ ./printnode.sh <files-X>"
> exit -1
> fi
>
>
> if [ $LC == $SLASH ];
> then
> DIR=$1$AUX
> else
> DIR=$1$SLASH$AUX
> fi
>
> NODENUM=$(echo $DIR | head -c 7 | tail -c 1)
>
> echo -e "${RED}NODE: ${GREEN}$NODENUM ${NC}"
>
> for file in `ls $DIR`
> do
> #Get first char of string
> PL=$(expr substr $file 1 1)
> #Check if it is a number
> case $PL in [0-9]* )
> echo -e " ${YELLOW}$file/${NC}"
> for fich in `ls $DIR$file/`
> do
> case $fich in
> "cmdline")
> echo -n -e " ${PURPLE}CMDLINE: ${NC}"
> cat $DIR$file$SLASH$fich
> ;;
> "status")
> echo -e " ${PURPLE}STATUS: ${NC}"
> cat $DIR$file$SLASH$fich
> ;;
> "stderr")
> if [ -s $DIR$file$SLASH$fich ];
> then
> echo -n -e " ${PURPLE}STDERR: ${NC}"
> cat $DIR$file$SLASH$fich
> else
> echo -e " ${PURPLE}STDERR: ${NC}"
> fi
> ;;
> "stdout")
> echo -e " ${PURPLE}STDOUT: ${NC}"
> cat $DIR$file$SLASH$fich | awk '{print "\t" $0}'
> ;;
> esac
> done
> #Prints a line through the whole screen
> #Change the 1;31 for:
> # 31 -> red
> # 32 -> green
> # 34 -> blue
> printf '\e[1;31m%*s\n\e[0m' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
> ;;
> esac
> done
> [3 pfctest3.cc <text/x-c++src; US-ASCII (7bit)>]
> #include "ns3/network-module.h"
> #include "ns3/core-module.h"
> #include "ns3/internet-module.h"
> #include "ns3/dce-module.h"
> #include "ns3/applications-module.h"
> #include "ns3/csma-module.h"
> #include <fstream>
>
> //Intended Topology:
> //Extendible.
> //CSMA nodes (Ethernet-like network but without Collision Detection)
> // DataRate = 10 Mpbs
> // Delay = 0.2-0.3 ms
> //
> // 192.168.2.0 n1 n4 192.168.3.0
> // | 192.168.1.0 |
> //variable |--- n0 ------ n3 ---| variable
> // | |
> // n2 n5
>
> #define DEBUG 1
>
> using namespace ns3;
> using namespace std;
>
> NS_LOG_COMPONENT_DEFINE ("pfctest3");
>
>
> /*
> static std::vector<std::string> NodeIp(Ptr<Node> node)
> {
> std::vector<std::string> addresses;
> int nDevices = node->GetNDevices();
> Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> (); // Get Ipv4 instance of the node
> for (int i=0; i<nDevices; i++){
> Ipv4Address addr = ipv4->GetAddress (i, 0).GetLocal (); // Get Ipv4InterfaceAddress of xth interface.
> addresses.push_back(addr);
> }
> }
> */
> std::string Ipv4AddressToString (Ipv4Address ad)
> {
> std::ostringstream oss;
> ad.Print (oss);
> return oss.str ();
> }
>
>
> int main (int argc, char *argv[])
> {
> CommandLine cmd;
> cmd.Parse (argc, argv);
>
> int totalNodes = 6; //left+right+central
>
> if (totalNodes > 30){
> NS_LOG_ERROR ("ERROR: In this topology there can't be more than 30 nodes");
> exit(-1);
> }
>
> //Creates all the nodes together.
> NodeContainer nodes;
> nodes.Create (totalNodes);
>
> NodeContainer leftNodes;
> leftNodes.Add(nodes.Get(0));
> leftNodes.Add(nodes.Get(1));
> leftNodes.Add(nodes.Get(2)); //So it belongs to both .1 and .2 networks.
>
> NodeContainer centralNodes = NodeContainer (nodes.Get(2), nodes.Get(3));
>
> NodeContainer rightNodes;
> rightNodes.Add(nodes.Get(3)); //So it belongs to both .1 and .3 networks.
> rightNodes.Add(nodes.Get(4)); //So it belongs to both .1 and .3 networks.
> rightNodes.Add(nodes.Get(5)); //So it belongs to both .1 and .3 networks.
>
>
> //Installs the linux kernel in all nodes.
> DceManagerHelper dceManager;
> dceManager.SetNetworkStack ("ns3::LinuxSocketFdFactory", "Library", StringValue ("liblinux.so"));
> dceManager.Install (nodes);
>
> LinuxStackHelper stack;
> stack.Install (nodes);
>
> //Create the fast CSMA (100Mbit/s channel) and assign the nodes to it.
> CsmaHelper csmaFast;
> csmaFast.SetChannelAttribute ("DataRate", StringValue("100Mbps"));
> csmaFast.SetChannelAttribute ("Delay", StringValue("2ms"));
>
> NetDeviceContainer leftDevices = csmaFast.Install(leftNodes);
> NetDeviceContainer rightDevices = csmaFast.Install(rightNodes);
>
> //Create the slow CSMA (10Mbit/s channel) and assign the nodes.
> CsmaHelper csmaSlow;
> csmaSlow.SetChannelAttribute ("DataRate", StringValue("10Mbps"));
> csmaSlow.SetChannelAttribute ("Delay", StringValue("2ms"));
> //Same Delay value.
>
> NetDeviceContainer centralDevices = csmaSlow.Install(centralNodes);
>
>
> //Assigns IP addresses to the three different networks.
> Ipv4AddressHelper address;
>
> address.SetBase("192.168.1.0", "255.255.255.0");
> Ipv4InterfaceContainer centralInterfaces = address.Assign (centralDevices);
>
> address.SetBase("192.168.2.0", "255.255.255.0");
> Ipv4InterfaceContainer leftInterfaces = address.Assign (leftDevices);
>
> address.SetBase("192.168.3.0", "255.255.255.0");
> Ipv4InterfaceContainer rightInterfaces = address.Assign (rightDevices);
>
> //Populate routing tables.
> Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
> LinuxStackHelper::PopulateRoutingTables ();
>
>
> #if DEBUG
> DceApplicationHelper dce;
> ApplicationContainer apps;
>
> dce.SetStackSize (1 << 20);
>
> Ptr<Node> node = nodes.Get (5); // Get pointer to the node in container
> Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> (); // Get Ipv4 instance of the node
> Ipv4Address addr = ipv4->GetAddress (0, 0).GetLocal (); // Get Ipv4InterfaceAddress of xth interface.
> string str = Ipv4AddressToString (addr);
>
>
> // Launch iperf client on node 0
> dce.SetBinary ("iperf");
> dce.ResetArguments ();
> dce.ResetEnvironment ();
> dce.AddArgument ("-c");
> dce.AddArgument (str);
> dce.AddArgument ("-i");
> dce.AddArgument ("1");
> dce.AddArgument ("--time");
> dce.AddArgument ("10");
>
> apps = dce.Install (nodes.Get (0));
> apps.Start (Seconds (0.7));
> apps.Stop (Seconds (20));
>
> // Launch iperf server on node 1
> dce.SetBinary ("iperf");
> dce.ResetArguments ();
> dce.ResetEnvironment ();
> dce.AddArgument ("-s");
> dce.AddArgument ("-P");
> dce.AddArgument ("1");
>
> apps = dce.Install (nodes.Get (5));
>
> apps.Start (Seconds (0.6));
> #else
> std::cout << "TODO THIS STUFFZ" << "\n";
> #endif
>
> csmaFast.EnablePcapAll ("csmaFast-iperf");
> csmaSlow.EnablePcapAll ("csmaSlow-iperf");
>
> Simulator::Stop (Seconds (40.0));
> Simulator::Run ();
> Simulator::Destroy ();
>
> return 0;
> }