Download as pdf or txt
Download as pdf or txt
You are on page 1of 43

S. S.

Education Trust’s

S. G. Balekundri Institute of Technology


[Affiliated to Visvesvaraya Technological University (VTU), Belagavi, Karnataka]

DEPARTMENT OF ELECTRONICS AND


COMMUNICATION ENGINEERING
B.E - VI Semester
2020-21 [EVEN SEMESTER]

COMPUTER NETWORKS LAB

[As per Choice Based Credit System (CBCS) scheme 17ECL68]

Prepared by Approved by
Prof. Anita .P Asst. Professor Dr. Jayashri M.Rudagi
Prof. Vinayak.H Asst. Professor Head of the Department

Prof. Megha K. Asst. Professor


Institute Vision
To Impart Quality Education with Human Values and emerge as of one of the
Nation’s Leading Institutions in the field of Technical Education and Research.

Institute Mission
• Strive to encourage ideas, talents and value systems.
• Guide students to be successful in the endeavor with moral and
ethical values.
• Build relation with Industries and National Laboratories to support
in the field of Engineering and Technology.
• Inculcate a thirst for knowledge in students and help them to
achieve Academic Excellence and Placement.
• Train and develop the faculty to achieve Professional,
Organizational Objectives, and excel in Research and
Development.
Department Vision
To be the department of Electronics and Communication Engineering striving hard
to develop responsive teaching–learning methodology, research and employable
skills in allied fields by empowering students to become globally competent and
socially responsible citizens.

Department Mission
M1: To develop an active learning environment that ensures participation of
students in both curricular as well as co-curricular activities.
M2: To foster research, innovation and creativity amongst students.
M3: To encourage development of entrepreneurial skills.
M4: To inculcate, amongst students, team-spirit, leadership qualities, positive
attitude and effective communication skills to solve societal needs.
Program Educational Objectives (PEOs)

PEO1: Be successful in their professional career, higher studies and


research by providing contextually relevant academics environment.
PEO2: Be committed citizens with social and professional concern.
PEO3: Demonstrate leadership qualities and managerial skills in
heterogeneous globally.
PEO4: Be independent lifelong learns to keep the pace of technological
change and industry expectations.

Program Specific outcomes (PSOs)


• Apply the concepts of VLSI, Signal Processing, Embedded
Systems, Communication and Networking in the design and
Implementation of application-oriented Engineering systems.
• Solve the Engineering problems using hardware and software tools
along with soft skills leading to Employability
Program Outcomes as defined by NBA (POs)
Engineering Graduates will be able to:
• Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution
of complex engineering problems.
• Problem analysis: Identify, formulate, review research literature, and
analyze complex engineering problems reaching substantiated conclusions
using first principles of mathematics, natural sciences, and engineering
sciences.
• Design/development of solutions: Design solutions for complex
engineering problems and design system components or processes that meet
the specified needs with appropriate consideration for the public health and
safety, and the cultural, societal, and environmental considerations.
• Conduct investigations of complex problems: Use research-based
knowledge and research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to provide valid
conclusions.
• Modern tool usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
modeling to complex engineering activities with an understanding of the
limitations.
• The engineer and society: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues and the
consequent responsibilities relevant to the professional engineering practice.
• Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and
demonstrate the knowledge of, and need for sustainable development.
• Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
• Individual and team work: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.
• Communication: Communicate effectively on complex engineering
activities with the engineering community and with society at large, such as,
being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear
instructions.
• Project management and finance: Demonstrate knowledge and
understanding of the engineering and management principles and apply
these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
• Life-long learning: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest
context of technological change.
Course objectives:
This course will enable students to:
• Make Use of network simulator to understand networking algorithms.
• Utilize C programming to simulate network protocols and algorithms.
• Evaluate the performance parameters by simulating the networks with
different configurations
• Build the data link and routing protocols using C programming.
Course Outcomes:
On the completion of this laboratory course, the students will be able to:
C318.1 Make Use of network simulator to understand networking algorithms.

C318.2 Utilize C programming to simulate network protocols and algorithms.

C318.3 Evaluate the performance parameters by simulating the networks with


different configurations.
C318.4 Build the data link and routing protocols using C programming.

Mapping of CO-PO-PSO

Course Program Outcomes (PO)


Outcome
(CO)

PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
PO1

C318.1 1 1 2 - - 1 2 1 - - 1 -
C318.2 1 1 1 1 - - 1 2 1 - - 1 2
C318.3 1 2 2 2 2 - - 1 2 1 - - 1 -
C318.4 1 1 2 - - 1 2 1 - - 1 2
Set Value 1 1.50 1.50 1.33 1.75 - 1.0 2.0 1.0 - - 1.0 2.0
Do’s and Don’ts in the Laboratory
DO’S

1. Students should come with thorough preparation for the experiment to be


conducted.
2. Students should take prior permission from the concerned faculty before
availing the leave.
3. Students should come with formals and to be present on time in the laboratory.
4. Students will not be permitted to attend the laboratory unless they bring the
practical record fully completed in all respects pertaining to the experiment
conducted in the previous class.
5. Students will be permitted to attend laboratory unless they bring the observation
book fully completed in all respects pertaining to the experiment conducted in the
present class.
6. They should obtain the signature of the staff-in-charge in the observation book
after completing each experiment.
7. Practical record and observation book should be maintained neatly.
8. Use devices carefully.
DON’Ts
1. Enter the laboratory without ID card, Observation book and journal.
2. Handle any equipment before reading the instructions / Manuals.
3. Remove anything from the kits / experimental set up without permission. Doing
so will attract fine.
4. Leave the lab without verification of components by laboratory instructor.
5. Misbehave in the laboratory.
6. Use cell phones.
7. Use Pen drives.
8. Eat, drink, and chew gum in the lab.
VTU Syllabus
Computer Networks Lab (17ECL68)

IAMarks20 Exam Marks 80

ExamHours03 Laboratory=03(01HrTutorial(Instructions)+02Hrs)

Laboratory Experiments

PART-A:

Simulation experiments using NS2/ NS3/ OPNET/ NCTUNS/ NetSim/ QualNet/ Packet
Tracer or any other equivalent tool

1. Implement a point to point network with four nodes and duplex links between them.
Analyze thenetworkperformancebysettingthequeuesizeandvaryingthe
bandwidth.
2. Implement a four nodepoint to pointnetwork with linksn0-n2, n1-n2 and n2-n3.
Apply TCP agent between n0-n3 and UDP between n1-n3. Apply relevant applications
over TCP and UDP agentschangingtheparameteranddeterminethenumberof
packetssentbyTCP/UDP.
3. Implement Ethernet LAN using n (6-10) nodes. Compare the throughput by changing
the error rate and datarate.
4. Implement Ethernet LAN using ‘n’ nodes and assign multiple traffic to the nodes
and obtain congestion window for different sources/ destinations.
5. Implement ESS with transmission nodes in Wireless LAN and obtain the
performance parameters.
6. Implementation of Link state routing algorithm.

PART-B:

Implement the following in C/C++

1. Write a program for a HLDC frame to perform the following.


i) Bit stuffing
ii) Character stuffing.
2. Writeaprogramfordistancevectoralgorithmtofindsuitablepathfortransmission.
3. Implement Dijkstra’s algorithm to compute the shortest routing path.
4. For the given data, use CRC-CCITT polynomial to obtain CRC code. Verify the
program for the cases.
a) Without error
b) With error
5. Implementation of Stopand Wait Protocoland Sliding Window Protocol.
6. Writea programfor congestion controlusing LeakyBucket Algorithm.
Experiments beyond the Syllabus

1. Implementation of RSA Algorithm


2. Write a program for HLDC frame to perform character count.
INDEX
Sl. No. Title Page No.
Part A
Experiments to be conducted by NS2
1 Implement a point to pint network with four nodes and duplex links between 1
them. Analyze the network performance by setting the queue size and
varyingthebandwidth.

2 Implement a four node point to point networkwith links (n0-n2, n1-n2 and n2-n3) 3
Apply TCP agent between n0-n3 and UDP between n1-n3. Apply relevant
applications over TCP and UDP agentschangingtheparameteranddeterminethe
numberofpacketssentbyTCP/UDP.

3 Implement Ethernet LAN using n (6-10) nodes. Compare the throughput by 5


changing the error rate and datarate.

4 Implement Ethernet LAN using n nodes and assign multiple traffic to the nodes 7
and obtain congestion window for different sources/ destinations.

5 Implement ESS with transmission nodes in Wireless LAN and obtain the performance 9
parameters
6 Implementation of Link state routing algorithm 11

PART B
Experiments to be conducted using C code
1 Write a programfor a HLDC frame toperform the following. 14
1.Bit stuffing
2. Character stuffing.

2 Writeaprogramfordistancevectoralgorithmtofindsuitablepathfortransmission. 18
3 Implement Dijkstra’s algorithm tocompute the shortestrouting path. 20

4 For the given data,use CRC-CCITT polynomial to obtain CRC code. 22


Verify the programfor the cases
a) Without error
b) With error

5 Implementation of Stopand Wait Protocol and Sliding Window Protocol 24

6 Write aprogramfor congestion control usingleakybucketalgorithm. 27

7 Viva Questions 29

Experiments Beyond the syllabus


1 Implementation of RSA Algorithm

2 Write a program for HLDC frame to perform character count.


Introduction to Computer Networks Laboratory
This course provides the students with hands on training with respect to designing, Development,
implementation and evaluation of Computer networks. The evaluation and analysis is performed using NS2
simulator. The implementation is done using TCL scripts.
In this course students will be able to model and implement the simple networks with some nodes and
duplex link between them. Apply the different transport layer (TCP and UDP), routing (LS, DVR) and
application layer (FTP, CBR and HTTP) protocols, then evaluate/analyze the network performance by
setting the queue size, varying bandwidth, error rate and data rate.
Also to implement the wired and wireless LAN with n nodes and multiple traffics and to obtain the
congestion windows for different sources and destinations.
In part B, it is to write “C “code for Data link layer / network layer / transport layer protocols and
services. The programs are compiled using GCC compiler.

Tools Used

Software Tools used in the Computer


Networks Lab

OS Ubuntu [ Linux ]

Simulator NS2[ Network Simulator -2]


( ns-allinone2.35)

C Compiler GCC
(18ECL38) Computer Networks Laboratory

1. Implement a point to pint network with four nodes and duplex links between
them. Analyze the network performance by setting the queue size and varying
the bandwidth.

set ns [new Simulator]


set f [open lab1.tr w]
$ns trace-all $f

set nf [open lab1.nam w]


$ns namtrace-all $nf

proc finish {} {
global f nf ns
$ns flush-trace
close $f
close $nf
exec nam lab1.nam &
exit 0
}

set n0 [$ns node]


set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

$ns duplex-link $n0 $n1 0.3Mb 10ms DropTail #vary bandwidth 0.3, 0.4, 0.5 0.7
$ns duplex-link $n1 $n2 0.3Mb 20ms DropTail #vary bandwidth 0.3, 0.4, 0.5 0.7
$ns duplex-link $n2 $n3 0.3Mb 20ms DropTail #vary bandwidth 0.3, 0.4, 0.5 0.7
$ns queue-limit $n0 $n1 20
$ns queue-limit $n1 $n2 20
$ns queue-limit $n2 $n3 20

set udp0 [new Agent/UDP]


$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005

set null0 [new Agent/Null]


$ns attach-agent $n3 $null0

$ns connect $udp0 $null0

$ns at 0.1 "$cbr0 start"


$ns at 4.5 "$cbr0 stop"
$ns at 5.0 "finish"
$ns run

Dept of ECE SGBIT Belagavi 1


(18ECL38) Computer Networks Laboratory

Steps for execution:



Open gedit editor and type program. Program name should have the extension “ .tcl ”
[root@localhost ~]# gedit lab1.tcl
➢ Save the prog am and quit.

Run the simul tion program
[root@localhost~]# ns lab1.tcl
➢ Here “ns” i dicates network simulator. We get the topology shown in the network animator. Now press the play button in the
simulation window and the simulation will begins.
➢ To calculate the network performance. Execute the following command. For
calculating number of received packets
[root@localhost~]#grep ^r lab1.tr | grep “cbr” | awk “{s+=$6}END{print s}”
For calcul ing total time
[root@loca host~]#grep ^r lab1.tr | grep “cbr” | awk “{s+=$2}END{print s}”

Network performace = (Packet received/ Total Time) (bps)


➢ Write the va
lue of network performance in observation sheet. Repeat the above step by changing the bandwidth to [0.3Mb,
0.4Mb, 0.5Mb, 0.7Mb]to the following line of the program.
$ns duplex-l
➢ $ns

duplex-linink $n0 $n1 0.7Mb 10ms DropTail #vary bandwidth 0.3, 0.4, 0.5 0.7
➢ $n1 $n2 0.7Mb 20ms DropTail #vary bandwidth 0.3, 0.4, 0.5 0.7
$ns duplex
-link $n2 $n3 0.7Mb 20ms DropTail #vary bandwidth 0.3, 0.4, 0.5 0.7
Sl. Bandwidth Network performance
No.
1. 0.3
2. 0.4
3. 0.5
4. 0.7


Plot a graph with x- axis with bandwidth and y-axis with network performance of UDP protocol.

Dept of ECE SGBIT Belagavi 2


(18ECL38) Computer Networks Laboratory

2. Implement a four node point to point network with links n0-n2, n1-n2 and n2-
n3. Apply TCP agent between n0-n3 and UDP between n1-n3.
Apply relevant applications over TCP and UDP agents changing the parameter
and determine the number of packets sent by TCP/UDP.

set ns [new Simulator]

set f [open lab2.tr w]


$ns trace-all $f

set nf [open lab2.nam w]


$ns namtrace-all $nf

$ns color 1 "Blue"


$ns color 2 "Red"

proc finish {} {
global ns f nf
$ns flush-trace
close $f
close $nf
exec nam lab2.nam &
exit 0
}

set n0 [$ns node]


set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

$ns duplex-link $n0 $n2 2Mb 10ms DropTail


$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 2.75Mb 20ms DropTail

$ns queue-limit $n2 $n3 50

set tcp0 [new Agent/TCP]


$ns attach-agent $n0 $tcp0
$tcp0 set class_ 1

set ftp0 [new Application/FTP]


$ftp0 attach-agent $tcp0

set sink [new Agent/TCPSink]


$ns attach-agent $n3 $sink
$ns connect $tcp0 $sink

set udp0 [new Agent/UDP]


$ns attach-agent $n1 $udp0
$udp0 set class_ 2

set cbr0 [new Application/Traffic/CBR]


$cbr0 attach-agent $udp0
$cbr0 set packetSize_ 1000
$cbr0 set interval_ 0.005

Dept of ECE SGBIT Belagavi 3


(18ECL38) Computer Networks Laboratory

set null0 [new Agent/Null]


$ns attach-agent $n3 $null0
$ns connect $udp0 $null0

$ns at 0.1 "$cbr0 start"


$ns at 1.0 "$ftp0 start"
$ns at 4.0 "$ftp0 stop"
$ns at 4.5 "$cbr0 stop"

$ns at 5.0 "finish"


$ns run

Steps for execution:



Open gedit editor and type program. Program name should have the extension “ .tcl ”
[root@localhost ~]# gedit lab2.tcl

Save the program and quit.

Run the simulation program
[root@localhost~]# ns lab2.tcl

Here “ns” indicates network simulator. We get the topology shown in the network animator. Now press the play button in the
simulation window and the simulation will begins.
➢ To calculate the number of packets sent by TCP. Execute the following command.

[root@localhost~]#grep ^r lab2.tr | grep “tcp” -c



To calculate the number of packets sent by UDP. Execute the following command.

[root@localhost~]#grep ^r lab2.tr | grep “cbr” –c

Dept of ECE SGBIT Belagavi 4


(18ECL38) Computer Networks Laboratory

3. Implement Ethernet LAN using n (6-10) nodes. Compare the throughput by


changing the error rate and data rate.

set ns [new Simulator]


set trf [open lab3.tr w]
$ns trace-all $trf
set naf [open lab3.nam w]
$ns namtrace-all $naf

proc finish { } {
global nf ns tf
exec nam lab3.nam &
close $naf
close $trf
exit 0
}

set n0 [$ns node]


set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]

$n1 label "Source"


$n2 label "Error Node"
$n5 label "Destination"

$ns make-lan "$n0 $n1 $n2 $n3" 10Mb 10ms LL Queue/DropTail Mac/802_3
$ns make-lan "$n4 $n5 $n6" 10Mb 10ms LL Queue/DropTail Mac/802_3

$ns duplex-link $n2 $n6 30Mb 100ms DropTail

set udp0 [new Agent/UDP]


$ns attach-agent $n1 $udp0
set cbr0 [ new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
set null5 [new Agent/Null]
$ns attach-agent $n5 $null5
$ns connect $udp0 $null5

$cbr0 set packetSize_ 100


$cbr0 set interval_ 0.001
$udp0 set class_ 1

set err [new ErrorModel]


$ns lossmodel $err $n2 $n6
$err set rate_ 0.7 #vary error rate 0.1, 0.4, 0.5 and 0.7

$ns at 6.0 "finish"


$ns at 0.1 "$cbr0 start"
$ns run

Dept of ECE SGBIT Belagavi 5


(18ECL38) Computer Networks Laboratory

Steps for execution:



Open gedit editor and type program. Program name should have the extension “ .tcl ”
[root@localhost ~]# gedit lab3.tcl
➢ Save the progra m and quit.

Run the simulat ion program
[root@localhost~]# ns lab3.tcl
➢ Here “ns” indicates network simulator. We get the topology shown in the network animator. Now press the play button in the
simulation window and the simulation will begins.
➢ To calculatethe throughput. Execute the following command. For
calculating number of received packets
[root@loca host~]#grep ^r lab3.tr | grep “2 6” | awk “{s+=$6}END{print s}”
For calculaing total time
[root@loca host~]#grep ^r lab3.tr | grep “2 6” | awk “{s+=$2}END{print s}”

Throughput = (Packet received/ Total Time) (bps)



Write the val e of throughput in observation sheet. Repeat the above step by changing the error rate to the following
line of the program.

$err set rat e_ 0.7 #vary error rate 0.1, 0.4, 0.5 and 0.7

Sl. Error rate Throughput


No.
1. 0.1
2. 0.4
3. 0.5
4. 0.7


Plot a graph with x- axis with Error rate and y-axis with Throughput.

Dept of ECE SGBIT Belagavi 6


(18ECL38) Computer Networks Laboratory

4. Implement Ethernet LAN using n nodes and assign multiple traffic to the
nodes and obtain congestion window for different sources/ destinations.

set ns [new Simulator]


set tf [open lab4.tr w]
$ns trace-all $f

set nf [open lab4.nam w]


$ns namtrace-all $nf

proc finish {} {
global ns tf nf outFile1 outFile2
$ns flush-trace
close $tf
close $nf
exec nam lab4.nam &
exec xgraph Congestion1.xg Congestion2.xg -geometry 400x400
& exit 0
}

set n0 [$ns node]


set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]

$n0 label "Src1"


$n4 label "Dst1"
$n1 label "Src2"
$n5 label "Dst2"

$ns make-lan "$n0 $n1 $n2 $n3 $n4 $n5 " 10Mb 30ms LL Queue/DropTail Mac/802_3

set tcp1 [new Agent/TCP]


$ns attach-agent $n0 $tcp1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set sink1 [new Agent/TCPSink]
$ns attach-agent $n4 $sink1
$ftp1 set maxPkts_ 1000
$ns connect $tcp1 $sink1

set tcp2 [new Agent/TCP/Reno]


$ns attach-agent $n1 $tcp2
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set sink2 [new Agent/TCPSink]
$ns attach-agent $n5 $sink2
$ftp2 set maxPkts_ 1000
$ns connect $tcp2 $sink2

set outFile1 [open Congestion1.xg w]


set outFile2 [open Congestion2.xg w]

Dept of ECE SGBIT Belagavi 7


(18ECL38) Computer Networks Laboratory

proc findWindowSize {tcpSource outFile} {


global ns
set now [$ns now]
set cWindSize [$tcpSource set cwnd_]
puts $outFile "$now $cWindSize"
$ns at [expr $now + 0.1] "findWindowSize $tcpSource $outFile"
}

$ns at 0.0 "findWindowSize $tcp1 $outFile1"


$ns at 0.1 "findWindowSize $tcp2 $outFile2"
$ns at 0.3 "$ftp1 start"
$ns at 0.5 "$ftp2 start"
$ns at 50.0 "$ftp1 stop"
$ns at 50.0 "$ftp2 stop"
$ns at 50.0 "finish"
$ns run

Steps for execution:



Open gedit editor and type program. Program name should have the extension “ .tcl ”
[root@localhost ~]# gedit lab4.tcl

Save the program and quit.

Run the simulation program
[root@localhost~]# ns lab4.tcl

Here “ns” indicates network simulator. We get the topology shown in the network animator. Now press the play button in the
simulation window and the simulation will begins.
➢ The xgraph automatically calculates and plot the two graph of Congestion window with TCP1 and TCP2.

Dept of ECE SGBIT Belagavi 8


(18ECL38) Computer Networks Laboratory

5. Implement ESS with transmission nodes in Wireless LAN and obtain the
performance parameters.

set ns [new Simulator]


set tf [open lab5.tr w]
$ns trace-all $tf
set topo [new Topography]
$topo load_flatgrid 1300 1300
set nf [open lab5.nam w]
$ns namtrace-all-wireless $nf 1300 1300

$ns node-config -adhocRouting DSDV \


-llType LL \
-macType Mac/802_11 \
-ifqType Queue/DropTail/PriQueue\
-channelType Channel/WirelessChannel \
-propType Propagation/TwoRayGround \
-antType Antenna/OmniAntenna \
-ifqLen 50 \
-phyType Phy/WirelessPhy \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON

create-god 3
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
$n0 label "ESS"
$n1 label "mob1"
$n2 label "mob2"
$n0 set X_ 10
$n0 set Y_ 600
$n0 set Z_ 0
$n1 set X_ 80
$n1 set Y_ 600
$n1 set Z_ 0
$n2 set X_ 1200
$n2 set Y_ 600
$n2 set Z_ 0
$ns at 0.1 "$n0 setdest 10 600 15"
$ns at 0.1 "$n1 setdest 80 600 25"
$ns at 0.1 "$n2 setdest 1200 600 25"

set tcp0 [new Agent/TCP]


$ns attach-agent $n0 $tcp0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
set sink1 [new Agent/TCPSink]
$ns attach-agent $n1 $sink1
$ns connect $tcp0 $sink1

set tcp1 [new Agent/TCP]


$ns attach-agent $n0 $tcp1
set ftp1 [new Application/FTP]

Dept of ECE SGBIT Belagavi 9


(18ECL38) Computer Networks Laboratory

$ftp1 attach-agent $tcp1


set sink2 [new Agent/TCPSink]
$ns attach-agent $n2 $sink2
$ns connect $tcp1 $sink2

$ns at 2 "$ftp0 start"


$ns at 15 "$ftp1 start"
$ns at 3 "$n1 setdest 1000 600 250"
$ns at 3 "$n2 setdest 80 600 250"

proc finish { } {
global ns nf tf
$ns flush-trace
exec nam lab5.nam &
close $tf
exit 0
}
$ns at 20 "finish"
$ns run

Steps for execution:



Open gedit editor and type program. Program name should have the extension “ .tcl ”
[root@localhost ~]# gedit lab5.tcl

Save the program and quit.

Run the simulation program
[root@localhost~]# ns lab5.tcl

Here “ns” indicates network simulator. We get the topology shown in the network animator. Now press the play button in the
simulation window and the simulation will begins.
➢ To calculate the throughput. Execute the following command. For
calculating number of received packets
[root@localhost~]#grep ^r lab5.tr | grep “AGT” | grep “tcp” | awk “{s+=$8}END{print s}”
For calculating total time
[root@localhost~]#grep ^r lab5.tr | grep “AGT” | grep “tcp” | awk “{s+=$2}END{print s}”

Throughput = (Packet received/ Total Time) (bps)

Dept of ECE SGBIT Belagavi 10


(18ECL38) Computer Networks Laboratory

6. Implementation of Link state routing algorithm

set ns [new Simulator]

$ns rtproto LS

set nf [open lab6.nam w]


$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam lab6.nam &
exit 0
}

for {set i 0} {$i < 7} {incr i} {


set n($i) [$ns node]
}

for {set i 0} {$i < 7} {incr i} {


$ns duplex-link $n($i) $n([expr ($i+1)%7]) 1Mb 10ms DropTail
}

set udp0 [new Agent/UDP]


$ns attach-agent $n(0) $udp0

set cbr0 [new Application/Traffic/CBR]


$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0

set null0 [new Agent/Null]


$ns attach-agent $n(3) $null0

$ns connect $udp0 $null0

$ns at 0.5 "$cbr0 start"


$ns rtmodel-at 1.0 down $n(1) $n(2)
$ns rtmodel-at 2.0 up $n(1) $n(2)
$ns at 4.5 "$cbr0 stop"
$ns at 5.0 "finish"

$ns run

Dept of ECE SGBIT Belagavi 11


(18ECL38) Computer Networks Laboratory

Steps for execution:



Open gedit editor and type program. Program name should have the extension “ .tcl ”
[root@localhost ~]# gedit lab6.tcl

Save the program and quit.

Run the simulation program
[root@localhost~]# ns lab6.tcl

Here “ns” indicates network simulator. We get the topology shown in the network animator. Now press the play button in the
simulation window and the simulation will begins.
➢ Explain link state routing algorithm using animation. How link state break and rerouting take place.

Dept of ECE SGBIT Belagavi 12


(18ECL38) Computer Networks Laboratory

PART-B:
Implement the following in C/C++

1. Write a program for a HLDC frame to perform the following.


i) Bit stuffing
ii) Character stuffing.

2. Write a program for distance vector algorithm to find suitable path for transmission.

3. Implement Dijkstra’s algorithm to compute the shortest routing path.

4. For thegivendata, useCRC-CCITTpolynomialtoobtainCRCcode.Verifytheprogramforthecases


a. Without error
b. With error

5. Implementation of Stop and Wait Protocol and Sliding Window Protocol

6. Write a program for congestion control using leaky bucket algorithm.

Dept of ECE SGBIT Belagavi 13


(18ECL38) Computer Networks Laboratory

1. Write a program for a HLDC frame to perform the following.


i) Bit stuffing

Bit stuffing is a process of inserting an extra bit as 0, once the frame sequence encountered 5 consecutive 1's.

Program
#include<stdio.h>
int main()
{
int a[15];
int i,j,k,n,c=0,pos=0;
printf("\n Enter the number of bits");
scanf("%d",&n);
printf("\n Enter the bits");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
if(a[i]==1)
{
c++;
if(c==5)
{
pos=i+1;
c=0;
for(j=n;j>=pos;j--)
{
k=j+1;
a[k]=a[j];
}
a[pos]=0;
n=n+1;
}
}
else
c=0;
}

printf("\n DATA AFTER STUFFING \n");

for(i=0;i<n;i++) {
printf("%d",a[i]);
}

Dept of ECE SGBIT Belagavi 14


(18ECL38) Computer Networks Laboratory

Execution:
[root@localhost code]# gcc 1a.c
[root@localhost code]# ./a.out

Enter the number of bits


12

Enter the bits


1
0
1
1
1
1
1
1
1
0
1
1

DATA AFTER STUFFING


1011111011011

Dept of ECE SGBIT Belagavi 15


(18ECL38) Computer Networks Laboratory

ii) Character stuffing.

Character Stuffing is process in which DLESTX and DLEETX are used to denote start and end of character data with
some constraints imposed on repetition of characters.

Program:
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main()
{
char c[50],d[50],t[50];
int i,m,j;
printf("enter the number of characters\n");
scanf("%d",&m);
printf("\n enter the characters\n");
for(i=0;i<m+1;i++)
{
scanf("%c",&c[i]);
}
printf("\n original data\n");
for(i=0;i<m+1;i++)
printf("%c",c[i]);
d[0]='d';
d[1]='l';
d[2]='e';
d[3]='s';
d[4]='t';
d[5]='x';
for(i=0,j=6;i<m+1;i++,j++)
{
if((c[i]=='d'&&c[i+1]=='l'&& c[i+2]=='e'))
{
d[j]='d';
j++;
d[j]='l';
j++;
d[j]='e';
j++;
m=m+3;
}
d[j]=c[i];
}
m=m+6;
m++;
d[m]='d';
m++;
d[m]='l';
m++;
d[m]='e';
m++;
d[m]='e';

Dept of ECE SGBIT Belagavi 16


(18ECL38) Computer Networks Laboratory

m++;
d[m]='t';
m++;
d[m]='x';
m++;
printf("\n\n transmitted data: \n");
for(i=0;i<m;i++)
{
printf("%c",d[i]);
}
for(i=6,j=0;i <m-6;i++,j++)
{
if(d[i]=='d'&&d[i+1]=='l'&&d[i+2]=='e'&&d[i+3]=='d'&&d[i+4]=='l'&&d[i+5]=='e')
i=i+3;
t[j]=d[i];
}
printf("\n\nreceived data:");
for(i=0;i<j;i++)
{printf("%c",t[i]);
}
}

Execution:
[root@localhost code]# gcc 1b.c
[root@localhost code]# ./a.out
enter the number of characters
9

enter the characters


abcdabcde

original data

abcdabcde

transmitted data:
dlestx
abcdabcdedleetx

received data:
abcdabcde

Dept of ECE SGBIT Belagavi 17


(18ECL38) Computer Networks Laboratory

2. Write a program for distance vector algorithm to find suitable path for transmission.
Distance vector routing algorithms operate by having each router maintain a table (i.e., vector) giving the best
known distance to each destination and which line to get there. These tables are updated by exchanging
information with the neighbors.

Program:
#include<stdio.h>

struct node
{
unsigned dist[20];
unsigned from[20];
}rt[10];

int main()
{
int dmat[20][20];
int n,i,j,k,count=0;
printf("\nEnter the number of nodes : ");
scanf("%d",&n);
printf("\nEnter the cost matrix (999 for no link):\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
scanf("%d",&dmat[i][j]);
dmat[i][i]=0;
rt[i].dist[j]=dmat[i][j];
rt[i].from[j]=j;
}
do
{
count=0;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
if(rt[i].dist[j]>dmat[i][k]+rt[k].dist[j])
{
rt[i].dist[j]=rt[i].dist[k]+rt[k].dist[j];
rt[i].from[j]=k;
count++;
}
}while(count!=0);
for(i=0;i<n;i++)
{
printf("\n\nState value for router %d is
\n",i+1); for(j=0;j<n;j++)
{
printf("\t\nnode %d via %d Distance%d",j+1,rt[i].from[j]+1,rt[i].dist[j]);
}
}
printf("\n\n");
}

Dept of ECE SGBIT Belagavi 18


(18ECL38) Computer Networks Laboratory

Execution:
[root@localhost code]# gcc 2.c
[root@localhost code]# ./a.out

Enter the number of nodes : 4

Enter the cost matrix (999 for no link):

0 2 999 1
2 0 5 2
999 5 0 6
1 2 6 0

State value for router 1 is

node 1 via 1 Distance0


node 2 via 2 Distance2
node 3 via 2 Distance7
node 4 via 4 Distance1

State value for router 2 is

node 1 via 1 Distance2


node 2 via 2 Distance0
node 3 via 3 Distance5
node 4 via 4 Distance2

State value for router 3 is

node 1 via 2 Distance7


node 2 via 2 Distance5
node 3 via 3 Distance0
node 4 via 4 Distance6

State value for router 4 is

node 1 via 1 Distance1


node 2 via 2 Distance2
node 3 via 3 Distance6
node 4 via 4 Distance0

Dept of ECE SGBIT Belagavi 19


(18ECL38) Computer Networks Laboratory

3. Implement Dijkstra’s algorithm to compute the shortest routing path.


Dijkstra algorithm is also called single source shortest path algorithm. The algorithm maintains a list visited[ ]
of vertices, whose shortest distance from the source is calculated.
Program:
#include<stdio.h>
#define INFINITY 9999
#define MAX 10
void dijkstra(int G[MAX][MAX],int n,int startnode);
int main()
{
int G[MAX][MAX],i,j,n,u;
printf("Enter no. of vertices:");
scanf("%d",&n);
printf("\nEnter the adjacency matrix:\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&G[i][j]);
printf("\nEnter the starting node:");
scanf("%d",&u);
dijkstra(G,n,u);
return 0;
}
void dijkstra(int G[MAX][MAX],int n,int startnode)
{
int cost[MAX][MAX],distance[MAX],pred[MAX];
int visited[MAX],count,mindistance,nextnode,i,j;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
if(G[i][j]==0)
cost[i][j]=INFINITY;
else
cost[i][j]=G[i][j];

for(i=0;i<n;i++)
{
distance[i]=cost[startnode][i];
pred[i]=startnode;
visited[i]=0;
}
distance[startnode]=0;
visited[startnode]=1;
count=1;
while(count<n-1)
{
mindistance=INFINITY;

for(i=0;i<n;i++)
if(distance[i]<mindistance&&!visited[i])
{
mindistance=distance[i];
nextnode=i;
}

visited[nextnode]=1;

Dept of ECE SGBIT Belagavi 20


(18ECL38) Computer Networks Laboratory

for(i=0;i<n;i++)
if(!visited[i])
if(mindistance+cost[nextnode][i]<distance[i])
{
distance[i]=mindistance+cost[nextnode][i];
pred[i]=nextnode;
}
count++;
}

for(i=0;i<n;i++)
if(i!=startnode)
{
printf("\nDistance of node%d=%d",i,distance[i]);
printf("\nPath=%d",i);
j=i;
do
{
j=pred[j];
printf("<-%d",j);
}while(j!=startnode);
}
}

Execution:

[root@localhost code]# gcc 3.c


[root@localhost code]# ./a.out
Enter no. of vertices:5

Enter the adjacency matrix:


0 10 0 30 100
10 0 50 0 0
0 50 0 20 10
30 0 20 0 60
100 0 10 60 0

Enter the starting node:0

Distance of node1=10
Path=1<-0
Distance of node2=50
Path=2<-3<-0
Distance of node3=30
Path=3<-0
Distance of node4=60
Path=4<-2<-3<-0

Dept of ECE SGBIT Belagavi 21


(18ECL38) Computer Networks Laboratory

4. For the given data, use CRC-CCITT polynomial to obtain CRC code. Verify the program for the cases
a. Without error
b. With error
Cylic Redundency Check is error checking technique it does error checking via polynomial division.
Progtam:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N strlen(g)
char t[128],cs[128],g[]="1000100000010001";
int a,e,c;
void xor(){
for(c=1;c<N;c++)
cs[c]=((cs[c]==g[c])?'0':'1');
}
void crc(){
for(e=0;e<N;e++)
cs[e]=t[e];
do{
if(cs[0]=='1')
xor();
for(c=0;c<N-1;c++)
cs[c]=cs[c+1];
cs[c]=t[e++];
}while(e<=a+N-1);
}
int main(){
printf("\nEnter poly:");
scanf("%s",t);
printf("\nGenerating Polynomial is: %s",g);
a=strlen(t);
for(e=a;e<a+N-1;e++)
t[e]='0';
printf("\nModified t[u] is: %s",t);
crc();
printf("\nChecksum is: %s",cs);
for(e=a;e<a+N-1;e++)
t[e]=cs[e-a];
printf("\nFinal Codeword is: %s",t);
printf("\nTest Error detection 0 (Yes) 1 (No) ? : ");
scanf("%d",&e);
if(e==0){
printf("Enter postion where error is to be inserted:");
scanf("%d",&e);
t[e]=(t[e]=='0')?'1':'0';
printf("Erroneous Data: %s\n",t);

22
(18ECL38) Computer Networks Laboratory

}
crc();
for(e=0;(e<N-1)&&(cs[e]!='1');e++);
if(e<N-1)
printf("Error Detected");
else printf("No Error Detected");
return 0;
}

Execution:
[root@localhost code]# gcc 4.c
[root@localhost code]# ./a.out

Enter poly : 1011101


Generating Polynomial is : 10001000000100001
Modified t[u] is : 10111010000000000000000
Checksum is : 1000101101011000
Final Codeword is : 10111011000101101011000
Test Error detection 0(yes) 1(no) ? : 0
Enter position where you want to insert error : 3
Errorneous data : 10101011000101101011000
Error detected.

Enter poly : 1011101


Generating Polynomial is : 10001000000100001
Modified t[u] is : 10111010000000000000000
Checksum is : 1000101101011000
Final Codeword is : 10111011000101101011000
Test Error detection 0(yes) 1(no) ? :
1 0No Error Detected.

Dept of ECE SGBIT Belagavi 23


(18ECL38) Computer Networks Laboratory

5. Implementation of Stop and Wait Protocol and Sliding Window Protocol


5a. Stop and Wait protocol

Program:
#include<stdio.h>
#define w 1
int main()
{
int i,f,frames[50];
printf("\nEnter number of frames to transmit:");
scanf("%d",&f);
printf("\nEnter %d frames: ",f);
for(i=1;i<=f;i++)
scanf("%d",&frames[i]);
printf("\nWith stop and wait protocol the frames will be sent in the following
manner (assuming no corruption of frames)\n\n");
printf("After sending %d frames at each stage sender waits for acknowledgement
sent by the receiver\n\n",w);
printf("if error occur negative acknowledge is detected same frame is resend
back\n");
for(i=1;i<=f;i++)
{
if((random()%2)==1)
{
if(i%w==0)
{
printf("%d\n",frames[i]);
printf("Acknowledgement of above frames sent is received
by sender\n\n");
}
else
printf("%d ",frames[i]);
}
else
{
sleep(3);
printf("negative acknowledge resend %d frame\n",i);
i=i-1;
sleep(1);
}

}
return 0;
}

Dept of ECE SGBIT Belagavi 24


(18ECL38) Computer Networks Laboratory

Execution:

[root@localhost code]# gcc 5b.c


[root@localhost code]# ./a.out

Enter number of frames to transmit: 6

Enter 6 frames: 1
4
5
7
8
9

With stop and wait protocol the frames will be sent in the following
manner (assuming no corruption of frames)

After sending 1 frames at each stage sender waits for acknowledgement sent by the
receiver

if error occur negative acknowledge is detected same frame is resend back


1
Acknowledgement of above frames sent is received by sender

negative acknowledge resend 2 frame


4
Acknowledgement of above frames sent is received by sender

5
Acknowledgement of above frames sent is received by sender

7
Acknowledgement of above frames sent is received by sender

8
Acknowledgement of above frames sent is received by sender

negative acknowledge resend 6 frame


negative acknowledge resend 6 frame
9
Acknowledgement of above frames sent is received by sender

Dept of ECE SGBIT Belagavi 25


(18ECL38) Computer Networks Laboratory

5b. Sliding window protocol program


Program
#include<stdio.h>

int main()
{
int w,i,f,frames[50];
printf("Enter window size: ");
scanf("%d",&w);
printf("\nEnter number of frames to transmit:
"); scanf("%d",&f);
printf("\nEnter %d frames: ",f);
for(i=1;i<=f;i++)
scanf("%d",&frames[i]);
printf("\nWith sliding window protocol the frames will be sent in the
following manner (assuming no corruption of frames)\n\n");
printf("After sending %d frames at each stage sender waits for acknowledgement
sent by the receiver\n\n",w);
for(i=1;i<=f;i++)
{
if(i%w==0)
{
printf("%d\n",frames[i]);
printf("Acknowledgement of above frames sent is received by sender\n\n");
}
else
printf("%d ",frames[i]);
}
if(f%w!=0)
printf("\nAcknowledgement of above frames sent is received by sender\n");
return 0;
}

Execution:

[root@localhost code]# gcc 5b.c


[root@localhost code]# ./a.out
Enter window size: 3

Enter number of frames to transmit: 5

Enter 5 frames: 12 20 87 65 4

With sliding window protocol the frames will be sent in the following manner
(assuming no corruption of frames)

After sending 3 frames at each stage sender waits for acknowledgement sent by the
receiver

12 20 87
Acknowledgement of above frames sent is received by sender

65 4
Acknowledgement of above frames sent is received by sender

Dept of ECE SGBIT Belagavi 26


(18ECL38) Computer Networks Laboratory

6. Write a program for congestion control using leaky bucket algorithm


In Leaky bucket, each host is connected to the network by an interface containing a leaky bucket, that is, a
finite internal queue. If a packet arrives at the queue when it is full, the packet is discarded.

Program:
#include<stdio.h>
#include<stdlib.h>
int bucket_size;
void bucket_input ( int pkt_sz, int op_rt )
{
if( pkt_sz > bucket_size )
printf(" \n\nBucket overflow\n ");
else
{
sleep(1);
while ( pkt_sz > op_rt )
{
printf(" \n %d bytes outputted ", op_rt );
pkt_sz-= op_rt;
sleep(1);
}
if ( pkt_sz > 0 )
printf(" \nLast %d bytes sent\n", pkt_sz );
printf(" \n Bucket output successful \n" );
}
}
int main()
{
int i, op_rate, packet_size;
printf("\n Enter Bucket Size: " );
scanf( "%d", &bucket_size );
printf(" \n Enter output rate: " );
scanf( "%d", &op_rate );
for( i=1; i<=5; i++ )
{
sleep(1);
packet_size = random()%1000;
printf(" \n Packet number [%d] \t Packet size = %d ", i, packet_size );
bucket_input( packet_size, op_rate ); }

return 0;
}

Dept of ECE SGBIT Belagavi 27


(18ECL38) Computer Networks Laboratory

Execution:
[root@localhost code]# gcc 6.c
[root@localhost code]# ./a.out

Enter Bucket Size: 500

Enter output rate: 80

Packet number [1] Packet size = 383


80 bytes outputted
80 bytes outputted
80 bytes outputted
80 bytes outputted
Last 63 bytes sent

Bucket output successful

Packet number [2] Packet size = 886

Bucket overflow

Packet number [3] Packet size = 777

Bucket overflow

Packet number [4] Packet size = 915

Bucket overflow

Packet number [5] Packet size = 793

Bucket overflow

Dept of ECE SGBIT Belagavi 28


(18ECL38) Computer Networks Laboratory

Viva Questions
1. Explain What is Network?
A network is a set of devices connected by physical media links. A network is recursively is a connection of two or more nodes by a physical link or two or
more networks connected by one or more nodes.

2. What is a Link?
At the lowest level, a network can consist of two or more computers directly connected by some physical medium such as coaxial cable or optical fiber. Such a
physical medium is called as Link.

3. What is a node?
A network can consist of two or more computers directly connected by some physical medium such as coaxial cable or optical fiber. Such a physical medium
is called as Links and the computer it connects is called as Nodes.

4. What is a gateway or Router?


A node that is connected to two or more networks is commonly called as router or Gateway. It generally forwards message from one network to another.
5. What is point-point link?
If the physical links are limited to a pair of nodes it is said to be point-point link.

6. What is Multiple Access?


If the physical links are shared by more than two nodes, it is said to be Multiple Access

7. What are the advantages of Distributed Processing?


a. Security/Encapsulation
b. Distributed database
c. Faster Problem solving
d. Security through redundancy
e. Collaborative Processing

8. What are the criteria necessary for an effective and efficient network?
a. Performance
It can be measured in many ways, including transmit time and response time. b. Reliability
It is measured by frequency of failure, the time it takes a link to recover from a failure, and the networks robustness.
c. Security
Security issues includes protecting data from unauthorized access and virues.

9. Name the factors that affect the performance of the network?


a. Number of Users
b. Type of transmission medium
c. Hardware
d. Software

10. Name the factors that affect the reliability of the network?
a. Frequency of failure
b. Recovery time of a network after a failure

11. Name the factors that affect the security of the network?
a. Unauthorized Access
b. Viruses

12. What is Protocol?


A protocol is a set of rules that govern all aspects of information communication.

13. What are the key elements of protocols?


The key elements of protocols are
a. Syntax
It refers to the structure or format of the data, that is the order in which they are presented.
b. Semantics
It refers to the meaning of each section of bits.
c. Timing
Timing refers to two characteristics: When data should be sent and how fast they can be sent.

14. What are the key design issues of a computer Network?


a. Connectivity
b. Cost-effective Resource Sharing
c. Support for common Services
d. Performance

Dept of ECE SGBIT Belagavi 29


(18ECL38) Computer Networks Laboratory

15. Define Bandwidth and Latency?


Network performance is measured in Bandwidth (throughput) and Latency (Delay). Bandwidth of a network is given by the number of bits that can be
transmitted over the network in a certain period of time. Latency corresponds to how long it t5akes a message to travel from one end off a network to the other.
It is strictly measured in terms of time.

16. Define Routing?


The process of determining systematically hoe to forward messages toward the destination nodes based on its address is called routing.

17. What is a peer-peer process?


The processes on each machine that communicate at a given layer are called peer-peer process.

18. When a switch is said to be congested?


It is possible that a switch receives packets faster than the shared link can accommodate and stores in its memory, for an extended period of time, then the
switch will eventually run out of buffer space, and some packets will have to be dropped and in this state is said to congested state.

19. What is semantic gap?


Defining a useful channel involves both understanding the applications requirements and recognizing the limitations of the underlying technology. The gap
between what applications expects and what the underlying technology can provide is called semantic gap.

20. What is Round Trip Time?


The duration of time it takes to send a message from one end of a network to the other and back, is called RTT.

21. Define the terms Unicasting, Multiccasting and Broadcasting?

If the message is sent from a source to a single destination node, it is called Unicasting.
If the message is sent to some subset of other nodes, it is called Multicasting.
If the message is sent to all the m nodes in the network it is called Broadcasting.
22. What is Multiplexing?
Multiplexing is the set of techniques that allows the simultaneous transmission of multiple signals across a single data link.

23. Name the categories of Multiplexing?


a. Frequency Division Multiplexing (FDM)
b. Time Division Multiplexing (TDM)
i. Synchronous TDM
ii. Asynchronous TDM Or Statistical TDM.
c. Wave Division Multiplexing (WDM)

24. What is FDM?


FDM is an analog technique that can be applied when the bandwidth of a link is greater than the combined bandwidths of the signals to be transmitted.

25. What is WDM?


WDM is conceptually the same as FDM, except that the multiplexing and demultiplexing involve light signals transmitted through fiber optics channel.

26. What is TDM?


TDM is a digital process that can be applied when the data rate capacity of the transmission medium is greater than the data rate required by the sending and
receiving devices.

27. What is Synchronous TDM?


In STDM, the multiplexer allocates exactly the same time slot to each device at all times, whether or not a device has anything to transmit.

28. List the layers of OSI


a. Physical Layer
b. Data Link Layer
c. Network Layer
d. Transport Layer
e. Session Layer
f. Presentation Layer
g. Application Layer

Dept of ECE SGBIT Belagavi 30


(18ECL38) Computer Networks Laboratory

29. Which layers are network support layers?


a. Physical Layer
b. Data link Layer and
c. Network Layers

30. Which layers are user support layers?


a. Session Layer
b. Presentation Layer and
c. Application Layer

31. Which layer links the network support layers and user support layers?
The Transport layer links the network support layers and user support layers.

32. What are the concerns of the Physical Layer?


Physical layer coordinates the functions required to transmit a bit stream over a physical medium.
a. Physical characteristics of interfaces and media
b. Representation of bits
c. Data rate
d. Synchronization of bits
e. Line configuration
f. Physical topology
g. Transmission mode

33. What are the responsibilities of Data Link Layer?


The Data Link Layer transforms the physical layer, a raw transmission facility, to a reliable link and is responsible for node-node delivery.
a. Framing
b. Physical Addressing
c. Flow Control
d. Error Control
e. Access Control

34. What are the responsibilities of Network Layer?


The Network Layer is responsible for the source-to-destination delivery of packet possibly across multiple networks (links).
a. Logical Addressing
b. Routing

35. What are the responsibilities of Transport Layer?


The Transport Layer is responsible for source-to-destination delivery of the entire message.
a. Service-point Addressing
b. Segmentation and reassembly
c. Connection Control
d. Flow Control
e. Error Control

36. What are the responsibilities of Session Layer?


The Session layer is the network dialog Controller. It establishes, maintains and synchronizes the interaction between the communicating
systems.
a. Dialog control
b. Synchronization

37. What are the responsibilities of Presentation Layer?


The Presentation layer is concerned with the syntax and semantics of the information exchanged between two systems.
a. Translation
b. Encryption
c. Compression

You might also like