Multiple networks cause IP assignment problems

461 views
Skip to first unread message

gd

unread,
Feb 25, 2015, 8:41:02 AM2/25/15
to ns-3-...@googlegroups.com
Hi all,

I'm trying to set up two wireless networks (different SSIDs) to create interference as suggested in this topic: https://groups.google.com/forum/#!searchin/ns-3-users/interference/ns-3-users/nYXzW-7wfTc/dK3Mbvp_qUkJ. The problem is that when populating the routing table (Ipv4GlobalRoutingHelper::PopulateRoutingTables ()) the program crashes with the error "cond="!(networkHere == networkThere)", msg="GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion", file=../src/internet/model/global-router-interface.cc, line=843". The two network shouldn't have anything to do (/communicate) with one another; I just want to simulate interference.

I've already searched for it but most answers just say "something is wrong with your IP topology". That's probably the case with my experiment, but I can not identify the exact cause. It should be possible to set up two wireless networks in the same experiment, right?

As an attachment, you'll find my experiment myNetwork.cc: it's quite long, but you'll find the interesting part around line 381. If you want to execute it, you'll also need the attached MyApp.cc and MyApp.h files.

Can some help me out?

Kind regards,
Glenn
myNetwork.cc
MyApp.cc
MyApp.h

Tommaso Pecorella

unread,
Feb 25, 2015, 5:01:40 PM2/25/15
to ns-3-...@googlegroups.com
Hi,

you have some errors. I have spotted two of them, dunno if there are more.
The first problem is: the interference nodes are isolated (not connected with the rest of the network).
Simply remove GlobalRouting from them, it will fix the problem you are facing:
  /** Interference start **/
 
InternetStackHelper iStack;
 
Ipv4StaticRoutingHelper staticRouting;
  iStack
.SetRoutingHelper (staticRouting);
 
Ipv4InterfaceContainer iApInterface;

The next issue is: you didn't set the mobility or position on the "interfering" nodes. This will cause a segmentation fault.

More issues... dunno, I stopped at the second one.

Cheers,

T.

gd

unread,
Feb 26, 2015, 8:16:26 AM2/26/15
to ns-3-...@googlegroups.com
Hi Tommaso,

Thanks for your reply. I adjusted my code, but I'm not quite there yet. So when I remove the GlobalRouting and add the static routing, I also have to add routes manually? Or does it still happen automatically? (Btw, I want the two networks to be isolated from each other.)

So what I changed:

  InternetStackHelper stack;
  stack.Install (csmaNodes);
  stack.Install (wifiStaNodes);

  Ipv4AddressHelper address;

  // Create the wired addresses.
  address.SetBase ("10.1.0.0", "255.255.255.0");
  Ipv4InterfaceContainer csmaInterfaces;
  csmaInterfaces = address.Assign (csmaDevices);

  // Create the wifi addresses.
  address.NewNetwork();
  address.Assign (staDevices);
  address.Assign (apDevices);

  /** Interference start **/
  InternetStackHelper iStack;
  Ipv4StaticRoutingHelper staticRouting;
  iStack.SetRoutingHelper (staticRouting);
  Ipv4InterfaceContainer iApInterface;

  if (interference) {
    iStack.Install(iWifiStaNodes);
    iStack.Install(iWifiApNode);
    address.NewNetwork();
    address.Assign (iStaDevices);
    iApInterface = address.Assign (iApDevice);
  }

to

InternetStackHelper stack;
  Ipv4StaticRoutingHelper staticRouting; // added this
  stack.SetRoutingHelper (staticRouting); // added this
  stack.Install (csmaNodes);
  stack.Install (wifiStaNodes);

  Ipv4AddressHelper address;

  // Create the wired addresses.
  address.SetBase ("10.1.0.0", "255.255.255.0");
  Ipv4InterfaceContainer csmaInterfaces;
  csmaInterfaces = address.Assign (csmaDevices);

  // Create the wifi addresses.
  address.NewNetwork();
  address.Assign (staDevices);
  address.Assign (apDevices);

  /** Interference start **/
  InternetStackHelper iStack;
  Ipv4StaticRoutingHelper staticRoutingInterference; // added this
  iStack.SetRoutingHelper (staticRoutingInterference); // added this
  Ipv4InterfaceContainer iApInterface;

  if (interference) {
    iStack.Install(iWifiStaNodes);
    iStack.Install(iWifiApNode);
    address.NewNetwork();
    address.Assign (iStaDevices);
    iApInterface = address.Assign (iApDevice);
  }

and I removed the Ipv4GlobalRoutingHelper::PopulateRoutingTables (); line.

Executing my code like this doesn't work (no packets are sent, probably due to the fact that they are missing routes); do I manually have to add a route for each node?

Kind regards,
Glenn

PS: As an attachment, you'll find the complete file again.
myNetwork.cc

Tommaso Pecorella

unread,
Feb 26, 2015, 11:58:31 AM2/26/15
to ns-3-...@googlegroups.com
Hi,

I said to change *only* the lines I posted. The other nodes can (and should) use GlobalRouting. Otherwise they'll not transmit anything (unless you manually set the routing tables).

Have fun,

T.

gd

unread,
Feb 27, 2015, 8:33:19 AM2/27/15
to ns-3-...@googlegroups.com
Hi Tommaso,

Thank you again for your answer. I originally only changed those lines, but I was under the impression that nothing happened (no packets were sent at all). Now, after you reply I tried it again and checked some pcap files. It seems that the data on the interference network is sent now, that's good news! However, there is no traffic anymore in my "regular" network. Now, I looked on the global routing nsnam documentation page (https://www.nsnam.org/doxygen/group__globalrouting.html) and found this: 
The model assumes that all nodes on an ns-3 channel are reachable to one another, regardless of whether the nodes can use the channel successfully (in the case of wireless). 

This is not the case in my network as I try to simulate interference and as suggested in this topic https://groups.google.com/forum/#!searchin/ns-3-users/interference/ns-3-users/nYXzW-7wfTc/dK3Mbvp_qUkJ, the two networks should use the same channel instance... So I have nodes on the same channel belonging to different networks that are not reachable for one another (thus contradicting the global routing requirement). Will this have anything to do with it? (If so, how do you simulate that kind of interference in ns3?)

Thanks in advance,
Glenn
myNetwork.cc

Tommaso Pecorella

unread,
Feb 27, 2015, 10:57:46 AM2/27/15
to ns-3-...@googlegroups.com
Hi,

you may be right. Try removing GlobalRouting rom any STA and adding (manually) the AP as the default gateway.

Cheers,

T.

gd

unread,
Mar 3, 2015, 8:15:40 AM3/3/15
to ns-3-...@googlegroups.com
Hi Tommaso,

I tried to do like you said so I removed the global routing completely and added the AP as the default route in the client and the server. But I'm running into problems with this static routing set-up no TCP packets are being sent. Looking at the pcap files it seems that the ARP requests from client to AP are received (which is a wireless connection) and the AP also sends ARP on the wired link, but the server never receives these ARP requests... I have no idea why. So, my topology looks like this (or should look like this):

( ( Client - 10.2.1.1 ))    wireless     (( [ 10.2.1.2 -- AP -- 10.1.1.1 ]    ----------- wired -------------  [ Server - 10.1.1.2 ]

So the AP has two IPs, one for the wireless subnet (10.2.1.2) and one for the wired subnet 10.1.1.1. And I add the AP as default route in my client and server.
I do not see any reason why the server does not receive the ARPs from the AP.

Do I need to add some more to make it work?

I attached my code as myNetwork-simple.cc (I ditched a lot of the other code which isn't important for this problem and which makes it more readable). I also attached the pcap files.

Thanks in advance,
Glenn
myNetwork-simple.cc
myNetwork-csma-ap-0-1.pcap
myNetwork-csma-server-1-1.pcap
myNetwork-phy-ap-0-2.pcap
myNetwork-phy-client-2-1.pcap

Tommaso Pecorella

unread,
Mar 3, 2015, 9:06:34 AM3/3/15
to ns-3-...@googlegroups.com
Hi,

you shouldn't install the csma in the two nodes separately. This will install two CsmaNetDevices but they'll not share the channel (basically they'll not be connected).
You have to create a NodeContainer with both nodes and then use the CsmaHelper's install on that.

Cheers,

T.

gd

unread,
Mar 3, 2015, 10:29:14 AM3/3/15
to ns-3-...@googlegroups.com
Hi Tommaso,

Again thank you for the answer; indeed, the ARPs are reaching the server node now. However, now there's something wrong with the TCP connection. A TCP syn is sent from the server, to which the client responds with a TCP reset (and ack) message, to which the server again answers with a TCP reset message and then they're done (no packets are sent)... I never experienced these problems in the past with the TCP socket, so I suspect it having to do with the recent changed I made to "fix" the routing...

Again, I attached the .cc and pcap.

Thanks in advance,
Glenn
myNetwork-csma-ap-0-1.pcap
myNetwork-csma-server-1-1.pcap
myNetwork-phy-ap-0-2.pcap
myNetwork-phy-client-2-1.pcap
myNetwork-simple.cc

gd

unread,
Mar 3, 2015, 3:16:54 PM3/3/15
to ns-3-...@googlegroups.com
Hi,

An update on the information I gave on the TCP error I'm encountering. I said that the TCP SYN came from the server, that is wrong: it is coming from the client (to which the server responds with a TCP SYN + ACK after which the client responds back with a TCP ACK). When I put on logging of the TCPSocketBase, I get following output:

2 [node 0] CLOSED -> LISTEN
2 [node 2] Node 2 calculated wscale factor of 2 for buffer size 131072
2 [node 2] 2 Send a scaling factor of 2
2 [node 2] 2 Add option TS, ts=2000 echo=0
2 [node 2] CLOSED -> SYN_SENT
2.0255 [node 2] SYN_SENT -> CLOSED

Strangely, I can not figure out when and where the RST+ACK sent from the server is sent (I can not find the method from where it is initiated). (The RST from the client is sent via the SendRST() function.)

Kind regards,
Glenn

Tommaso Pecorella

unread,
Mar 3, 2015, 4:13:27 PM3/3/15
to ns-3-...@googlegroups.com
The answer is inside you. However, it's the wrong one.

  // Create a packet sink.
 
ObjectFactory factory;
  factory
.SetTypeId ("ns3::PacketSink");
  factory
.Set ("Protocol", StringValue ("ns3::TcpSocketFactory"));
  factory
.Set ("Local", AddressValue (sinkAddress));


 
Ptr<PacketSink> sinkApp = factory.Create<PacketSink> ();
  wiredNodes
.Get(0)->AddApplication (sinkApp);
 
ApplicationContainer sinkApps(sinkApp);
  sinkApps
.Start (Seconds (simStart));
  sinkApps
.Stop (Seconds (simStop));

This is installing the Sink app in the AP node... and not in the server.
Don't worry, it's an error that everyone needs to do almost once in his/her life.

Cheers,

T.

gd

unread,
Mar 4, 2015, 8:11:17 AM3/4/15
to ns-3-...@googlegroups.com
Hi Tommaso,

Yes, that was it, thank you! I now succeeded in getting the two networks to run in parallel (and sending packets). However (yes, again there is an "however"...), the original goal of this all was to simulate interference as suggested in this topic https://groups.google.com/forum/#!searchin/ns-3-users/interference/ns-3-users/nYXzW-7wfTc/dK3Mbvp_qUkJ by Konstantinos (he said that interference should be possible when sharing the same Phy/Channel object among the networks). But when I use the same YansWifiPhyHelper (denoted as "phy" in my code) in both networks (the channel object is passed to the phy object so by using the phy object also for my interference network, the channel object should also be shared), nothing really happens anymore except for the AP sending their beacons (no association happens).

As an attachment you again find my .cc code (the interference network starts at line 595) and .pcap files.

Thanks in advance,
Glenn
myNetwork.cc
myInterference-phy-ap-3-1.pcap
myInterference-phy-client-4-1.pcap
myNetwork-csma-ap-0-1.pcap
myNetwork-csma-server-1-1.pcap
myNetwork-phy-ap-0-2.pcap
myNetwork-phy-client-2-1.pcap

Tommaso Pecorella

unread,
Mar 4, 2015, 8:35:54 AM3/4/15
to ns-3-...@googlegroups.com
Hi,

your code is missing stuff (e.g., the "CreateInterference" function is never called, and you misunderstood what Kostas was saying.
There should be interference doesn't means that there will be interference.
The interference is only if you have the same channel object and the same channel number. We stated that so many times in the past.
In that case packets will collide, and probably that's what you have: collisions.

Anyway, try debugging and fixing what's wrong, and take a special look at periodic messages: they could collide over and over.

Good luck,

T.

PS: no, inter-channel interference is NOT modeled yet.

gd

unread,
Mar 6, 2015, 9:53:47 AM3/6/15
to ns-3-...@googlegroups.com
Hi Tommaso,

The CreateInterference was never to be called as this was code I actually needed to remove; the actual interference code was actually somewhere else in the code. My apologies!
But in the meanwhile, I figured out the problem (with your help): indeed, the packets seemed to collide over and over, because when I increased the distance between the networks, the clients did sent and receive packets.

So thank you for all the help!

Kind regards,
Glenn

Qiqi Cai

unread,
Jul 21, 2016, 9:39:29 AM7/21/16
to ns-3-users
Hi gd, 
I noticed that you build a object staticRoutingAP, but you never use it . I don't know if this object is necessary.
Thanks,

Qiqi Cai

unread,
Jul 21, 2016, 10:03:00 AM7/21/16
to ns-3-users
Hi Tommaso,

I'm currently building a topology similar to this topology, but I added 2 switches, one of which is connecting 3 wireless networks(3 APs and their mobile stations). The other switch is connected to 2 csma nodes.
I got an issue that I could not install two NetDevices on one AP node, and I could not see 2 IP address of one AP, I used the `Ipv4StaticRouting` API but when I load the .xml file in NetAnim I still could only see 1 IP in `NetAnim Stats panel`. In the file 『goal-topo-ap3-wifi-4-2.pcap』, I could see from the output that 10.0.3.2 tries to send udp packet to 192.168.0.8, but it seems that packet was dropped?
I attched the .pcap file, .xml file and .cc source file. Could you please enlighten me where the problem lies?
Thanks,
goal-topo-ap3-wifi-4-2.pcap
goal-topo.cc
goal-topo.xml
Reply all
Reply to author
Forward
0 new messages