DCCN Lab Manual
DCCN Lab Manual
DCCN Lab Manual
Lab objectives
Lab outcomes
1. Study of different types of Network cables and Practically implement the cross-
wired cable and straight through cable using clamping tool.
10. To simulate the OPEN SHORTEST PATH FIRST routing protocol based on
the cost assigned to the path.
2 Implementation of the data link framing methods for the bit stuffing in a
frame.
1. Analysing number of transmitting nodes vs. collision count, mean delay for
Ethernet LAN .
2. Analysing bus vs. star-switch with respect to number of collisions (for a fixed
number of transmitting nodes) for Ethernet LAN
3. Analysing performance of token ring with number of nodes vs. response time,
mean delay using NetSim.
4. Comparing the throughput and normalized throughput for token ring and token
bus for different transmitting nodes.
5. Comparing the CSMA/CD vs. CSMA/CA protocols (for a fixed number of
transmitting nodes).
6. Analysing the difference between unicast and broadcast transmission (for a fixed
number of transmitting nodes).
7. Verification of stop-and-wait protocol.
8. Verification of Go-back-N protocol.
9. Verification of Selective repeat protocol.
10. Verification of distance vector routing algorithm.
11. Verification of link state routing algorithm.
Aim:
Study of different types of Network cables and Practically implement the cross-wired cable and
straight through cable using clamping tool.
Apparatus:
RJ-45 connector, Climping Tool, Twisted pair Cable
Procedure: To do these practical following steps should be done:
Procedure:
Start by stripping off about 2 inches of the plastic jacket off the end of the cable. Be very
careful at this point, as to not nick or cut into the wires, which are inside. Doing so could
alter the characteristics of your cable, or even worse render is useless. Check the wires,
one more time for nicks or cuts. If there are any, just whack the whole end off, and start
over.
Spread the wires apart, but be sure to hold onto the base of the jacket with your other
hand. You do not want the wires to become untwisted down inside the jacket. Category 5
cable must only have 1/2 of an inch of 'untwisted' wire at the end; otherwise it will be 'out
of spec'. At this point, you obviously have ALOT more than 1/2 of an inch of un-twisted
wire.
You have 2 end jacks, which must be installed on your cable. If you are using a pre-made
cable, with one of the ends whacked off, you only have one end to install - the crossed
over end. Below are specified the color combination for Straight cable and Cross over
cable which show how you need to arrange the cables for each type of cable end.
To make a straight cable, the tips must be crimped typically the same way at each end by
respecting the twisted pair size. In general, the code used is:
1. Orange-white
2. Orange
3. Green-white
4. Blue
5. Blue-white
6. Green
7. Brown-white
8. Brown
For a crossover cable, swap 1 with 3, and 2 with 6, in the list above. This gives:
1. Green-white
2. Green
3. Orange and white
4. Blue
5. Blue-white
6. Orange
7. Brown-white
8. Brown
Viva-voce questions:
Apparatus:
Any simulator may be needed
Repeater
Fig.1 A Repeater
Hub: An Ethernet hub, active hub, network hub, repeater hub, hub or concentrator
is a device for connecting multiple twisted pair or fiber optic Ethernet devices
together and making them act as a single network segment. Hubs work at the
physical layer (layer 1) of the OSI model. The device is a form of multiport
repeater. Repeater hubs also participate in collision detection, forwarding a jam
signal to all ports if it detects a collision.
Fig.2 A Hub
Fig.3 A Switch
Bridge: A network bridge connects multiple network segments at the data link
layer(Layer 2) of the OSI model. In Ethernet networks, the term bridge formally
means a device that behaves according to the IEEE 802.1D standard. A bridge
and switch are very much alike; a switch being a bridge with numerous ports.
Switch or Layer 2 switch is often used interchangeably with bridge.Bridges can
analyze incoming data packets to determine if the bridge is able to send the given
packet to another segment of the network.
Fig.4 How a Bridge works
Fig.5 A Router
Gateway: A gateway is normally a computer that operates in all five layers of the
Internet or seven layers of OSI model. A gateway takes an application message,
reads it, and interprets it. This means that it can be used as a connecting device
between two internetworks that use different models. For example, a network
designed to use the OSI model can be connected to another network using the
Internet model. The gateway connecting the two systems can take a frame as it
arrives from the first system, move it up to the OSI application layer, and remove
the message.
Viva-voce questions:
Apparatus:
A system with Unix operating system.
Theory:
a. hostname
hostname with no options displays the machines host name
hostname d displays the domain name the machine belongs to
hostname f displays the fully qualified host and domain name
hostname i displays the IP address for the current machine
b. ping
It sends packets of information to the user-defined source. If the packets are received, the
destination device sends packets back. Ping can be used for two purposes:
1. To ensure that a network connection can be established.
2. Timing information as to the speed of the connection.
If you do ping www.yahoo.com it will display its IP address. Use ctrl+ to stop the test.
c. ifconfig
View network configuration, it displays the current network adapter configuration. It is
handy to determine if you are getting transmit (TX) or receive (RX) errors.
d. netstat
Most useful and very versatile for finding connection to and from the host. You can find
out all the multicast groups (network) subscribed by this host by issuing "netstat -g"
netstat -nap | grep port will display process id of application which is using that port
netstat -a or netstat all will display all connections including TCP and UDP
netstat --tcp or netstat t will display only TCP connection
netstat --udp or netstat u will display only UDP connection
netstat -g will display all multicast network subscribed by this host.
e. nslookup
If you know the IP address it will display hostname. To find all the IP addresses for a
given domain name, the command nslookup is used. You must have a connection to the
internet for this utility to be useful.
E.g. nslookup blogger.com
You can also use nslookup to convert hostname to IP Address and from IP Address from
hostname.
f. traceroute
A handy utility to view the number of hops and response time to get to a remote system
or web site is traceroute. Again you need an internet connection to make use of this tool.
g. finger
View user information, displays a users login name, real name, terminal name and write
status. this is pretty old unix command and rarely used now days.
h. telnet
Connects destination host via telnet protocol, if telnet connection establish on any port
means connectivity between two hosts is working fine.
EXPERIMENT 4
Aim:
Write a program to generate CRC code for checking error.
Apparatus:
Turbo C software
Program:
#include <stdio.h>
#include <conio.h>
#include<string.h>
#define poly 0xd8 int crc(int msg)
{
int rem,i;
rem=msg;
for(i=8;i>0;--i)
{
if(rem & 0x80)
{ rem^=poly;
}
rem=rem<<1;
} return (rem>>4);
} void main()
{ int msg=0xe5,c;
clrscr();
c=crc(msg);
printf("%d",c);
getch();
}
Here the polynomial is 0xd8 means 11011000 and msg is 0xe5 means 11100101. So at last we
get as an answer means remainder
Viva-voce questions:
Aim :
To Plot Efficiency of pure Aloha and slotted ALOHA in MATLAB
Apparatus:
MATLAB software
Procedure:
In pure ALOHA, frames are transmitted at completely arbitrary times.
Invalid frames may be caused by channel noise or because other station(s) transmitted at the
same time: collision. Collision happens even when the last bit of a frame overlaps with the first
bit of the next frame.
S = G e-2G, where S is the throughput (rate of successful transmissions) and G is the offered load.
S = Smax = 1/2e = 0.184 for G=0.5.
Pure ALOHA has a vulnerable time of 2 x Tfr . This is so because there is no rule that defines
when the station can send. A station may send soon after another station has started or soon
before another station has finished. Slotted ALOHA was invented to improve the efficiency of
pure ALOHA. In slotted ALOHA we divide the time into slots of Tfr s and force the station to
send only at the beginning of the time slot.Doubles performance of ALOHA. Frames can only be
transmitted at beginning of slot:
Vulnerable period is halved.
S = G e-G.
S = Smax = 1/e = 0.368 for G = 1.
G=0:0.1:3;
S=G.*exp(-G);
plot(G,S,'b+:');
text(1,.38,'MAX THROUGHPUT FOR SLOTTED ALOHA')
xlabel('load offered');
ylabel('throughput');
title('aloha protocol');
hold on;
S1=G.*exp(-2*G);
plot(G,S1,'rd:');
text(0.5,.2,'MAX THROUGHPUT FOR PURE ALOHA') xlabel ('load offered');
ylabel ('throughput');
title ('aloha protocol');
legend ('Slotted ALOHA','Pure ALOHA','Location','NorthEastOutside')
Result:
Viva-voce questions:
Aim:
To implement client-server socket programming.
Apparatus:
JDK1.8
Socket Programming:
ServerSocket class:
The Server Socket class can be used to create a server socket. This object is used to establish
communication with the clients.
Commonly used methods of ServerSocket class:
1) public Socket accept()
2) public InputStream getInputStream()
3) public OutputStream getOutputStream()
4) public synchronized void close() Example of Socket Programming:
ALGORITHM: CLIENT
1. Include necessary package in java
2. The client establishes a connection to the server.
3. The client accept the connection and to send the data from client to server and vice
versa
4. The client communicate the server to send the end of the message
5. Stop the program.
ALGORITHM: SERVER
1. Include necessary package in java
2. The server establishes a connection to the client.
3. The server accept the connection and to send the data from server to client and vice
versa
4. The server communicate the client to send the end of the message
5. Stop the program.
//MyServer.java
import java.io.*;
import java.net.*;
String str=(String)dis.readUTF();
System.out.println("message= "+str);
ss.close();
}catch(Exception e){System.out.println(e);}
}
}
//MyClient.java
import java.io.*;
import java.net.*;
dout.writeUTF("Hello Server");
dout.flush();
dout.close();
s.close();
}catch(Exception e){System.out.println(e);} } }
To execute this program open two command prompts and execute each program at each
command prompt as displayed in the below figure.
Viva-voce questions:
Aim:
To determine the Host name and IP address of a system and implementation of URL class.
Apparatus:
JDK1.8
InetAddress class:
The java.net.InetAddress class represents an IP address. The Inet Address class provides
methods to get the IP of any host name.
import java.io.*;
import java.net.*;
public class InetDemo{
public static void main(String[] args){
try{
InetAddress ip=InetAddress.getByName("www.gec.com");
}catch(Exception e){System.out.println(e);}
}
}
Output:
//URLDemo.java
import java.io.*;
import java.net.*;
System.out.print("Protocol: "+url.getProtocol());
System.out.print("Host Name: "+url.getHost());
System.out.print("Port Number: "+url.getPort());
System.out.print("File Name: "+url.getFile());
}catch(Exception e){System.out.println(e);}
}
}
Output:
Protocol: http
Host Name: www.gec.com
Port Number: -1
File Name: /sushruta/index.jsp
Viva-voce questions:
1. What is the role of InetAddress class.
2. Name any two methods available in InetAddress class.
3. What is IP address and what are its versions used in networking.
4. What is URL.
5. State the methods of URL class.
EXPERIMENT No: 8
Aim :
To plot Channel Efficiency for Ethernet in MATLAB.
Apparatus:
MATLAB software
Procedure:
Ethernet(pronounced "eether net") is a local area network, connecting computers together with
cables so the computers can share information. Within each main branch of the network,
Ethernet can connect up to 1,024 personal computers and workstations. Ethernet is a SHARED
MEDIUM network technology, where all the workstations are connected to the same cable and
must contend with one another to send signals over it. The algorithm used to resolve collisions -
that is, when two workstations try to speak at the same time - is called CSMA/CD, and works by
forcing both workstations to back off for random (and hence probably different) intervals before
trying again. The maximum data rate of the original Ethernet technology is 10 megabits per
second (Mbps), but a second generation FAST ETHERNET carries 100 Mbps, and the latest
version called GIGABIT ETHERNET works at 1000 Mbps. SWITCHED ETHERNET involves
adding switches so that each workstation can have its own dedicated 10 Mbps connection rather
than sharing the medium, which can improve network throughput - it has the advantage over
rival switched technologies such as ASYNCHRONOUS TRANSFER MODE that it employs the
same low-level protocols, cheap cabling and NETWORK INTERFACE CARDS as ordinary
Ethernet.
clc;
b=input('enter the b.w.');
l=input('enter the input length');
c=input('enter the input capacity');
k=1:256;
f1=64*8;
f2=128*8; f3=256*8;
p=((k-1)/k).^(k-1);
x=(2*b*l)./(c.*p);
a1=x./f1;
a2=x./f2;
a3=x./f3;
n1=1./(1+a1);
n2=1./(1+a2);
n3=1./(1+a3);
plot(k,n1,'rd:');
hold on;
plot(k,n2,'gp:');
hold on;
plot(k,n3,'bh:');
xlabel('no of attempts');
ylabel('efficiency');
title('channel efficiency');
legend('64*a','128*8','256*8','location','northeastoutside');
Result:
BW : 20000000
Enter the input length:2500
Enter the input capacity:1000000
Aim:
To write a C program to perform sliding window.
Apparatus:
Turbo C/C++ software
Theory:
the sliding window is an abstract concept that defines the range of sequence numbers that is the
concern of the sender and receiver. In other words,the sender and receiver need to deal with only
part of the possible sequence numbers. The range which is the concern of the sender is called the
send sliding window; the range that is the concern of the receiver is called the receive sliding
window. We discuss both here. The send window is an imaginary box covering the sequence
numbers of the data frames which can be in transit. In each window position, some of these
sequence numbers define the frames that have been sent; others define those that can be sent.
The maximum size of the window is 2m 1. The send window is an abstract concept defining an
imaginary box of size 2m ~ 1 with three variables: Sp Sm and Ssize. The send window can slide
one or more slots when a valid acknowledgment arrives. The receive window is an abstract
concept defining an imaginary box of size 1 with one single variable Rn The window slides
when a correct frame has arrived; sliding occurs one slot at a time.
Algorithm:
1. Start the program.
2. Get the frame size from the user
3. To create the frame based on the user request.
4. To send frames to server from the client side.
5. If your frames reach the server it will send ACK signal to client otherwise it will send NACK
signal to client.
6. Stop the program
Result:
Thus the above program sliding window protocol was executed and successfully
Viva-voce:
Aim:
To simulate the OPEN SHORTEST PATH FIRST routing protocol based on the cost assigned to
the path.
Apparatus:
Turbo C/C++ software
ALGORITHM:
1.Read the no. of nodes n
2.Read the cost matrix for the path from each node to another node.
3.Initialize SOURCE to 1 and include 1
4. Compute D of a node which is the distance from source to that corresponding
node.
5.Repeat step 6 to step 8 for n-l nodes.
6.Choose the node that has not been included whose distance is minimum
and include that node.
7.For every other node not included compare the distance directly from the
source with the distance to reach the node using the newly included node
8.Take the minimum value as the new distance.
9.Print all the nodes with shortest path cost from source node
Viva-voce questions:
EXPERIMENT 1
Aim:
Implementation of the Go Back N sliding window protocol
Apparatus:
Turbo C software
Logic:
Two basic approaches are available foe dealing with errors in the presence of the pipelining. One
way, called go back n, is for the receiver simply to discard all subsequent frames, sending no
acknowledgements for the discarded frames. This strategy corresponds to a receive window of
size 1. In other words, the data link layer refuses to accept any frame except the next one it must
give to the network layer. If the senders window fills up before the timer runs out, the pipeline
will begin to empty. Eventually, the sender will time out and retransmit all unacknowledged
frames in order, starting with the damaged or lost one. This approach can waste a lot of
bandwidth if the error rate is high. We see go back n for the case in which the receivers window
is large. Frames 0 and 1 are correctly received and acknowledged. Frame 2 however, is damaged
or lost. The sender unaware of this problem, continues to send frames until the timer for frame 2
expires. Then it backs up frame 2 and starts all over with it, sending 2, 3, 4, etc all over again.
PseudoCode:
Void protocol5(void)
{
MAX3SEQ > 1; used for outbound stream oldest
frame as yet unacknowledged next frame expected
on inbound stream initialize scratch variable
buffers for the outbound stream
while(true)
{
four possibilities: see event_type above the
network layer has a packet to send fetch new
packet
expand the senders window
transmit the frame
advance senders upper window edge a data
or control frame has arrived
get incoming frame from physical layer
}
} /*end of protocol5*/
Viva-voce questions:
Aim:
Implementation of the data link framing methods for the bit stuffing in a frame.
Apparatus:
Turbo C/C++ software
LOGIC:
In a bit-oriented protocol, the data section of a frame is a sequence of bits to be interpreted by the
upper layer as text, graphic, audio, video, and so on. However, in addition to headers (and
possible trailers), we still need a delimiter to separate one frame from the other. Most protocols
use a special 8-bit pattern flag 01111110 as the delimiter to define the beginning and the end of
the frame. In bit-oriented protocols, we use bit stuffing; an extra 0 is added to the data section of
the frame when there is a sequence of bits with the same pattern as the flag. Stuffing a 0 bit in a
data frame in order to differentiate the header, trailer and data. if the flag pattern appears in the
data, we need to somehow inform the receiver that this is not the end of the frame. We do this by
stuffing 1 single bit (instead of I byte) to prevent the pattern from looking like a flag. The
strategy is called bit stuffing. In bit stuffing, if a 0 and five consecutive I bits are encountered, an
extra 0 is added. This extra stuffed bit is eventually removed from the data by the receiver. Note
that the extra bit is added after one 0 followed by five 1s regardless of the value of the next bit.
This guarantees that the flag field sequence does not inadvertently appear in the frame.
PSEUDO CODE:
At sender:
INPUT:
OUTPUT:
At Receiver:
OUTPUT:
Viva-voce questions:
1. Compare and contrast byte-oriented and bit-oriented protocols. Which category has been
popular in the past. Which category is popular now.
2. State the main logic in bit stuffing.
3. Define Framing.
4. Distinguish between Flow control and Error control.
5. Give one real life example where bit stuffing is used.
EXPERIMENT No: 3
Aim:
To implement wired network topology and wireless network Topology in NS2.
Apparatus:
NS2 simulator
NS2:
The Network Simulator version 2 (NS-2) is a deterministic discrete event network simulator,
initiated at the Lawrence Berkeley National Laboratory (LBNL) through the DARPA funded
Virtual Internetwork Test bed (VINT) project. NS-2 was initially created in 1989 as an
alternative to the REAL Network Simulator. Since then there is significant growth in uses and
width of NS project. Although there are several different network simulators available today, ns-
2 is one of the most common. NS-2 differs from most of the others by being open source
software, supplying the source code for free to anyone that wants it. Whereas most commercial
network simulators will offer support and a guarantee but keeping the moneymaking source code
for themselves.