Bus Topology Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

DEPARTMENT OF INFORMATION AND ENGINEERING

NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY


(An Autonomous Institution)
KARNATAKA

NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY


(An AUTONOMOUS AFFILIATED TO VISVESVARAYA
TECHNOLOGICAL UNIVERSITY, BELAGAVI)

PB No. 6429, Yelahanka, Bengaluru 560064, Karnataka

REPORT ON COMPUTER NETWORKS (LA-2)


TOPIC: BUS TOPOLOGY

BACHELOR OF ENGINEERING
Information Science and Engineering
Submitted by:
SHRUTHA . K (1NT21IS157)
V. LIKHITHA CHOWDARY (1NT21IS176)
V.S. SANJANA (1NT21IS177)
VAISHNAVI .A.R (1NT21IS182)
DEPARTMENT OF INFORMATION AND ENGINEERING
NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
(An Autonomous Institution)
KARNATAKA

CERTIFICATE
This is to certify that the “COMPUTER NETWOKS REPORT” submitted by
SHRUTHA. K (1NT21IS157), V. LIKHITHA CHOWDARY
(1NT21IS176), V.S. SANJANA (1NT21IS177), VAISHNAVI. A.R
(1NT21IS182)
is work done by them and submitted during 2022 – 2023 academic year, in partial fulfillment
of the requirements for the award of the degree of BACHELOR OF TECHNOLOGY in
INFORMATION SCIENCE AND ENGINEERING, at Nitte Meenakshi Institute of
Technology.

Mrs.VANI SUDEEP DR. MOHAN S G

Professor, Head of the


Department,
Computer Networks,
Department of ISE
Department of ISE

ACKNOWLEDGEMENT

It gives us a great sense of pleasure to present the report on Java


application for LA2 Component. It was a great experience and helped
us explore our skills and increased our interest in Java application
development

We owe special debt of gratitude to Mrs.Vani Sudeep, Asst. Prof,


Department of Information Science & Engineering, Nitte Meenakshi
Institute of Technology, Bengaluru, for her constant support and
guidance throughout the course of the report. Her sincerity,
thoroughness and perseverance has been a constant source of
inspiration for us. It is only due to her cognizant efforts that our
endeavors have seen the light of the day.

Last but not the least, we acknowledge our team, our friends and
family, for their contribution in the completion of the project.
ABSTRACT

Computer networks are a system of interconnected computers


for the purpose of sharing digital information. The concept of
a network began in 1962 when a server at the Massachusetts
Institute of Technology was connected to a server in Santa
Monica, California. Since that time the proliferation of
computers and computer networks has increased significantly.
One of the most significant challenges to networks is attacks
on their resources caused by inadequate network security. In
this research paper we highlight and overview concept of
computer networks.
TABLE OF CONTENTS

Introduction 5

Bus Topology 5

Diagram 6

Code snippet 7-9

Output 10
Explanation of the code 11-14

Conclusion 15

BUS TOPOLOGY

The bus network topology is also referred to as horizontal topology. This


topology is very common among local area networks. In this network, every
computer is linked to a single connection line or cable through an interface.
Thus each computer can directly communicate with other computer or device in
the network.
Each work station or node has a particular address, and to access a specific
node, a user just needs to know its address. There is no concentration point in
the network, and thus the problem of resolution is severe. Traffic flow among
various computers in the network is relatively simple because it grants all
stations to get each transmission. So a single station can broadcast to multiple
stations.
Bus topology is a setup of a network where network devices, computers or
nodes are directly linked to a single cable, or we can say with a common link.
An RJ-45 network cable or coaxial cable is preferred to link them, depending
on the type of system network card.

In computer networks, multiple computers are connected to each other through


a link. These computers in a network are known as Nodes. They are connected
either through cable or wireless radio links. These computers connected in the
network share resources such as files, network access, printers, etc…By
connecting in a network a computer can do many tasks.
In Bus Topology used in computer networks, all the computers are connected
through a single cable. Usually Ethernet cable is used for Bus Topology. In this
topology, the information intended for the last node has to pass through all the
computers present in the network. If this cable is damaged then the connection
of all the computers will be lost.
Instead of cable either network card, co-axial cable or RJ-47 can be used
depending on the type of computers used in the network. When Bus Topology
has only two endpoints, it is known as Linear Topology. In Bus topology data is
transmitted only in one direction.

Here, the node that transmits data is known as Host. All the computers
connected in the network will receive all the network traffic. Each node is given
equal priority for data transmission. The nodes use Media Access Technology
such as a bus master to share the bus.

BUS TOPOLOGY DIAGRAM


CODE

#include "ns3/core-module.h"

#include "ns3/network-module.h"

#include "ns3/csma-module.h"

#include "ns3/internet-module.h"

#include "ns3/applications-module.h"

using namespace ns3;

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

// Enable logging

LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);

LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);


// Create nodes

NodeContainer nodes;

nodes.Create (4);

// Create the channel

CsmaHelper csma;

csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));

csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));

// Install devices

NetDeviceContainer devices = csma.Install (nodes);

// Install internet stack

InternetStackHelper stack;

stack.Install (nodes);

// Assign IP addresses

Ipv4AddressHelper address;

address.SetBase ("10.1.1.0", "255.255.255.0");

Ipv4InterfaceContainer interfaces = address.Assign (devices);

// Create an echo server on node 1

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));

serverApps.Start (Seconds (1.0));


serverApps.Stop (Seconds (10.0));

// Create echo clients on nodes 2, 3, and 4

UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);

echoClient.SetAttribute ("MaxPackets", UintegerValue (5));

echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));

echoClient.SetAttribute ("PacketSize", UintegerValue (1024));

ApplicationContainer clientApps1 = echoClient.Install (nodes.Get (2));

clientApps1.Start (Seconds (2.0));

clientApps1.Stop (Seconds (10.0));

ApplicationContainer clientApps2 = echoClient.Install (nodes.Get (3));

clientApps2.Start (Seconds (2.0));

clientApps2.Stop (Seconds (10.0));

ApplicationContainer clientApps3 = echoClient.Install (nodes.Get (4));

clientApps3.Start (Seconds (2.0));

clientApps3.Stop (Seconds (10.0));

// Enable packet capture on all nodes

CsmaHelper::EnablePcapAll ("bus-topology");

// Run the simulation

Simulator::Run ();

Simulator::Destroy ();
return 0;

OUTPUT
EXPLANATION FOR THE CODE

This code is a simulation script written in C++ using the ns-3 network
simulation framework. It creates a simple bus topology network with four nodes
interconnected by a CSMA (Carrier Sense Multiple Access) channel. In this
network, one node functions as an echo server, and the other three nodes act as
echo clients. The echo clients send UDP echo packets to the echo server, and
the server responds back, simulating a basic client-server communication
scenario.

Let's look into the code step by step:

1. Header and Namespace Inclusions:

The code includes the necessary header files for using various modules in ns-
3. These include core modules for basic functionality, network modules for
networking components, CSMA module for the CSMA channel, internet
module for internet protocol stack, and applications module for setting up
applications on nodes.

2. Logging Configuration:

The code enables logging for the `UdpEchoClientApplication` and


`UdpEchoServerApplication` components with the log level set to INFO. This
means that log messages related to these components will be displayed when
running the simulation.

3. Node Creation:

The code creates a container `nodes` that will hold four nodes. These nodes
represent the devices in the network.

4. Channel Creation and Configuration:

The CSMA channel is created using the `CsmaHelper`. The channel's data
rate is set to 5 Mbps (5000000 bits per second), and the delay is set to 2
milliseconds.

5. Device Installation:

The `CsmaHelper` installs network devices on the nodes using the previously
defined channel configuration. The resulting `NetDeviceContainer` `devices`
holds the devices that are now connected in the bus topology.

6. Internet Stack Installation:

The Internet stack is installed on all the nodes using the `InternetStackHelper`.
This step sets up the IPv4 routing and forwarding functionalities on the nodes.
7. IP Address Assignment:

An IPv4 address is assigned to each of the network interfaces of the nodes in


the `devices` container. The address "10.1.1.0" with subnet mask
"255.255.255.0" is used as the base address, and each node gets an IP address
from this subnet.

8. Echo Server Configuration:

An echo server application is created using the `UdpEchoServerHelper` and is


installed on node 1. The echo server listens on UDP port 9. It will respond to the
UDP echo packets it receives from the echo clients.

9. Echo Client Configuration:

Three echo client applications are created using the `UdpEchoClientHelper`,


one for each of the nodes 2, 3, and 4. Each echo client is configured to send
UDP echo packets to the IP address of the echo server (IP address of node 1) on
UDP port 9. The clients will send 5 echo packets, with an interval of 1 second
between packets. Each echo packet will have a size of 1024 bytes.

10. Packet Capture Configuration:

Packet capture is enabled for all nodes in the network using


`CsmaHelper::EnablePcapAll`. This allows capturing packets exchanged
between nodes during the simulation. The captured packets will be saved with
the filename "bus-topology".

11. Simulation Execution:

The simulation is run using `Simulator::Run()`, which executes the


simulation. The clients will start sending echo packets after 2 seconds and
continue until 10 seconds. The server will also be active during this time,
responding to the received packets.
12. Simulation Cleanup:

After the simulation is complete, `Simulator::Destroy()` is called to clean up


the simulation environment.

This code provides a basic example of how to set up a simple bus topology
network using ns-3 and demonstrates the communication between a client and a
server in the network. When you run this simulation, it will show the exchange
of echo packets between the clients and the server, and you can inspect the
captured packets using a packet analyzer tool.
CONCLUSION

In conclusion, the bus topology is a simple and straightforward


network topology used in computer networks. It has its advantages
and disadvantages, making it suitable for certain scenarios while not
ideal for others.

Bus topology is a simple and cost-effective network configuration that


is well-suited to small networks, such as home or small office
networks. However, it has its limitations, such as a limited cable
length, a single point of failure, and a limited number of devices that
can be connected.

 It is a type of network topology in which all devices in the network
are connected by one central RJ-45 network cable or coaxial cable.
The single cable, where all data is transmitted between devices, is
referred to as the bus, backbone, or trunk.

You might also like