0% found this document useful (0 votes)
76 views

Computer Networks-2 Laboratory Experiments Report: Name: Kaustubh R Borgavi Sem: 6 Div: B Roll: 219 USN: 01FE18BCS091

This document provides a report on computer network laboratory experiments conducted by Kaustubh R Borgavi. It includes an index and sections covering static routing, load balancing algorithms including round robin, least connection and weighted least connection. Code scripts and diagrams are included to demonstrate how each algorithm was implemented in a virtual network using Mininet and analyzed using JMeter performance graphs.

Uploaded by

Appu Bhardwaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Computer Networks-2 Laboratory Experiments Report: Name: Kaustubh R Borgavi Sem: 6 Div: B Roll: 219 USN: 01FE18BCS091

This document provides a report on computer network laboratory experiments conducted by Kaustubh R Borgavi. It includes an index and sections covering static routing, load balancing algorithms including round robin, least connection and weighted least connection. Code scripts and diagrams are included to demonstrate how each algorithm was implemented in a virtual network using Mininet and analyzed using JMeter performance graphs.

Uploaded by

Appu Bhardwaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Computer Networks-2

Laboratory Experiments Report

Name: Kaustubh R Borgavi


Sem: 6th
Div: B
Roll: 219
USN: 01FE18BCS091

1
Index
Topic: Page no.
1. Static Routing 3
2. Load Balancing algorithms 5
3. JUNOs Configuration 19
a. VLAN 19
b. OSPF 20
c. iBGP 22
4. Routing algorithm 24
a. Dijkstra’s algorithm 24
b. Distance Vector algorithm 27

2
1. Static Routing:
Static Routing is also known as non-adaptive routing which doesn’t
change the routing table unless the network administrator changes or
modifies them manually. Static routing does not use complex routing
algorithms and it provides better security than Dynamic routing. Static
routing can be used to define an exit point from a router when no other
routes are available or necessary.

Static routing can be used for small networks that require only one or
two routes. This is often more efficient since a link is not being wasted
by exchanging dynamic routing information. Static routing is often used
as a complement to dynamic routing to provide a failsafe backup in the
event that a dynamic route is unavailable. Static routing is often used to
help transfer routing information from one routing protocol to another
(routing redistribution).

Here is a script which builds a topology to demonstrate static routing


between 2 switches. This is simulated virtually on Mininet using the pox
controller.
Topology:

3
Script: Here is the code for to simulate static routing in Mininet.
from containernet.cli import CLI
from containernet.link import TCLink,Link
from containernet.net import Containernet

if '__main__' == __name__:
net = Containernet(link=TCLink)
h1 = net.addHost('h1')
h2 = net.addHost('h2')
r1 = net.addHost('r1')
r2 = net.addHost('r2')
Link(h1, r1)
Link(h2, r2)
Link(r1, r2)
net.build()

r1.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")


r2.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")
r3.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")
r1.cmd("ifconfig r1-eth0 0")
r1.cmd("ifconfig r1-eth1 0")
r1.cmd("ifconfig r1-eth2 0")
r2.cmd("ifconfig r2-eth0 0")
r2.cmd("ifconfig r2-eth1 0")
r2.cmd("ifconfig r2-eth2 0")
r3.cmd("ifconfig r3-eth0 0")
r3.cmd("ifconfig r3-eth1 0")
r1.cmd("ip addr add 192.168.1.254/24 brd + dev r1-eth0")
r1.cmd("ip addr add 12.1.1.1/24 brd + dev r1-eth1")
r1.cmd("ip addr add 13.1.1.1/24 brd + dev r1-eth2")
r2.cmd("ip addr add 192.168.2.254/24 brd + dev r2-eth0")
r2.cmd("ip addr add 12.1.1.2/24 brd + dev r2-eth1")
r2.cmd("ip addr add 23.1.1.2/24 brd + dev r2-eth2")
r3.cmd("ip addr add 13.1.1.3/24 brd + dev r3-eth0")
r3.cmd("ip addr add 23.1.1.3/24 brd + dev r3-eth1")
r1.cmd("ip route add 192.168.2.0/24 via 12.1.1.2")
r2.cmd("ip route add 192.168.1.0/24 via 12.1.1.1")

h1.cmd("ifconfig h1-eth0 0")


h1.cmd("ip address add 192.168.1.1/24 dev h1-eth0")
h1.cmd("ip route add default via 192.168.1.254 dev h1-eth0")

4
h2.cmd("ifconfig h2-eth0 0")
h2.cmd("ip address add 192.168.2.1/24 dev h2-eth0")
h2.cmd("ip route add default via 192.168.2.254 dev h2-eth0")
CLI(net)
net.stop()

Implementation in Mininet:
We run the command: python static_routing.py
The topology is defined and a static link is established between the two switches.

2. Load balancing algorithms:


Load balancing algorithms intelligently determine which device within a
given server farm is best able to process an incoming data packet. Doing so,
we can distribute the load across all the servers in a particular fashion and
make the service is carried out with utmost efficiency. Algorithm selection
impacts the effectiveness of load distribution mechanisms and,
consequently, its performance.
There are several load balancing algorithms. Here is an implementation of
some of them and also the comparison between each of the algorithms done
using the JMeter analysis.

5
We start by instantiating the topology for the analysis. We will be using the
same topology for all the algorithms. The pictorial representation of the
topology is shown below:

Topology: We define a topology containing 1 switch and 6 hosts. 3 are


configured as servers and the other 3 as clients. The same topology will
be utilized for all the load balancing algorithms.

We run the command “sudo python topology.py” to instantiate the above


topology.

6
a. Round Robin:
Round-robin load balancing is one of the simplest and most used load
balancing algorithms. Client requests are distributed to application servers
in rotation. This load balancing algorithm does not take into consideration
the characteristics of the application servers i.e. it assumes that all
application servers are the same with the same availability, computing and
load handling characteristics.
Round robin is the most widely deployed load balancing algorithm. Using
this method, client requests are routed to available servers on a cyclical
basis. Round robin server load balancing works best when servers have
roughly identical computing capabilities and storage capacity.

Script:
Here is the function which picks the appropriate server in accordance with
the Round Robin algorithm.

7
Implementation:
Here is the implementation using the pox controller and the Mininet
package. There are three servers with IP addresses as 10.0.0.1, 10.0.0.2,
10.0.0.3.

Commands: ./pox.py log.level –DEBUG round –ip=10.0.1.1 –


server=10.0.0.1,10.0.0.2,10.0.0.3.

The above picture shows the terminal depicting the packets being
transferred to the servers in a Round Robin fashion.

8
Performance Graphs using JMeter:
Graph depicting the Number of active threads against the perceived
response time in ms.

The above graph shows the number of requests that are flowing in from
the users plotted against the time taken the server to cater the requests.
The load balancing algorithm does its job by distributing the load in a
round robin fashion and hence managing the load.
Graph depicting the Number of transactions against the elapsed
time.

This graph tells us about the number of services/transactions that the


server is responding every second. It is plotted against the amount of time
the server has been active. The graph shows us the amount of load
carried by the server at a particular instance of time.

b. Least Connection:
Least Connection load balancing is a dynamic load balancing algorithm
where client requests are distributed to the application server with the
least number of active connections at the time the client request is
9
received. In cases where application servers have similar specifications,
an application server may be overloaded due to longer lived connections;
this algorithm takes the active connection load into consideration.
This algorithm takes into consideration the number of current connections
each server has. When a client attempts to connect, the load balancer will
try to determine which server has the least number of connections and
then assign the new connection to that server.

Script:
Here is the function which picks the appropriate server in accordance with
the least weights’ algorithm.

10
Implementation:
Here is the implementation using the pox controller and the Mininet
package.
There are three servers with IP address as 10.0.0.1, 10.0.0.2, 10.0.0.3.

Commands: ./pox.py log.level –DEBUG round –ip=10.0.1.1 –


server=10.0.0.1,10.0.0.2,10.0.0.3.

The above picture shows the terminal depicting the packets being
transferred to the servers in a least connections fashion.

11
Performance Graphs using JMeter:
Graph depicting the Number of active threads against the perceived
response time in ms.

The above graph shows the number of requests that are flowing in from
the users plotted against the time taken the server to cater the requests.
The load balancing algorithm does its job by distributing the load in a
round robin fashion and hence managing the load.
Graph depicting the Number of transactions against the elapsed
time.

This graph tells us about the number of services/transactions that the


server is responding every second. It is plotted against the amount of time
the server has been active. The graph shows us the amount of load
carried by the server at a particular instance of time.

c. Weighted least connections:


The Weighted Least Connections algorithm does to Least Connections
what Weighted Round Robin does to Round Robin. That is, it introduces
a "weight" component based on the respective capacities of each server.
Just like in the Weighted Round Robin, we will have to specify each

12
server's "weight" beforehand. This algorithm takes into consideration the
number of current connections each server has. When a client attempts
to connect, the load balancer will try to determine which server has the
least number of connections and then assign the new connection to that
server.

Implementation:
Here is the implementation using the pox controller and the Mininet
package.
There are three servers with IP address as 10.0.0.1, 10.0.0.2, 10.0.0.3.

Commands: ./pox.py log.level –DEBUG round –ip=10.0.1.1 –


server=10.0.0.1,10.0.0.2,10.0.0.3.

13
The above picture shows the terminal depicting the packets being
transferred to the servers in a least weighted connections fashion.
Performance Graphs using JMeter:
Graph depicting the Number of active threads against the perceived
response time in ms.

The above graph shows the number of requests that are flowing in from
the users plotted against the time taken the server to cater the requests.
The load balancing algorithm does its job by distributing the load in a
round robin fashion and hence managing the load.

14
Graph depicting the Number of transactions against the elapsed time

This graph tells us about the number of services/transactions that the


server is responding every second. It is plotted against the amount of time
the server has been active. The graph shows us the amount of load
carried by the server at a particular instance of time.

d. Weighted Round robin:


Weighted Round Robin builds on the simple Round-robin load balancing
algorithm to account for differing application server characteristics. The
administrator assigns a weight to each application server based on criteria
of their choosing to demonstrate the application servers’ traffic-handling
capability. If application server #1 is twice as powerful as application
server #2 (and application server #3), application server #1 is provisioned
with a higher weight and application server #2 and #3 get the same weight.
If there five (5) sequential client requests, the first two (2) go to application
server #1, the third (3) goes to application server #2, the fourth (4) to
application server #3 and the fifth (5) to application server #1.
The weighted round robin load balancing algorithm allows site
administrators to assign weights to each server based on criteria like
traffic-handling capacity. Servers with higher weights receive a higher
proportion of client requests.

15
Script:
Here is the function which picks the appropriate server in accordance with
the least weights’ algorithm.

Implementation:
Here is the implementation using the pox controller and the Mininet
package.
There are three servers with IP address as 10.0.0.1, 10.0.0.2, 10.0.0.3.

16
Commands: ./pox.py log.level –DEBUG round –ip=10.0.1.1 –
server=10.0.0.1,10.0.0.2,10.0.0.3.

The above picture shows the terminal depicting the packets being
transferred to the servers in a least weights fashion.

17
Performance Graphs using JMeter:
Graph depicting the Number of active threads against the perceived
response time in ms.

The above graph shows the number of requests that are flowing in from
the users plotted against the time taken the server to cater the requests.
The load balancing algorithm does its job by distributing the load in a
round robin fashion and hence managing the load.
Graph depicting the Number of transactions against the elapsed
time.

This graph tells us about the number of services/transactions that the


server is responding every second. It is plotted against the amount of time
the server has been active. The graph shows us the amount of load
carried by the server at a particular instance of time.

18
3. JUNOs configuration:
a. JUNOs configuration for VLAN:
EX Series switches use VLANs to make logical groupings of network
nodes with their own broadcast domains. VLANs limit the traffic flowing
across the entire LAN and reduce collisions and packet retransmissions.
VLAN is a custom network which is created from one or more local area
networks. It enables a group of devices available in multiple networks to
be combined into one logical network. The result becomes a virtual LAN
that is administered like a physical LAN. The full form of VLAN is defined
as Virtual Local Area Network.
Without VLANs, a broadcast sent from a host can easily reach all network
devices. Each and every device will process broadcast received frames.
It can increase the CPU overhead on each device and reduce the overall
network security.
Problem Statement: Configure VLAN using Juniper Switches and
verify the reachability information.
Topology: Two host machines are connected to a switch.

Configuring the switch:


set interfaces ge-0/0/1 unit 0 family inet address
10.1.1.1/28
Script:
set vlans DATA vlan-id 10
set vlans VOICE vlan-id 20

19
set interfaces ge-0/0/2 unit 0 family ethernet-
switching vlan members DATA
set interfaces ge-0/0/5 unit 0 family ethernet-
switching vlan members VOICE
set interfaces vlan unit 10 family inet address
192.168.3.1/24
set interfaces vlan unit 20 family inet address
192.168.4.1/24
set vlans DATA l3-interface vlan.10
set vlans VOICE l3-interface vlan.20
Procedure to carry out the experiment:
• The Juniper Switch is configured to a required IP address using
PuTTY.
• We set the credentials through ssh and then configure the switch.
• We connect a PC to the switch through the management port and
the above code snippet is run.
• Two host machines are then connected to two active ports in the
switch.
• We ping from one host to another and to corresponding port to
check whether a stable connection is established or not.

b. JUNOs configuration for OSPF: OSPF is an interior gateway protocol


(IGP) that routes packets within a single autonomous system (AS). OSPF
uses link-state information to make routing decisions, making route
calculations using the shortest-path-first (SPF) algorithm. Junos OS
supports OSPF version 2 (OSPFv2) and OSPF version 3 (OSPFv3),
including virtual links, stub areas, and for OSPFv2, authentication.
Problem Statement: Configure the OSPF protocol on two Juniper
switches having multiple paths. Perform the OSPF reachability
information with minimal path.
Topology: Two switches with one host machine each are connected
through a static link.

20
Configuring the switch:
set interfaces ge-0/0/1 unit 0 family inet address
10.1.1.1/28
Script:
set vlans HOSTONE vlan-id 10
set vlans SWITCHONE vlan-id 20
set interfaces ge-0/0/2 unit 0 family ethernet-
switching members HOSTONE
set interfaces ge-0/0/8 unit 0 family ethernet-
switching members SWITCHONE
set interfaces vlan unit 10 family inet address
192.168.3.2/24
set interfaces vlan unit 20 family inet address
192.168.4.2/24
set protocols ospf area 0.0.0.0 interface ge-0/0/2
set protocols ospf area 0.0.0.0 interface ge-0/0/8
set vlans HOSTONE l3-interface vlan.10
set vlans SWITCHONE l3-interface vlan.20
edit routing options static
set route 192.168.5.2/24 next-hop 192.168.4.3/24

21
Procedure to carry out the experiment:
• The Juniper Switch is configured to a required IP address using
PuTTY.
• We set the credentials through ssh and then configure the switch.
• We connect a PC to the switch through the management port and
the above code snippet is run.
• Two host machines are then connected to two active ports in the
switch.
• We ping from one host to another and to corresponding port to
check whether a stable connection is established or not.
• The cost matrix is displayed which depicts the route that is travelled.

3. JUNOs configuration for iBGP: IBGP is used inside the autonomous


systems. It is used to provide information to the internal routers. It
requires all the devices in the same autonomous systems to form a full
mesh topology.
Problem statement: Configure the IBGP Juniper device and perform
the reachability information from the identified source and
destination.
Configuring the switch:
set interfaces ge-0/0/1 unit 0 family inet address
10.1.1.1/28
Topology:

22
Script:
# Device 1
set vlans explorer vlan-id 55
set vlans achiever vlan-id 66
set interfaces ge-0/0/6 unit 0 family ethernet-
switching vlan members explorer
set interfaces ge-0/0/12 unit 0 family ethernet-
switching vlan members achiever
set interfaces vlan unit 55 family inet address
192.168.10.1/24
set interfaces vlan unit 66 family inet address
30.30.10.1/24
set vlans explorer l3-interface vlan.55
set vlans achiever l3-interface vlan.66
set interfaces ge-0/0/23 unit 0 family inet address
20.20.20.1/30
set routing-options static route 0.0.0.0/0 next-hop
20.20.20.2

#Device 2
set vlans explorer vlan-id 55
set vlans achiever vlan-id 66
set interfaces ge-0/0/6 unit 0 family ethernet-
switching vlan members explorer
set interfaces ge-0/0/12 unit 0 family ethernet-
switching vlan members achiever
set interfaces vlan unit 55 family inet address
192.168.10.1/24
set interfaces vlan unit 66 family inet address
30.30.10.1/24
set vlans explorer l3-interface vlan.55

23
set vlans achiever l3-interface vlan.66
set interfaces ge-0/0/23 unit 0 family inet address
20.20.20.2/30
set routing-options static route 0.0.0.0/0 next-hop
20.20.20.1
Procedure to carry out the experiment:
• The Juniper Switch is configured to a required IP address using
PuTTY.
• We set the credentials through ssh and then configure the switch.
• We connect a PC to the switch through the management port and
the above code snippet is run.
• Since two switches are being used, we establish a static route
between them
• A common environment is declared since the experiment has to be
carried out in the same autonomous system.
• Two host machines are then connected to two active ports in the
switch.
• We ping from one host to another and to corresponding port to
check whether a stable connection is established or not.

4. Routing Algorithms:
1. Dijkstra’s Algorithm: It is an algorithm for finding the shortest
paths between nodes in a graph, which may represent, for
example, networks. For a given source node in the graph, the algorithm
finds the shortest path between that node and every other. It can also be
used for finding the shortest paths from a single node to a single
destination node by stopping the algorithm once the shortest path to the
destination node has been determined. This optimises the packet transfer
in a network.
Topology: Here are 3 switches and 4 hosts connected in a tree topology
as shown below.

24
Script: Here is the function which calculates minimum distance between
two nodes.

25
Implementation:
a. Running the Pyretic Controller:

b. Once the Pyrectic controller is running, we can ping any two hosts in
the given topology. The packets that are being transferred from one host
to another in the topology will choose the shortest path in accordance with
the Dijkstra’s Algorithm. The path chosen is shown in the terminal.
H1 ping H4

26
2. Distance Vector:
Topology:

Script:
Bellman Ford Algorithm Script:

27
Implementation:
Running the Mininet script in the terminal initially.
In another terminal, we run the Pyretic controller with the above Distance
Vector script.

Once the topology is defined, we can carry out the ping test.

Hence the implementation of two routing algorithms (Dijkstra’s and


Distance Vector) in Mininet using the pyretic and Pox controllers.
28

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy