Practical 8
Practical 8
8 ROLL NO: 27
THEORY:
1. In this practical, the simple network that is animated using NetAnim in Network
Simulator is Hybrid Topology.
2. A hybrid topology is a kind of network topology that is a combination of two or
more network topologies, such as mesh topology, bus topology, and ring
topology.
3. Its usage and choice are dependent on its deployments and requirements like
the performance of the desired network, and the number of computers, their
location.
4. However, a variety of technologies are needed for its physical implementation,
and it offers a complex structure.
5. Also, it includes an advantage as increasing flexibility; it can increase fault
tolerance, and allows new basic topologies to be added or removed easily.
6. The hybrid topology is more useful when you need to fulfil diversity in Computer
Network. In this topology, all network sections can include the configuration of
different Network Topology.
7. Classes Used In Code:
a. Following different classes are used in code:
i. Node Class:
1. In ns-3 the basic computing device abstraction is called the
node. This abstraction is represented in C++ by the class
Node.
2. The Node class provides methods for managing the
representations of computing devices in simulations.
ATHARVA KALE PRACTICAL NO. 8 ROLL NO: 27
CODE:
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/netanim-module.h"
// r3
}
bool useV6 = false;
CommandLine cmd (__FILE__);
cmd.AddValue ("useIpv6", "Use Ipv6", useV6);
cmd.Parse (argc, argv);
NodeContainer host, router, host1;
host.Create (2);
router.Create (4);
NodeContainer subnet1;
subnet1.Add (host.Get (0));
subnet1.Add (router.Get (0));
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer subnet1Devices;
subnet1Devices = pointToPoint.Install (subnet1);
InternetStackHelper stack;
stack.Install (router);
stack.Install (host);
Ipv4AddressHelper address1, address2, address3, address4, address5, address6;
address1.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer subnet1Interfaces;
OUTPUT:
o ./waf Output:
o Python Visualizer:
ATHARVA KALE PRACTICAL NO. 8 ROLL NO: 27
o NetAnim Output:
CONCLUSION:
Hence we successfully simulated simple network using NetAnim in
Network Simulator.