Computer Networks-2 Laboratory Experiments Report: Name: Kaustubh R Borgavi Sem: 6 Div: B Roll: 219 USN: 01FE18BCS091
Computer Networks-2 Laboratory Experiments Report: Name: Kaustubh R Borgavi Sem: 6 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).
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()
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.
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:
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.