How to Start Extended Bus Topology Projects Using NS3

To start Extended Bus Topology in NS3 that need to associates several bus segments to utilize the connected pointers like repeaters or bridges, to prolong the bus topology to include larger areas or accommodate additional nodes. It is mostly utilized within large-scale Local Area Networks (LANs). Below is a structured method to start and simulate the Extended Bus Topology Projects using NS3.

Steps to Start an Extended Bus Topology Project in NS3

Step 1: Set Up NS3

  1. Install NS3:
    • Go to NS3 website to download NS3.
    • Next, we can build NS3:

./waf configure

./waf build

  1. Verify Installation: Confirm NS3 including a simple example:

./waf –run scratch/my_first

Step 2: Understand Extended Bus Topology

  • Characteristics:
    • It integrates the many bus segments to prolonged structure.
    • In a linear bus structure, every single division includes several nodes that are associated within this topology.
    • Make use of some connected points like bridges, switches, or repeaters, segments are connected.

Step 3: Plan the Topology

  1. Define the structure:
    • We can describe the volume of bus segments that contains 3 segments.
    • Nodes for each bus segment have 4 nodes each.
  2. Decide connection points:
    • We need to choose the connected points like bridges or repeaters among the bus segments.
  3. Set simulation goals:
    • We estimate the performance metrics such as latency, throughput, and packet delivery over the extended topology.

Step 4: Set Up the Extended Bus Topology

  1. Create Nodes: We should describe the nodes per bus segment and bridges using the following code.

NodeContainer busSegments[3], bridges;

uint32_t nodesPerSegment = 4;

// Create nodes for each bus segment

for (uint32_t i = 0; i < 3; ++i) {

busSegments[i].Create(nodesPerSegment);

}

// Create bridges (or repeaters) to connect bus segments

bridges.Create(2); // Two bridges to connect three segments

  1. Set Up Bus Segments: Utilize point-to-point links, to associate the nodes in every single bus segment.

PointToPointHelper p2pBus;

p2pBus.SetDeviceAttribute(“DataRate”, StringValue(“1Gbps”));

p2pBus.SetChannelAttribute(“Delay”, StringValue(“2ms”));

NetDeviceContainer busDevices[3];

for (uint32_t i = 0; i < 3; ++i) {

for (uint32_t j = 0; j < nodesPerSegment – 1; ++j) {

NetDeviceContainer link = p2pBus.Install(busSegments[i].Get(j), busSegments[i].Get(j + 1));

busDevices[i].Add(link);

}

}

  1. Connect Bus Segments via Bridges: Link the one segment’s last node to the initial node of the afterward segment using bridges.

NetDeviceContainer bridgeDevices;

// Connect Segment 1 to Segment 2 via Bridge 1

bridgeDevices.Add(p2pBus.Install(busSegments[0].Get(nodesPerSegment – 1), bridges.Get(0)));

bridgeDevices.Add(p2pBus.Install(bridges.Get(0), busSegments[1].Get(0)));

// Connect Segment 2 to Segment 3 via Bridge 2

bridgeDevices.Add(p2pBus.Install(busSegments[1].Get(nodesPerSegment – 1), bridges.Get(1)));

bridgeDevices.Add(p2pBus.Install(bridges.Get(1), busSegments[2].Get(0)));

  1. Install Internet Stack: We want to insert the Internet stack to every node and bridge.

InternetStackHelper stack;

for (uint32_t i = 0; i < 3; ++i) {

stack.Install(busSegments[i]);

}

stack.Install(bridges);

Ipv4AddressHelper address;

// Assign IP addresses to bus segments

for (uint32_t i = 0; i < 3; ++i) {

std::ostringstream subnet;

subnet << “10.” << (i + 1) << “.1.0”;

address.SetBase(subnet.str().c_str(), “255.255.255.0”);

address.Assign(busDevices[i]);

}

// Assign IP addresses to bridge links

address.SetBase(“10.4.1.0”, “255.255.255.0”);

address.Assign(bridgeDevices);

Step 5: Simulate Traffic

  1. Set Up Applications: We can replicate the interaction among the nodes over various segments of bus topology.
    • UDP Echo Example:

UdpEchoServerHelper echoServer(9); // Port 9

ApplicationContainer serverApp = echoServer.Install(busSegments[0].Get(0)); // Server on Segment 1 Node 0

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(Ipv4Address(“10.1.1.1”), 9); // Server’s IP

echoClient.SetAttribute(“MaxPackets”, UintegerValue(10));

echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0)));

echoClient.SetAttribute(“PacketSize”, UintegerValue(1024));

ApplicationContainer clientApp = echoClient.Install(busSegments[2].Get(nodesPerSegment – 1)); // Client on Segment 3 Node 3

clientApp.Start(Seconds(2.0));

clientApp.Stop(Seconds(10.0));

  1. Use Flow Monitor: We follow the below command to calculate the performance metrics such as throughput, delay, and packet loss using Flow Monitor.

FlowMonitorHelper flowmon;

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

monitor->SerializeToXmlFile(“extended_bus_flowmon.xml”, true, true);

Step 6: Run and Analyze

  1. Run the Simulation:

Simulator::Run();

Simulator::Destroy();

  1. Enable Packet Capture: For traffic analysis, we can store .pcap files to seize packet.

p2pBus.EnablePcapAll(“extended_bus_topology”);

  1. Analyze Results: Measure the performance outcomes with the help of Flow Monitor and packet traces.

Example: Minimal NS3 Script for Extended Bus Topology

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/point-to-point-module.h”

#include “ns3/applications-module.h”

#include “ns3/flow-monitor-module.h”

using namespace ns3;

int main(int argc, char *argv[]) {

uint32_t numSegments = 3;

uint32_t nodesPerSegment = 4;

NodeContainer busSegments[3], bridges;

// Create nodes for each bus segment

for (uint32_t i = 0; i < numSegments; ++i) {

busSegments[i].Create(nodesPerSegment);

}

// Create bridges

bridges.Create(numSegments – 1);

// Configure point-to-point links for bus segments

PointToPointHelper p2pBus;

p2pBus.SetDeviceAttribute(“DataRate”, StringValue(“1Gbps”));

p2pBus.SetChannelAttribute(“Delay”, StringValue(“2ms”));

NetDeviceContainer busDevices[3];

for (uint32_t i = 0; i < numSegments; ++i) {

for (uint32_t j = 0; j < nodesPerSegment – 1; ++j) {

NetDeviceContainer link = p2pBus.Install(busSegments[i].Get(j), busSegments[i].Get(j + 1));

busDevices[i].Add(link);

}

}

// Connect bus segments via bridges

NetDeviceContainer bridgeDevices;

for (uint32_t i = 0; i < numSegments – 1; ++i) {

bridgeDevices.Add(p2pBus.Install(busSegments[i].Get(nodesPerSegment – 1), bridges.Get(i)));

bridgeDevices.Add(p2pBus.Install(bridges.Get(i), busSegments[i + 1].Get(0)));

}

// Install Internet stack

InternetStackHelper stack;

for (uint32_t i = 0; i < numSegments; ++i) {

stack.Install(busSegments[i]);

}

stack.Install(bridges);

Ipv4AddressHelper address;

for (uint32_t i = 0; i < numSegments; ++i) {

std::ostringstream subnet;

subnet << “10.” << (i + 1) << “.1.0”;

address.SetBase(subnet.str().c_str(), “255.255.255.0”);

address.Assign(busDevices[i]);

}

address.SetBase(“10.4.1.0”, “255.255.255.0”);

address.Assign(bridgeDevices);

// Set up UDP echo server and client

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApp = echoServer.Install(busSegments[0].Get(0));

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(Ipv4Address(“10.1.1.1”), 9);

In this manual, Extended Bus Topology project strategy has been laid out systematically using NS3 simulation tool that were simulated and evaluated the outcomes and we are prepared to offer additional insights if asked.

We take care of big Local Area Networks (LANs) and help you with the overall performance. If you send us the details of your Extended Bus Topology project, we can give you customized research support.