Lab Manual CN
Lab Manual CN
Coimbatore-641 105
(An ISO 9001:2008 Certified Institution)
ENGINEERING
NETWORKS LABORATORY
(V SEMESTER)
MANUAL
*Open Source Software Tools like Ethereal /Wireshark Opnet IT Guru, Network
Simulator 2, Router Simulator may be used for Simulation.
2
LIST OF EXPERIMENTS:
CYCLE 01
CYCLE 02
3
INDEX
4
1. STUDY THE PERFORMANCE OF CSMA/CD
AIM:
EQUIPMENTS REQUIRED:
It augments the CSMA algorithm to handle the collision. In this method, a station
monitors the medium after it sends a frame to see if the transmission was successful. If so, the
station is finished. If, however, there is a collision, the frame is sent again. The throughput of
CSMA/CD is greater than that of pure or slotted ALOHA. The basic idea is that a station needs
to be able to receive while transmitting to detect a collision. When there is no collision, the
station receives one signal; its own signal. When there is collision, the station receives two
signals; its own signal and signal transmitted by a second station.
PROCEDURE:
1. Click on the MAC Experiment icon twice from the desktop on both PC’s.
2. Click the Configuration button in the window in both the PC’s.
5
6
7
8
TABULATION:
9
RESULT:
10
2. STUDY AND IMPLEMENTATION OF STOP & WAIT
PROTOCOL
AIM:
(i) To study the performance of Stop and Wait protocol and find its throughput.
(ii) To plot Timeout (T) Vs Throughput (X) for various Ts.
(iii) To plot BER Vs X for various BERs {10-2,10-3,10-4,10-5,10-6}
EQUIPMENTS REQUIRED:
In a stop and wait method of flow control, the sender waits for an acknowledgement after
every frame it sends. Only when an acknowledgement has been received, the next frame is sent.
This process of alternately sending and waiting repeats until the sender transmits on end of
transmission frame. The advantage is simplicity and the disadvantage is its inefficiency.
Stop and wait ARQ is a form of stop and wait flow control extended to include
retransmission of data in case of damaged frames. For retransmission to work, four features are
added to the basic flow control mechanism.
The sending device keeps a copy of the last frame transmitted until it receives an
acknowledgement for that frame. Keeping a copy allows the sender to retransmit lost or damaged
frames until they are received correctly.
For identification purposes with data frames and ACK frames are numbered alternately 0
and 1. An ACK 1 frame, indicating that the receiver has gotten data 0 and is now expecting data
1, acknowledges a data 0 frame. This numbering allows for identification allows for
identification of data frames in case of duplicate transmission.
If an error is discovered in a data frame, indicating that it has been corrupted in transit, a
NAK frame is returned. NAK frames, which are not numbered, tell the sender to retransmit the
last frame sent. Stop and wait ARQ requires that the sender waits till it receives an
11
acknowledgement for the frame, last sent by it, before it transmits the next one. When the sender
receives a NAK, it retransmits the frame sent after the previous ACK, irrespective of the number.
The sending device is equipped with a timer.
12
13
14
PROCEDURE FOR BER:
15
TABULATION:
BER=0
TABULATION:
THT=1000
16
RESULT:
Thus the STOP AND WAIT protocol was studied and graph was plotted.
17
3. STUDY THE PERFORMANCE OF CSMA/CA
AIM:
To perform file transfer and data transfer using different topoloies in wireless LAN
protocol.
THEORY:
Wireless LAN is basically a LAN that transmits data over air without any physical
connection between devices. The transmission medium is a form of electromagnetic radiation
wireless LAN is rectified by IEEE in the IEE 8021 standard. The underlaying algorithm used in
wireless LAN is known as the CSMA/CA - Carrier Sense Multiple Access/ Collision Avoidance
algorithm the working of CSMA/CD algorithm. The approach called CSMA/CA is adopted by
the IEEE 802.11 wireless LAN standard. In CSMA/CA, if the station finds the channel busy, it
does not restart the timer of the contention window; it stops the timer and restarts it when the
channel becomes idle. When an idle channel is found, the station does not send immediately. It
waits for a period of time the interframe space or IFS. If after the IFS time the channel is still
idle, the station can send, but it still needs to wait a time equal to the contention time.
The mode has data to transmit senses the medium, if the medium has been idle for layer
than the DIFS. It finishes its back off interval and transmits request to send signal immediately.
PROCEDURE:
1. Open the protocol always activate to 100 link into configuration addressed and the server.
3. Value the network connection in that disable LAN and enable the wireless LAN.
4. Then select Vi-Rt sim and can do any type of process such that token ring, token bus, PC to
PC and so on.
5. Put the IP address and transfer the data and receive it.
18
TIMING DIAGRAM:
RTS-Request To Send
CTS-Clear To Send
19
OUTPUT:
20
21
RESULT:
Thus, the transfer of file, data is done using different topologies by wireless LAN.
22
4. TOKEN BUS
AIM:
EQUIPMENTS REQUIRED:
THEORY:
Token bus was a 4Mbps local area networking technology created by IBM to connect
their terminals to mainframes. Token bus utilized a copper coaxial cable to connect multiple. The
coaxial cable saved as a common communication bus and a token was created by token bus
protocol to manage or arbitrate access to the bus.
Any station that has token packet has permission to transmit data. The station releases
token when it is done communication or when a higher priority device needs to transmit. Token
bus suffered two major limitations-any failure in bus caused all the devices beyond failure to be
able to communicate with rest of the network. Secondly adding more stations to bus was
difficult. Token bus was thus seen as unreliable and difficult to expand and upgrade.
Token ring was created by IBM to improve upon the previous bus technology. Token
ring uses a ring-based technology and passes a token around the network to control access to
network wiring. The token ring protocol also provides features for allowing delay sensitive
traffic to share network with other data that is key to mainframe operations.
23
24
25
26
TABULATION:
RESULT:
27
5. TOKEN RING
AIM:
EQUIPMENTS REQUIRED:
THEORY:
Token bus was a 4Mbps local area networking technology created by IBM to connect
their terminals to mainframes. Token bus utilized a copper coaxial cable to connect multiple. The
coaxial cable saved as a common communication bus and a token was created by token bus
protocol to manage or arbitrate access to the bus.
Any station that has token packet has permission to transmit data. The station releases
token when it is done communication or when a higher priority device needs to transmit. Token
bus suffered two major limitations-any failure in bus caused all the devices beyond failure to be
able to communicate with rest of the network. Secondly adding more stations to bus was
difficult. Token bus was thus seen as unreliable and difficult to expand and upgrade.
Token ring was created by IBM to improve upon the previous bus technology. Token
ring uses a ring-based technology and passes a token around the network to control access to
network wiring. The token ring protocol also provides features for allowing delay sensitive
traffic to share network with other data that is key to mainframe operations.
28
29
30
31
TABULATION:
RESULT:
32
6. STUDY AND IMPLEMENTATION OF SLIDING WINDOW
GO BACK-N
AIM:
(i) To study the performance of Go-Back-N protocol and find its throughput.
(ii) To plot G Vs X for various values of T {100,250,500,750,1500,3000} and various
window sizes Ws {2,4,8}
(iii) To plot BER Vs X for Ws =4
EQUIPMENTS REQUIRED:
In this sliding window Go-Back_N ARQ method, if one frame is lost or damaged, all
frames sent since the last frame acknowledge are retransmitted.
Damaged Frame: When the frames 0, 1, 2 and 3 have been transmitted but the first
acknowledgement received is a NAK 3, there are 2 meanings for the NAK. First, a positive
acknowledgement of all frames received prior to the damaged frame and second, a negative
acknowledgement of the frame indicated. If the first acknowledgement of the indicated is a NAK
3, it means that data frames 0,1 and 2 were all received in good shape. Only frame 3 must be
resent. If frames 0 through 4 have been transmitted before a NAK is received, the receiver
discovers and error, it stops accepting subsequent frames until the damaged frame has been
replaces correctly.
Lost data frame: Sliding window protocols require that the data frame be transmitted
sequentially. If one or more frames are noise corrupted that they are lost in transit, the next frame
that arrives at the receiver will be out of sequence. The receiver that one or more have skipped
and returns a NAK for the first missing frames. A NAK frame does not indicate whether the
frame has been lost or damaged, first that it means to be resent. The sending device then
retransmits the frame indicated by the NAK, as well as any frame that it had transmitted after the
last one.
33
34
35
TABULATION
BER=0
36
TABULATION:
37
RESULT:
Thus the SLIDING WINDOW GO BACK-N protocol was implemented and graph was
plotted.
38
7. STUDY AND IMPLEMENTATION OF SLIDING WINDOW
SELECTIVE REPEAT
AIM:
(i) To study the performance of Selective Repeat protocol and find its throughput.
(ii) To plot G Vs X for various values of T {100,250,500,750,1500,3000} and various
window sizes Ws {2,4,8}
(iii) To plot BER Vs X for Ws =4
EQUIPMENTS REQUIRED:
39
40
TABULATION:
41
PROCEDURE FOR SELECTIVE REPEAT WITH BER:
42
TABULATION:
RESULT:
Thus the SLIDING WINDOW SELECTIVE REPEAT protocol was implemented and graph
was plotted.
43
8. IMPLEMENTATION OF DISTANCE VECTOR ROUTING
ALGORITHM
AIM:
EQUIPMENTS REQUIRED:
THEORY:
In routing, the pathway with the lowest cost is considered the best. As long as the
cost of each link is known, a router can find the optimal combination for any transmission.
Several routing algorithms exist for making these calculations. The most popular are the distance
vector and the link state routing algorithm.
In this method, each router periodically shares its knowledge about the entire
network with its neighbors. The three keys to understanding how this algorithm works are
knowledge about the whole network, routing only to neighbors, information sharing at regular
intervals. Distance vector routing simplifies the routing process by assuming a cost of one unit
for every link. In this way, the efficiency of transmission is a function only of the number of
links required to reach a destination. In distance vector routing, the cost of is based on hop count.
A router sends its knowledge to its neighbors. The neighbors add this knowledge to their own
knowledge and send the whole table to their own neighbors. Eventually, every router knows
about other router in the internetwork.
44
45
46
47
48
49
RESULT:
50
9. IMPLEMENTATION OF LINK STATE ROUTING
AIM:
To implement the link state routing algorithm
EQUIPMENTS REQUIRED:
THEORY:
In routing, the pathway with the lowest cost is considered the best. As long as the
cost of each link is known, a router can find the optimal combination for any transmission.
Several routing algorithms exist for making these calculations. The most popular are the distance
vector and the link state routing algorithm.
In this state routing, each router shares its knowledge of its neighborhood with
every other router in the internetwork. In link state algorithm, the keys are, knowledge about the
neighborhood, to all routers, information sharing when there is a change. A router gets its
information about its neighbors by periodically sending them a short greeting packet. If the
neighbor responds to the greeting as expected, it is assumed to be alive and functioning. If it does
not, a change is assumed to have occurred and the sending router then alerts the rest of the
network in its next LSP. In link state routing, every router has exactly the same link state
database.
51
52
53
54
55
RESULT:
56
10. DATA ENCRYPTION AND DECRYPTION USING RC4
ALGORITHM
AIM
To encrypt a file using RC4 encryption algorithm and decrypt the same.
EQUIPMENTS REQUIRED:
THEORY:
To carry sensitive information such as military or financial data, a system must be able to
assure privacy. Microwave, satellite and other wireless media, however, cannot be protected
from the unauthorized reception (or interception) of transmission. Even cable systems cannot
always prevent unauthorized access. Cables pass through out-of-the-way areas (such as
basements) that provide opportunities for malicious access to access to the cable and illegal
reception of information.
It is unlikely that any system can completely prevent unauthorized access to transmission
media. A more practical way to protect information is to alter it so that only an authorized
receiver can understand it. Data tampering is not a new issue, nor is it unique to the computer
era.
In fact, there are methods to make information unreadable b unauthorized receivers. The
method used today is called the encryption and decryption of information. Encryption means that
the sender transforms the original information to another form and sends the resulting
unintelligible message out over the network. Decryption reverses the encryption process in order
to transform the message back to its original form.
The sender uses an encryption algorithm and a key to transfer the plaintext (the original
message) into a cipher text (the encrypted message). The receiver uses a decryption algorithm
and a key to transform the cipher text back to the original plaintext.
57
Initial Setup:
1. Browse ‘C:\Lantrain\DataSecurity’.
2. Copy the ‘RC4’ folder and three class files (Connect, RC4Client, Server) and
paste it into the ‘Java\jdk1.5\bin’ folder in both the server and client PC’s
Encrypting a file:
1. Open command prompt in the client side.
2. Browse the java bin folder.
3. Type ‘java RC4Client’.
7. Enter the path name of the file to be encrypted. (for eg: c:\\abc.txt)
58
8. Type YES if you like to close the session or type NO if you like to continue
10. Try to re-arrange the cipher text using any crypt-analysis tool.
1. Enter the mode of operation as DEC for decrypting the cipher text.
3. Enter the full path name of the file to be decrypted. (i.e., c:\\output.txt)
59
RESULT:
Thus the RC4 encryption algorithm was used to encrypt the file and decrypt the same.
60
11. STUDY THE PERFORMANCE OF CSMA/CD USING NS2
SIMULATION
AIM:
PROGRAM:
62
$tcp3 set window_ 1
$tcp3 set maxcwnd_ 1
$tcp3 set fid_ 1
$ns attach-agent $n0 $tcp3
set sink3 [new Agent/TCPSink]
$ns attach-agent $n1 $sink3
$ns connect $tcp3 $sink3
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
$ns at 0.05 "$ftp start"
$ns at 0.071 "$ns queue-limit $n2 $n0 0"
$ns at 0.10 "$ns queue-limit $n2 $n0 5"
$ns at 0.09 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n2 $sink"
$ns at 0.25 "finish"
$ns at 0.05 "$ftp1 start"
$ns at 0.072 "$ns queue-limit $n2 $n1 0"
$ns at 0.10 "$ns queue-limit $n2 $n1 5"
$ns at 0.09 "$ns detach-agent $n1 $tcp1 ; $ns detach-agent $n2 $sink1"
$ns at 0.25 "finish"
$ns at 0.10 "$ftp2 start"
$ns at 0.13 "$ns detach-agent $n0 $tcp2 ; $ns detach-agent $n1 $sink2"
$ns at 0.25 "finish"
$ns at 0.12 "$ftp3 start"
$ns at 0.14 "$ns detach-agent $n1 $tcp1 ; $ns detach-agent $n0 $sink3"
$ns at 0.25 "finish"
$ns at 0.0 "$ns trace-annotate \"CSMA/CA\""
$ns at 0.05 "$ns trace-annotate \"FTP starts at 0.01\""
$ns at 0.05 "$ns trace-annotate \"Send Packet_1 from SYS1 to SYS0 and Packet_2 from SYS0 to
SYS1 \""
$ns at 0.73 "$ns trace-annotate \"Collision Occurs so 2 Packets are lossed\""
$ns at 0.10 "$ns trace-annotate \"Retransmit Packet_1 from SYS1 to SYS0 \""
$ns at 0.12 "$ns trace-annotate \"Retransmit Packet_2 from SYS0 to SYS1 \""
$ns at 0.20 "$ns trace-annotate \"FTP stops\""
proc finish {} {
global ns nf
$ns flush-trace
close $nf
puts "filtering..."
#exec tclsh ../bin/namfilter.tcl csma.nam
#puts "running nam..."
exec nam csma.nam &
exit 0
}
$ns run
63
OUTPUT:
RESULT:
64
12. STUDY THE PERFORMANCE OF TOKEN BUS USING NS2
SIMULATION
AIM:
To study and simulate the TOKEN BUS protocol.
PROCEDURE:
PROGRAM:
70
OUTPUT:
71
RESULT:
72
13. STUDY THE PERFORMANCE OF TOKEN RING USING NS2
SIMULATION
AIM:
PROCEDURE:
73
for {set i 0} {$i < 6} {incr i} {
set n($i) [$ns node]
}
$ns color 1 purple
$ns color 2 green
$ns color 3 darkgreen
for {set i 0} {$i < 6} {incr i} {
$ns duplex-link $n($i) $n([expr ($i+1)%6]) $Bandwidth 10ms DropTail
}
set tcp1 [new Agent/TCP]
$ns attach-agent $n(0) $tcp1
$tcp1 set fid_ 1 ;
set sink1 [new Agent/TCPSink]
$ns attach-agent $n(3) $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set tcp2 [new Agent/TCP]
$ns attach-agent $n(3) $tcp2
$tcp2 set fid_ 1 ;
set sink2 [new Agent/TCPSink]
$ns attach-agent $n(5) $sink2
$ns connect $tcp2 $sink2
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set tcp3 [new Agent/TCP]
$ns attach-agent $n(5) $tcp3
$tcp3 set fid_ 1 ;
set sink3 [new Agent/TCPSink]
$ns attach-agent $n(2) $sink3
$ns connect $tcp3 $sink3
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set tcp4 [new Agent/TCP]
$ns attach-agent $n(2) $tcp4
$tcp4 set fid_ 1 ;
set sink4 [new Agent/TCPSink]
$ns attach-agent $n(4) $sink4
$ns connect $tcp4 $sink4
set ftp4 [new Application/FTP]
74
$ftp4 attach-agent $tcp4
set tcp5 [new Agent/TCP]
$ns attach-agent $n(4) $tcp5
$tcp5 set fid_ 1 ;
set sink5 [new Agent/TCPSink]
$ns attach-agent $n(0) $sink5
$ns connect $tcp5 $sink5
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
set udp0 [new Agent/UDP]
$ns attach-agent $n(5) $udp0
$udp0 set fid_ 3 ;
$tcp3 set fid_ 2 ;
set cbr0 [new Application/Traffic/CBR]
$cbr0 set interval_ $intval
$cbr0 attach-agent $udp0
set null0 [new Agent/Null]
$ns attach-agent $n(2) $null0
$ns connect $udp0 $null0
$ns at 0.1 "$ftp1 start"
$ns at 0.125 "$ns detach-agent $n(0) $tcp1; $ns detach-agent $n(3) $sink1"
$ns at 1.0 "finish"
$ns at 0.131 "$ftp2 start"
$ns at 0.14 "$ns detach-agent $n(3) $tcp2; $ns detach-agent $n(5) $sink2"
$ns at 1.0 "finish"
$ns at 0.157 "$ftp3 start"
$ns at 0.185 "$ns detach-agent $n(5) $tcp3; $ns detach-agent $n(2) $sink3"
$ns at 1.0 "finish"
$ns at 0.19 "$ftp4 start"
$ns at 0.21 "$ns detach-agent $n(2) $tcp4; $ns detach-agent $n(4) $sink4"
$ns at 1.0 "finish"
$ns at 0.211 "$ftp5 start"
$ns at 0.22 "$ns detach-agent $n(4) $tcp5; $ns detach-agent $n(0) $sink5"
$ns at 1.0 "finish"
$ns at 0.157 "$cbr0 start"
#$ns rtmodel-at 1.0 down $n(1) $n(2)
#$ns rtmodel-at 2.0 up $n(1) $n(2)
$ns at 0.185 "$cbr0 stop"
$ns at 1.0 "finish"
$ns run
75
OUTPUT:
76
RESULT:
77
14. STUDY OF ERROR DETECTING CODE CYCLIC REDUNDANCY
CHECK (CRC)
AIM:
To study a category of cyclic codes called the cyclic redundancy check (CRC) that is
used in networks such as LANs & WANs.
THEORY:
Cyclic codes are special linear block codes, which are extra property. In a cyclic code, if
a code word is cyclically shifted the result is another codeword.
ENCODER:
In the encoder, the data word has k bits the codeword has n bits. The size of the data
word is augmented by adding n-k, as to right hand side of the word. The n bit result is fed into
the generator. The generator uses a divisor of n-k+1, predefined and agreed assign. The
generator devices the quotient of the division in discarded the remainder is appended to the data
word to create the codeword.
78
The generator devices the quotient of the divisor is dicarded the remainder is appended to the data
woed to create the code word. The process of module 2 binary division is same as the familiar division
process, are use free the decimal numbers. As in decimal division. The process is done step by step in
each step, a copy of the divisor is xored with the 4 bit of the divident the result of the XOR operation is 3
bit whish is used for next step after one extra bit is pulled down to make it 4 bit long. It left most bit of
divident is 0, the step cannot the regular divisor and need to use all 0 s divisor.
When there are no bits of left to pull down and have a result. The 3 bit remainder from the chech
bit (r2,r1 and r0) they are appended to the dataword to create codeword.
DECODER:
The decoder receives the possible output & codeword is copy of its n bits is fet to the
checker is a replace of the generator. The remainder produced by the checker is a syndrome of N-R bits,
which is fed to the divisor logic analyser. The analyser has a simple logic analysis function . If the
syndrome bits are all 0’s. The 4 left most bits of the codeword are accepted as the dataword otherwise the
4 bit are discarded.
The codeword can chane during transmission the decoder does the same division process as the
encoder. The remainder of the division is the syndrome. If the syndrome is all 0’s there is no error.
DIVISOR:
The divisor is repeatly XORed with part of the divident. One interesting point about the
communication window is that the station needs to sense the channels after each time slot.
ACKNOWLEDEMENT:
With all there precautions, there still may be a collision resulting in destroyed data.In addition,
data may be corrupted during the transmission. The positive acknowledgement and the timeout timer can
help guarantee that the receiver was received the frame.
RESULT:
Thus a category of cyclic codes called cyclic redundacy check was studied.
79
15. STUDY OF IP SUBNET
AIM
To study IP subnet
THEORY
SUBNETTING:
During the era of classical addressing subnetting was introduced. If an organization was
granted a large book in class A or class B it could divide the address into several contiguous
groups and assigns each group to smaller networks called as subnets or in rare case share part of
the address with neighbors subnetting increases the number of 1s in the masks.
An organization that is granted a large block of addressing may want to create clusters of
networks and decade the address between the different subnet. The rest of the word still sees the
organization as one entity, however internally there are several subnets. All message, are sent to
the router address that connects the organization, however needs to create small sub-blocks of
address, each assigned to specific subnets. The organization has its own mask, each subnet mask
also have its own.
Let us check to see if we can find the subnet address from one of the address in the
subnet.
a) In subnet 1, the address 11.12.14.29/27 can gives us the subnet address, if we use the
mask/27 because
Mask/27
17.12.14.0
b) In subnet 2, the address 17.12.14.45/28 can give us the subnet address, it we use the
mask/28 because
80
Host: 00010001 00001100 00001110 00101101
Mask/28
17.12.14.32
c) In subnet 3, the address 17.12.14.50/28 can give us the subnet address, it we use the
mask/28 because
Mask/28
17.12.14.48
We can say that through subnetting, we have three levels of hierarchy. So the subnet
prefix length can differ for various subnets. More levels of hierarchy.
The structure of classless addressing does not restrict the number of hierarchical levels.
An organization can divide the granted blocks of address into smaller sub blocks and so on. One
example of this is seen in ISPS. A national ISP can divide a granted large block into smaller
block and assign each of them to a regional ISP. A regional ISP can divide the block received
from the national ISP smaller blocks and assign one to a different organization. Finally an
organization can divide smaller blocks and assigns each and make several subnets out of it.
ADDRESS ALLOCATION:
The next issue in classes addressing is address allocation. The ultimate responsibility of
address allocation is given to a global authority called the internet corporation for assigned
names and address (ICANN). However ICANN does not normally allocate address to individual
organization. It assigns a large block of address to an ISP. Each ISP in turn divides in assigned
block into smaller sub blocks and grants the sub blocks to its customers. In other words an ISP
receiver one large block to be distributed. This is called address propagation.
81
Fig: SUBNET
82
Fig: Three level hierarchy is an IP/4 address
RESULT:
Thus IP subnet was studied.
83