How to start Star-Bus Hybrid Topology Projects using NS3

Starting a Star-Bus Hybrid Topology Project in NS-3

To create the Star-Bus Hybrid Topology it combines the star topology in which devices are connected to a central hub by the bus topology that connects multiple hubs via a shared backbone. This architecture is general in large-scale networks such as LANs or enterprise configuration.

Steps to start Star-Bus Hybrid Topology Projects using NS3

Step 1: Set Up NS-3

  1. Install NS-3:
    • Download NS-3.
    • Build NS-3:

./waf configure

./waf build

  1. Verify Installation: Validate NS-3 with a basic example:

./waf –run scratch/my_first

Step 2: Understand Star-Bus Hybrid Topology

  • Characteristics:
    • Every star topology has contained the devices connected to a central hub.
    • Different hubs are interconnected utilized their bus (backbone) topology.
    • Delivers the scalability and fault tolerance.
  • Example:
    • The every three-star network through connected the four devices.
    • A common bus connects the hubs of every star.

Step 3: Plan the Topology

  1. Define the structure:
    • Number of star networks such as three stars.
    • Number of devices has contained the per star for sample four devices every.
    • Hubs are connecting their backbone.
  2. Set simulation goals:
    • Evaluate their throughput, delay, and fault tolerance.
    • Replicate their communication with stars.

Step 4: Set Up the Star-Bus Hybrid Topology

  1. Create Nodes: State the nodes for the star networks and backbone.

NodeContainer hubs, stars, backbone;

uint32_t numStars = 3;

uint32_t nodesPerStar = 4;

// Create hubs for each star

hubs.Create(numStars);

// Create nodes for the stars

stars.Create(numStars * nodesPerStar);

// Create nodes for the backbone (use the hubs as part of the backbone)

backbone.Add(hubs);

  1. Set Up Star Networks: Star networks are attaching the devices to their particular hubs are used in a point-to-point connection.

PointToPointHelper p2pStar;

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

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

NetDeviceContainer starDevices;

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

for (uint32_t j = 0; j < nodesPerStar; ++j) {

uint32_t nodeIndex = i * nodesPerStar + j;

NetDeviceContainer link = p2pStar.Install(hubs.Get(i), stars.Get(nodeIndex));

starDevices.Add(link);

}

}

  1. Set Up the Backbone (Bus): Connect the hubs utilized a set up the bus-like distribute the connection or point-to-point connections.

PointToPointHelper p2pBus;

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

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

NetDeviceContainer busDevices;

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

NetDeviceContainer link = p2pBus.Install(hubs.Get(i), hubs.Get(i + 1));

busDevices.Add(link);

}

  1. Install Internet Stack: Improve the Internet stack to overall nodes and allocate their IP addresses.

InternetStackHelper stack;

stack.Install(hubs);

stack.Install(stars);

Ipv4AddressHelper address;

// Assign IP addresses to star devices

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

Ipv4InterfaceContainer starInterfaces = address.Assign(starDevices);

// Assign IP addresses to bus devices

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

Ipv4InterfaceContainer busInterfaces = address.Assign(busDevices);

Step 5: Simulate Traffic

  1. Set Up Applications: State the congestion among devices in various star networks.
    • UDP Echo Example:

UdpEchoServerHelper echoServer(9); // Port 9

ApplicationContainer serverApp = echoServer.Install(stars.Get(0)); // Server on Node 0 of Star 1

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(starInterfaces.GetAddress(0), 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(stars.Get(nodesPerStar)); // Client on Node 0 of Star 2

clientApp.Start(Seconds(2.0));

clientApp.Stop(Seconds(10.0));

  1. Use Flow Monitor: Estimate the use flow monitor of throughput, delay, and packet loss.

FlowMonitorHelper flowmon;

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

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

Step 6: Run and Analyze

  1. Run the Simulation:

Simulator::Run();

Simulator::Destroy();

  1. Enable Packet Capture: Save .pcap files for traffic analysis.

p2pBus.EnablePcapAll(“star_bus_hybrid_topology”);

  1. Analyze Results: Used the analyse results for Flow Monitor of packet traces we estimate the performance.

Example: Minimal NS-3 Script for Star-Bus Hybrid 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 numStars = 3;

uint32_t nodesPerStar = 4;

// Create hubs and nodes

NodeContainer hubs, stars, backbone;

hubs.Create(numStars);

stars.Create(numStars * nodesPerStar);

backbone.Add(hubs);

// Configure point-to-point links for stars

PointToPointHelper p2pStar;

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

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

NetDeviceContainer starDevices;

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

for (uint32_t j = 0; j < nodesPerStar; ++j) {

uint32_t nodeIndex = i * nodesPerStar + j;

NetDeviceContainer link = p2pStar.Install(hubs.Get(i), stars.Get(nodeIndex));

starDevices.Add(link);

}

}

// Configure point-to-point links for the backbone (bus)

PointToPointHelper p2pBus;

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

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

NetDeviceContainer busDevices;

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

NetDeviceContainer link = p2pBus.Install(hubs.Get(i), hubs.Get(i + 1));

busDevices.Add(link);

}

// Install Internet stack

InternetStackHelper stack;

stack.Install(hubs);

stack.Install(stars);

Ipv4AddressHelper address;

// Assign IP addresses

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

Ipv4InterfaceContainer starInterfaces = address.Assign(starDevices);

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

Ipv4InterfaceContainer busInterfaces = address.Assign(busDevices);

// Set up UDP echo server and client

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApp = echoServer.Install(stars.Get(0));

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(starInterfaces.GetAddress(0), 9);

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

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

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

ApplicationContainer clientApp = echoClient.Install(stars.Get(nodesPerStar));

clientApp.Start(Seconds(2.0));

clientApp.Stop(Seconds(10.0));

// Enable Flow Monitor

FlowMonitorHelper flowmon;

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

monitor->SerializeToXmlFile(“star_bus_hybrid_flowmon

In the document brief procedure will clarify on how to simulate and evaluate the results using the tool of ns3 for Star-Bus Hybrid Topology projects in the topology environment. If you need specific details for concerning this project we will update in another report.

Kindly provide all relevant information regarding your project, and we will ensure that you achieve the most favorable results. Additional clarification will be provided in a separate manual if necessary. We encourage you to reach out to us concerning your simulation results.