Laboratory Manual: Computer Network Laboratory Sub Code: 15ecl68
Laboratory Manual: Computer Network Laboratory Sub Code: 15ecl68
Laboratory Manual: Computer Network Laboratory Sub Code: 15ecl68
1
(Approved by AICTE, New Delhi and Affiliated to VTU, Belagavi) No
50, Koorgalli Village, Hootagalli Industrial Area, Next to BEML, Mysuru, Karnataka 570018 Phone: 0821
240 3734FAX: 91-821-2485802
TABLE OF CONTENTS
From To
1Syllabus 33
4Theory 71
2
I
E
I
6Viva Questions 5
77
2
6Sample Questions 7
37
4
2
COMPUTER NETWORKS LABORATORY
B.E., VI Semester, Electronics & Communication Engineering.
Laboratory Experiments
parameters.
E
I
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 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 Stop and Wait Protocol and Sliding Window Protocol
6. Write a program for congestion control using leaky bucket algorithm.
3
Course Objectives
Sl.NO Statement
Choose suitable tools to model a network and understand the protocols at various OSI
1
reference levels.
4 Model the networks for different configurations and analyze the results.
Course Outcomes
CO- Statement
Implement data link layer algorithms such as Bit stuffing, CRC, stop and wait
C328.1
protocols in C Language
Simulate point to point four node duplex links with TCP /UDP agent using
C328.3
NCTUNS
Simulate ESS and Ethernet LAN with N nodes and assign multiple traffic to
C328.4
compare throughput using NCTUNS.
4
N
E
I
T
I
5
DO’S AND DON’TS
Do’s
· Do wear ID card and follow dress code
·
Do log off the computers when you finish.
·
Do ask for assistance if you need help.
·
Do keep your voice low when speaking to others in the LAB.
·
Do ask for assistance in downloading any software.
·
Do make suggestions as to how we can improve the LAB.
·
In case of any hardware related problem, ask LAB in charge for solution.
·
If you are the last one leaving the LAB, make sure that the staff in charge of the LAB
is informed to close the LAB.
·
Be on time to LAB sessions.
·
Do keep the LAB as clean as possible.
T
I
Don’ts
E
·
Do not use mobile phone inside the lab.
I
·
Don’t do anything that can make the LAB dirty (like eating, throwing waste papers
N
etc.)
·
Do not carry any external devices without permission.
·
Don’t move the chairs of the LAB.
·
Don’t interchange any part of one computer with another.
·
Don’t leave the computers of the LAB turned on while leaving the LAB.
·
Do not install or download any software or modify or delete any system files on any
lab computers.
·
Do not damage, remove, or disconnect any labels, parts, cables, or equipment.
·
Don’t attempt to bypass the computer security system.
·
Do not read or modify other user’s file.
·
If you leave the lab, do not leave your personal belongings unattended. We are not
responsible for any theft.
6
PART-A:
Simulation experiments using NCTUNS.
1. Implement a point to point network with four nodes and duplex links between them.
Analyze the network performance by setting the queue size and varying the bandwidth.
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.
3. Implement Ethernet LAN using n (6-10) nodes. Compare the throughput by changing
the error rate and data rate.
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.
T
I
E
I
N
7
Components and Architecture of NCTUns
NCTUns adopts a distributed architecture. It is a system comprising eight components.
1.The first component is the GUI program by which a user edits a network topology,
configures the protocol modules used inside a network node, specifies mobile nodes,
initial location and moving paths, plots performance graphs, plays back the animation of
a packet transfer trace, etc.
2.The second component is the simulation engine program, which provides basic and
useful simulation services (e.g., event scheduling, timer management, and packet
manipulation,etc.) to protocol modules. We call a machine on which a simulation engine
program resides a “simulation server.”
3.The third component is the set of various protocol modules, each of which implements
a specific protocol or function (e.g., packet scheduling or buffer management).All
protocol modules are C++ classes and are compiled and linked with the simulation
engine program. T
I
4. The fourth component is the simulation job dispatcher program that can
E
simultaneously manage and use multiple simulation servers to increase the aggregate
I
N
5. The fifth component is the coordinator program. On every simulation server, the
“coordinator” program must be run up. The coordinator should be alive as long as the
simulation server is alive. When a simulation server is powered onand brought up, the
coordinator must be run up. It will register itself with the dispatcher to join in the
dispatcher’s simulation server farm. Later on, when the status (idle or busy) of the
simulation server changes, it will notify the dispatcher of the new status. This enables
the dispatcher to choose an available simulation server from its simulation server farm
to service a job.
When the coordinator receives a job from the dispatcher, it forks a simulation engine
process to simulate the specified network and protocols. It may also fork several real-life
application program processes specified in the job. These processes are used to generate
traffic in the simulated network. When the simulation engine process is alive, the
coordinator communicates with the dispatcher and the GUI program on behalf of the
simulation engine process. For example, the simulation engine process needs to
periodically send its current simulation clock to the GUI program. This is done by first
sending the clock information to the coordinator and then asking the coordinator to
8
forward this information to the GUI program. This enables the GUI user to know the
progress of the simulation. During a simulation, the GUI user can also on-line set or get an
object’s value (e.g., to query or set a switch’s current switch table). Message exchanges
that occur between the simulation engine process and the GUI program are all relayed via
the coordinator.
6. The sixth component is the kernel patches that need to be made to the kernel source
code so that a simulation engine process can run on a UNIX machine correctly.
Currently NCTUns 6.0 runs on Red-Hat’s Fedora 11, which uses the Linux 2.6.28.9
kernel.
T
I
E
I
N
9
7 .seventh component is the various real-life user-level application programs. Due to the
novel kernel-reentering simulation methodology, any real-life existing or to-be
developed application program can be directly run up on a simulated network to
generate realistic network traffic.
8.The eighth component is the various user-level daemons that are run up for the whole
simulation case. For example, NCTUns provides RIP and OSPF routing daemons. By
running The these daemons, the routing entries needed for a simulated network can be
constructed automatically. As another example, NCTUns provides and automatically
runs up several emulation daemons when it is turned into an emulator.
A network node (device) may have many parameters to set. For example, we may want to
I
set the maximum queue length of a FIFO queue used inside a network interface. For
E
I
another example, we may want to specify that some application programs (traffic
N
10
• A packet is depicted by a segment with an arrow (for brevity, it will be called an
“arrow” in the following description).
During a packet transfer, if a link is painted in red, it means that this link is an intermediate
link for this packet. In contrast, if this link is painted in yellow, it means that one end of
this link is the real source or destination node of the packet.
• The arrow length is determined by the packet’s length. Therefore, a user can
expect that the arrow length is proportional to the packet length. In fact, a
packet’s segment length on a particular link is determined by the transmission
time of that packet on that link relative to the signal propagation delay of the
link.
GETTING STARTED
Setting up the environment
T
A user using the NCTUns in single machine mode, needs to do the following steps before
I
Commands used:
11
UDP command for sender and receiver
Stg –u 1024 100 1.0.1.2
Rtg –u –w log1
p = port no, 1024 = length of packet size, 1.0.1.2–receiver ip address for TCP
u = user datagram, 100 = time in seconds for UDP
PART A Programs
1. Implement a point to point network with four nodes andduplex links between them.
Analyze the network performance by setting queue size and varying the bandwidth .
STEPS:
Step1: Create a topology as shown in the below figure.
T
I
E
I
N
Step 2: Select the hub icon on the toolbar and drag it onto the working window.
Step 3: select the host icon on the toolbar and drag it onto the working window.
Repeat this for another host icon.
Step 4: Select the link icon on the toolbar and drag it on the screen from host (node-2n to
the hub, host(node-3) to hub, node 4 to hub.
12
here node-1 is sender and other nodes are receiver where bandwidth and queue
This leads to the creation of the 4-node including hub point-to-point network topology.
Save this topology as a .tpl file.
Step 5: Double-click on host(node 2) -sender, a host dialog box will open up. Click on the
add and type the following Command.
Stg –u 1024 100 1.0.1.2 click ok.
Here, 1.0.1.2 is IP address of the host 2 (Node 3), and 3is the port no.
Click on Node editor and you can see the different layers - interface, ARP, FIFO, MAC,
TCPDUMP, Physical layers.
Select MAC and then select full-duplex and in log Statistics, select Throughput of
incoming packets for receiver and Throughput of outgoing packets for sender.
select FIFO to change queue size, and select PHY to change bandwidth (AT RECEIVER
NODE)
Step 6: Double-click on host (node 3),host (node 4),host(node5) and follow thesame step
as above with only change in command according to the following syntax:
T
I
Step 7: Click on the E button (Edit Property) present on the toolbar in order tosave the
changes made to the topology. Now click on the R button (Run Simulation).By doing so a
user can
run/pause/continue/stop/abort/disconnect/reconnect/submit a simulation. Nosettings in
the simulation can be changed in this mode.
Step 8: Now go to Menu->Simulation->Run. Executing this command will submitthe
current Simulation job to one available simulation server managed by the dispatcher.
When the simulation server is executing, the user will see the time knot at the bottom of
the screen move.The time knot reflects the current virtual time (progress) of the
simulation case.
Step 9:After the simulation is completed, click on the play button and plot the graphs of
the drop pockets and throughput input and throughput output. These log files are created
in filename. Results fold r.
Step 10: Now click on the link (connecting the hub and host2) and change thebandwidth
say, 9 Mbps, and run the simulation and compare the two results
Graph Sheets:
13
N
E
I
T
I
14
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.
STEPS:
Step1:Create a topology as shown in the below figure
T
I
E
I
N
Step 2: Select 4 Nodes (2,3,4,5) and connect them using a hub as shown
Step 3: Go to mode edit and save the topology.
Step 4a: Double click on host (Node 2) and goto node editor, and click on MAC8023 and
put a check on the Throughput of Outgoing Packets. Click ok. Then click on ADD and type
the following command.
stcp –p 3000 –l 1024 1.0.1.3 and click OK. Here 1.0.1.3 is the IP address of the Host 3
(Receiver) and 3000 is the port no.
Step 4b: Double-click on host (node 4), and follow the same step as above withonly
15
change in command according to the following syntax:
stg –u 1024 100 1.0.1.3 and click OK. Here, 1.0.1.3 is Receiver IP and 100 is the
bandwidth. This forms theUDP connection.
Step 5: Double-click on host (node 3), and follow the same step as above and checkon
Throughput of Incoming Packets. And type the following commands:
rtcp –p 3000 –l 1024 click ok ( for TCP)
rtg –u –w log1 (node5) click ok ( for UDP),
Here, w is bandwidth and log1 is the name of the file.
Step 6: Click R Button and then go to Menu->Simulation - >Run.
Step 7: After the simulation is completed, click on heplay button and mean whileplot the
graphs of the Throughput Input and Through ut Output. These log files are created in
filename.results folder.
Graphs Sheet:
T
I
E
I
N
16
N
E
I
T
I
17
3. Simulate an Ethernet LAN using N nodes (6-10), compare throughput by changing error
rate and data rate.
Step 1: Create a Host Subnet and select number of Nodes
Step 3: Select host subnet option in the pop up window enter nodes = 6 andradius = 100
or select 6 Nodes (2-7) and connect them using a hub(1).
18
Step 4: Go to edit mode and save the topology.
Step 5: Let us say, Node 3, 2 and node 5 are source and destination respectively.
Double click on host (Node 3 and 2) and goto node editor, and click on MAC 8023
and put a check on the Throughput of Outgoing Packets. Click ok. Then click on ADD
and type the following command.
stcp –p 3000 –l 1024 1.0.1.4
Here 1.0.1.6 is the IP address of the Host (Receiver) and 3000 is the port no.Step5:
Double-click on host/receiver (node 5), and follow the same steps as aboveand check on
Throughput of Incoming Packets. And type the following commands:
rtcp –p 3000 –l 1024
Step 6: Click on R Button and then goto M nu->Simulation->Run.
Step 7: After the simulation is completed, click on the play button and meanwhile plot
the graphs of the Throughput Input and Throughput Output. These log files are created
in filename.results folder
Step 8: Change error rate (Bit error rate) and data rate (Bandwidth) in Physicallayer or on
the point to point link connecting any one of sender and receiver and then run the
T
I
simulation again and compare the Throughput Input and ThroughputOutput of 1stand
E
2ndreading.
I
N
Graphs Sheet:
19
4. Implement Ethernet LAN using n nodes and assign multiple traffic to the nodes and
obtain congestion window for different sources/destinations. Topology
T
I
E
I
N
Step 2: Go to edit mode and save the topology. IP addresses will be generated forall
hosts.
tcp –p 3000 –l 1024 1.0.1.5Here 1.0.1.5 is the IP address of the Host 5 (Receiver) and
3000 is the port no.Repeat the same step as above for node 2
Step 4: Double-click on host (node 5), and follow the same step as above And typethe
following commands:
rtcp –p 3000 –l 1024
Repeat the same step as above for node 2 and node 3.
Step 5: Click on R Button and then goto Menu->Simulation->Run.
Step 6: After the simulation is completed, click on the play button and mean whileplot
the graphs of the Collision and packets Dropped. These log files are created in
filename.results folder.
Graphs Sheet:
20
5.Implement ESS with transmission nodes in wireless LAN and obtain the
performance parameters.
Topology:
Step1: Create a topology as shown in the below figure
T
I
E
1.Select/click the HOST icon on the toolbar and click the left mouse button on the
I
2.Select/click the ROUTER icon on the toolbar and click the left mouse button on the
editor, to place ROUTER1 on the editor.
3.Select/click the WIRELESS ACCESS POINT(802.11b) icon on the toolbar and click
the left mouse button on the editor, to place ACCESS POINT 1 on the editor.Repeat
this procedure and place ACCESS POINT 2 on the editor.
4. Select/click the MOBILE NODE (infrastructure mode) icon on the toolbar and click
the left mouse button on the editor, to place MOBILE NODE 1 on the editor. Repeat this
procedure and place MOBILE NODE 2, MOBILE NODE3 and MOBILE NODE 4 on the
editor.
5.Click on the LINK icon on the toolbar and connect ACCESS POINT1 to ROUTER1 and
ACCESS POINT2 to ROUT R1.
6.Click on the “Create a moving path” icon on the toolbar and draw moving path
21
across MOBILE NODE 1 and 2, Repeat for MOBILE NODE 3and 4 (Accept the default
speed value 10 and close the window, Click the right to create Subnet
7.select wireless subnet icon in the toolbar now select MOBILE NODE1, MOBILE NODE
5 and ACCESS POINT 3 by clicking on left mouse button, and clicking right mouse
button will create a subnet.
Repeat the above step for MOBILE NODE 6 and ACCESS POINT 4.
Click on the “E” icon on the toolbar to save the current topology
Step2: Configuration
1.Double click the left mouse button while cursor is on HOST1 to open the HOST
window.
Select Add button on the HOST window to invoke the command window and provide
the following command in the command textbox .
ttcp –t –u –s –p 7000
ttcp –t –u –s –p 5000
T
I
2.Double click the left mouse button Mobile node-3 and click on Application provide
E
I
3.Double click the left mouse button Mobile node-6 and click on Application provide
the following command in the command textbox
ttcp –t –u –s –p 5000 1.0.1.1
Select the MAC tab by clicking node editor of WLAN mobile node-6 and Select LOG
STATISTICS and select checkbox for Input and output throughput in the MAC window.
Click OK button on the MAC window to exit.
Step3: Simulate
1. Click “R” icon on the tool bar
2. Select Simulation in the menu bar and click/ select RUN in the dropdown list to
execute the simulation.
3. To start playback select “►” icon located at the bottom right corner of the editor.
22
Graphs Sheet:
T
I
E
I
N
23
PART-B: Implement the following in C/C++
THEORY
Topology:
The structure of a network and which is usually described in the form of a diagram
which shows the nodes and links between them.
The term network topology refers to the shape of how the computers and other
network components are connected to each other.
· Node: A node is a device that is connected to the network. For our purposes
here, a node is the same as a computer. Network topology deals with how
the nodes of a network are connected to each other.
· Packet: A packet is a message that is sent over the network from one node to
another node. The packet includes the address of the node that sent the
packet, the address of the node the packet is being sent to, and data.
T
I
E
Network topology:
I
N
24
communicate as if they were connected by a dedicated point-to-point path.
Ring topology:
Ring topologyis characterized by a closed loop to which each node is attachedby
means of a repeating element. Data circulates around the ring on a series of
point-to-point links which exist between the repeaters. A node wishing to transmit
must wait for its turn and then send data onto the ring in the form of a packet which
must contain both the source and destination addresses as well as the data itself.
Upon arrival at the destination node, the data is copied into a local buffer. The
packet continues to circulate until it returns to the source node, hence providing a
form of acknowledgement.
Bus and tree topologies both employ a multiple-access broadcast medium and
hence only one device can transmit at any time. As with ring topology, transmission
involves the generation of a packet containing source and destination address field
together with data.
T
I
E
I
Topology, Bus:
N
25
When the signal reaches the end of the trunk line, a terminator absorbs the
packet to keep it from traveling back again along the bus line, possibly interfering
with other messages already on the line. Each end of a trunk line must be terminated
so that signals are removed from the bus when they reach the end.
T
I
E
I
N
26
Thin and thick Ethernet are the best examples of a physical bus topology.
Twisted-pair Ethernet (10Base-T Ethernet) uses a logical bus topology, but a star
for its physical topology.
In a bus topology, nodes should be far enough apart that they do not
interfere with each other. If the backbone cable is long, it may be necessary to
boost the signal strength. The maximum length of the backbone is limited by the
size of the time interval that constitutes “simultaneous” packet reception.
Token Bus:
Token Bus is a network architecture defined in the IEEE 802.4 specifications.
The Token Bus architecture has never been popular for Local-Area Networks (LANs)
of the type found in most offices. It is, however, widely used in manufacturing
contexts.
The Token Bus architecture was inspired, in part, by work relating to the
automation of manufacturing tasks. This architecture has, in turn, become the
basis for the various types of Manufacturing Automation Protocol (MAP) systems
that have been developed to help automate operations in industrial contexts.
The 802.4 specifications include physical layer and Media Access Control
T
(MAC) Sub layer details for networks that use a bus topology and use token passing
I
as the media-access method. The figure “Context and properties of Token Bus”
E
27
Topology, Ring:
each node can act as a repeater, boosting the signal before sending it on. The figure
I
Each node checks whether the packet’s destination node matches the node’s
address. When the packet reaches its destination, the node accepts the message,
and then sends it back to the sender to acknowledge receipt. Since ring topologies
use token passing to control access to the network, the token is returned to sender
with the acknowledgment.
28
The sender then releases the token to the next node on the network. If this
node has nothing to say, the node passes the token on to the next node, and so on.
When the token reaches a node with a packet to send, that node sends its packet.
Physical ring networks are rare because this topology has considerable
disadvantages compared to a more practical star wired ring hybrid, which is
described in a separate article. The advantages of a ring topology are that the cable
requirements are fairly minimal and no wiring center or closet is needed.
Token Ring:
Token Ring is a network architecture that uses a ring network topology
and a token passing strategy to control access to the network. This type of
architecture works best with networks that handle heavy data traffic from many
users, because of inherent fairness rules in token passing as an access method.
The figure “Context and properties of Token Ring” summarizes this
architecture.
29
With token passing as the media-access method, the node that has the token gets
to access the network, provided the token is available (not being used to transport a
packet) when the node receives it. Unlike the CSMA/CD media-access method that
Ethernet networks use, token passing is deterministic.
This means each node is guaranteed to get a turn sending packets within a
predefined time or number of cycles. Token Ring networks have the following
feature
T
I
E
I
N
30
Topology, Star:
T
I
E
I
N
One advantage of a star topology is that troubleshooting and fault isolation are
easy. Also, it is easy to add or remove nodes and to modify the cable layout.
A disadvantage of this topology is that if the hub fails, the entire network fails.
Sometimes a backup central machine is included to make it possible to deal with such a
failure. Also, a star topology requires a lot of cable.
The central point of a star topology plays the role of traffic cop in that it directs
traffic to its intended destination rather than to everyone on the network. In a LAN
31
implementation, the traffic cop is often the switch. A star topology with a single switch
at its central point might look something like the illustration in Figure.
1.Write a program for a HLDC frame to perform the following. i) Bit stuffing ii) Character
stuffing.
What is Framing?
Since the physical layer merely accepts and transmits a stream of bits without any
regard to meaning or structure, it is upto the data link layer to create and recognize
frame boundaries. This can be accomplished by attaching special bit patterns to the
beginning and end of the frame. If these bit patterns can accidentally occur in data,
special care must be taken to make sure these patterns are not incorrectly interpreted as
frame delimiters. The four framing methods that are widely used are
T
I
· Character count
E
a. Bit Stuffing
Bit stuffing is the process of inserting non -information bits into data to break up
bit patterns to affect the synchronous transmission of information. It is widely used in
network and communication protocols, in which bit stuffing is a required part of the
transmission process. Bit stuffing is commonly used to bring bit streams up to a
common transmission rate or to fill frames. Bit stuffing is also used for run-length
limited coding.
In order to fill bit frames, the position where the new bits are stuffed is
communicated to the receiving end of the data link. The receiver removes the extra bits
to return the bit streams to their original bit rate. This is used when a communication
protocol requires a fixed frame size. Bits are inserted to make the frame size equal to
the defined frame size.
32
Bit stuffing also works to limit the number of consecutive bits of the same value
included in the transmitted data for run-length limited coding. This procedure includes a
bit of the opposite value after the maximum allowed number of consecutive bits of the
same value. For instance, if a number of zero bits are transmitted consecutively, the
receiving end loses synchronization because a lot of time has passed without voltage
sensing. Using bit stuffing, sets of bits beginning with the number one are stuffed into
streams of zeros at specific intervals. The receiver does not require any extra
information regarding the bit location when the extra bits are removed. Such bit stuffing
is done to ensure reliable data transmission and ensure that transmissions start and end
at the right places, among other purposes.
T
I
E
I
N
33
a.BIT stuffing Code
#include<stdio.h>
#include <curses.h>
#include<string.h>
void main()
{
intn,a[20],b[30],i,j,k,count;
printf("Enter frame size (Example: 8):");
scanf("%d",&n);
printf("Enter the frame in the form of 0 and 1 :");
for(i=0; i<n; i++) scanf("%d",&a[i]);
i=0;
count=1;
j=0;
while(i<n)
{
T
if(a[i]==1)
I
{
E
b[j]=a[i];
I
N
34
i++;
j++;
}
printf("After Bit Stuffing :");
for(i=0; i<j; i++)
printf("%d",b[i]);
}
Output:
T
I
E
I
N
after 5 consecutive 1-bits, a 0-bit is stuffed, stuffed bits are marked bold
When the receiver sees five consecutive 1s in the incoming data stream, followed
by a zero bit, it automatically de-stuffs the 0 bit. The boundary between two frames can
be determined by locating the flag pattern.
35
N
E
I
T
I
36
b.Character stuffing
In the second method, each frame starts with the ASCII character sequence DLE
STX and ends with the sequence DLE ETX.(where DLE is Data Link Escape, STX is Start
of TeXt and ETX is End of Text.) This method overcomes the drawbacks of the character
count method. If the destination ever loses synchronization, it only has to look for DLE
STX and DLE ETX characters. If however, binary data is being transmitted then there
exists a possibility of the characters DLE STX and DLE ETX occurring in the data. Since
this can interfere with the framing, a technique called character stuffing is used. The
sender's data link layer inserts an ASCII DLE character just before the DLE character in
the data. The receiver's data link layer removes this DLE before this data is given to the
network layer. However character stuffing is closely associated with 8-bit characters and
this is a major hurdle in transmitting arbitrary sized characters.
Character Count
This method uses a field in the header to specify the number of characters in the
T
frame. When the data link layer at the destination sees the character count,it knows how
I
many characters follow, and hence where the end of the frame is. The disadvantage is
E
I
that if the count is garbled by a transmission error, the destination will lose
N
synchronization and will be unable to locate the start of the next frame. So, this method
is rarely used.
Although using characters to mark the beginning and end of each frame has
advantages, most computer networks cannot afford to reserve characters for use by the
network. Instead, the network permits anapplicationto transfer arbitrary data values
across the network. In particular, an application may choose to send data that contains
one or more occurrences of characters like soh and eot that are used for framing.
Ingeneral, to distinguish between data being sent and control information such as frame
delimiters, network systems arrange for the sending side to change the data slightly
before it is sent, and then arrange for thereceiving side to restore the original data before
passing it to the receiving application.
Thus, although applications using the network can transfer arbitrary data, the
network system never confuses data with control information. Because network systems
usually insert bits or bytes to change data for transmission, the technique is known as
data stuffing. The terms character stuffing and byte stuffing refer to data stuffing
used with character orientedhardware, and bit stuffing which is more common, refers to
37
data stuffing used with bit oriented hardware. To implement byte stuffing, a sender must
scan an entire data block and perform the mapping before any data is sent. Byte stuffing
can solve the problem by reserving a third character to mark occurrences of special
characters in the data.
Use reserved characters to indicate the start and end of a frame. For instance, use
the two-character sequence DLE STX (Data-Link Escape, Start of Text) to signal the
beginning of a frame, and the sequence DLE ETX (End of Text) to flag the frame's end.
Problem: What happens if the two-character sequence DLE ETX happens to
appear in the frame itself?
Solution: Use character stuffing; within the frame, replace every occurrence of
DLE with the two-character sequence DLE DLE. The receiver reverses the processes,
replacing every occurrence of DLE DLE with single DLE.
Example: If the frame contained ``A B DLE D E DLE'', the characters transmitted
over the channel would-be ``DLE STX A B DLE DLE D E DLE DLEDLEETX''.Disadvantage:
character is the smallest unit that can be operated on; not all architectures are byte
T
oriented
I
E
Character stuffing-code
I
N
#include<stdio.h>
#include<string.h>
void main()
{
inti=0,j=0,n,pos;
char a[20],b[50],ch;
printf("enter string\n");
scanf("%s",&a);
n=strlen(a);
b[0]='d';
b[1]='l';
b[2]='e';
b[3]='s';
b[4]='t';
38
b[5]='x';
j=6;
while(i<n)
{
if(a[i]=='d' && a[i+1]=='l' && a[i+2]=='e')
{
b[j]='d';
b[j+1]='l';
b[j+2]='e';
j=j+3;
}
b[j]=a[i];
i++;
j++;
T
}
I
E
b[j]='d';
I
N
b[j+1]='l';
b[j+2]='e';
b[j+3]='e';
b[j+4]='t';
b[j+5]='x';
b[j+6]='\0';
printf("\nframe after stuffing:\n");
printf("%s\n",b);
}
Conclusion :
After observing the above program what we notice is that , our original data to
be transmitted is hasDLESTX as the part of data at the start and end while transmitting ,
and then at the receiving side these stuffed characters are removed and original data is
recovered back . Also if data contains those characters which are being stuffed then like
DLE then it is inserted before those characters and then transmitted, and at the receiving
side original data is recovered.
39
Output:
T
I
E
I
2.Write a program for distance vector algorithm to find suitable path for transmission.
N
40
§ Associated with each link connected to a router,
§ there is a link cost (static or dynamic).
§ Intermediate hops
§ Distance to itself = 0
§ Distance to ALL other routers = infinity number.
41
bandwidth-wasting broadcasts still occur.
§ For larger networks, distance vector routing results in larger routing tables than link
state since each router must know about all other routers. This can also lead to
congestion on WAN links.
for(j=0;j<n;j++)
I
{
E
{
printf("To %c:",65+j);
scanf("%d",&cost[i][j]);
}
else
cost[i][j]=0;
}
}
for(i=0;i<n;i++) // calculation for finding the shortest path for
the given cost
for(j=0;j<n;j++)
via[i][j]=i;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
42
if(cost[i][j]<999)
{
for(k=0;k<n;k++)
{
if(cost[i][k]>cost[i][j]+cost[j][k]) // To find shortest path from various
nodes
{
cost[i][k]=cost[i][j]+cost[j][k];
via[i][k]=j;
}
}
}
}
}
for(i=0;i<n;i++)
T
{
I
for(j=0;j<n;j++)
I
N
{
if(cost[i][j]!=999)
printf("%c:%d via %c\n",65+j,cost[i][j],65+via[i][j]);
else
printf("%c:No connection\n,65+j");
}
}
return 0;
}
43
Output
nieit@localhostpawan]$ ./a.out
Enter the number of nodes(less than 10)
4
T
To B:3
E
To C:7
I
N
To D:6
44
A:0 via A
B:3 via A
C:4 via B
D:6 via A
The preferred path from B to:
A:3 via B
B:0 via B
C:1 via B
D:6 via C
The preferred path from C to:
A:4 via B
B:1 via C
C:0 via C
D:5 via C
The preferred path from D to:
A:6 via D
T
B:6 via C
I
C:5 via D
E
D:0 via D
I
N
[nieit@localhostpawan]$
45
4.Implement Dijkstra’s algorithm to compute the shortest routing path.
Theory:
One algorithm for finding the shortest path from a starting node to a target node in a
weighted graph is Dijkstra’s algorithm. The algorithm creates a tree of shortest paths
from the starting vertex, the source, to all other points in the graph.
Dijkstra’s algorithm, published in 1959 and named after its creator Dutch computer
scientist Edsger Dijkstra, can be applied on a weighted graph. The graph can either be
directed or undirected. One stipulation to using the algorithm is that the graph needs to
have a nonnegative weight on every edge.
Suppose a student wants to go from home to school in the shortest possible way. She
knows some roads are heavily congested and difficult to use. In Dijkstra's algorithm, this
means the edge has a large weight--the shortest path tree found by the algorithm will try
to avoid edges with larger weights. If the student looks up directions using a map
T
I
Example:
N
Find the shortest path from home to school in the following graph:
46
Home(B(D(F(school. T
I
E
I
N
47
Dijkstra’s algorithm-Code
#include<stdio.h>
#include<conio.h>
#define INFINITY 9999
#define MAX 10
intmain()
{
int G[MAX][MAX],i,j,n,u;
printf("Enter no. of vertices:");
scanf("%d",&n);
printf("\nEnter the adjacency matrix:\n"); T
for(i=0;i<n;i++)
I
for(j=0;j<n;j++)
E
scanf("%d",&G[i][j]);
I
N
return 0;
}
int cost[MAX][MAX],distance[MAX],pred[MAX];
int visited[MAX],count,mindistance,nextnode,i,j;
48
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];
count=1;
I
while(count<n-1)
E
{
I
N
mindistance=INFINITY;
49
pred[i]=nextnode;
}
count++;
}
//print the path and distance of each node
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);
T
}while(j!=startnode);
I
}
E
}
I
N
Output:
50
5.For the given data, use CRC-CCITT polynomial to obtain CRC code. Verify the program
T
I
The final framing method is physical layer coding violations and is applicable to
networks in which the encoding on the physical medium contains some redundancy. In
such cases normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair. The
combinations of low-low and high-high which are not used for data may be used for
marking frame boundaries.
Error Control
The bit stream transmitted by the physical layer is not guaranteed to be error free.
The data link layer is responsible for error detection and correction. The most common
error control method is to compute and append some form of a checksum to each
outgoing frame at the sender's data link layer and to recomputed the checksum and
verify it with the received checksum at the receiver's side. If both of them match, then the
frame is correctly received; else it is erroneous. The checksums may be of two types:
# Error detecting : Receiver can only detect the error in the frame and inform the sender
about it. # Error detecting and correcting : The receiver can not only detect the error but
also correct it.
51
Examples of Error Detecting methods:
· Parity-bit:
Simple example of error detection technique is parity bit. The parity bit is chosen
that the number of 1 bits in the code word is either even( for even parity) or odd (for odd
parity). For example when 10110101 is transmitted then for even parity an 1 will be
appended to the data and for odd parity a 0 will be appended. This scheme can detect
only single bits. So if two or more bits are changed then that can not be detected.
two and determine the erroneous bit. If 2 bits are in error and they are in the different
I
column and row then they can be detected. If the error are in the same column then the
E
I
row will differentiate and vice versa. Parity can detect the only odd number of errors. If
N
they are even and distributed in a fashion that in all direction then LRC may not be able to
find the error.
52
· Cyclic Redundancy Checksum (CRC):
Whenever digital data is stored or interfaced, data corruption might occur. Since the
beginning of computer science, developers have been thinking of ways to deal with this
type of problem. For serial data they came up with the solution to attach a parity bit to
each sent byte. This simple detection mechanism works if an odd number of bits in a
byte changes, but an even number of false bits in one byte will not be detected by the
parity check. To overcome this problem developers have searched for mathematical
sound mechanisms to detect multiple false bits. The CRC calculation or cyclic
redundancy check was the result of this. Nowadays CRC calculations are used in all
types of communications. All packets sent over a network connection are checked with
a CRC. Also each data block on your hard disk has a CRC value attached to it. Modern
computer world cannot do without these CRC calculations. So let's see why they are so
widely used. The answer is simple; they are powerful, detect many types of errors and
are extremely fast to calculate especially when dedicated hardware chips are used.
The idea behind CRC calculation is to look at the data as one large binary number.
T
I
This number is divided by a certain value and the remainder of the calculation is called
E
the CRC. Dividing in the CRC calculation at first looks to cost a lot of computing power,
I
but it can be performed very quickly if we use a method similar to the one learned at
N
school. We will as an example calculate the remainder for the character 'm'—which is
1101101 in binary notation—by dividing it by 19 or 10011. Please note that 19 is an odd
number. This is necessary as we will see further on. Please refer to your schoolbooks as
the binary calculation method here is not very different from the decimal method you
learned when you were young. It might only look a little bit strange. Also notations differ
between countries, but the method is similar.
With decimal calculations you can quickly check that 109 divided by 19 gives a
quotient of 5 with 14 as the remainder. But what we also see in the scheme is that every
bit extra to check only costs one binary comparison and in 50% of the cases one binary
subtraction. You can easily increase the number of bits of the test data string—for
example to 56 bits if we use our example value "Lammert"—and the result can be
calculated with 56 binary comparisons and an average of 28 binary subtractions. This
can be implemented in hardware directly with only very few transistors involved. Also
software algorithms can be very efficient.
All of the CRC formulas you will encounter are simply checksum algorithms based
53
on modulo-2 binary division where we ignore carry bits and in effect the subtraction will
be equal to an exclusive or operation. Though some differences exist in the specifics
across different CRC formulas, the basic mathematical process is always the same:
The message bits are appended with c zero bits; this augmented message is the
dividend A predetermined c+1-bit binary sequence, called the generator polynomial, is
the divisor The checksum is the c-bit remainder that results from the division
operation
Table 1 lists some of the most commonly used generator polynomials for 16- and
32-bit CRCs. Remember that the width of the divisor is always one bit wider than the
remainder. So, for example, you’d use a 17-bit generator polynomial whenever a 16-bit
checksum is required.
1) Error detection with CRC
Consider a message represented by the polynomial M(x) .Consider a generating
polynomial G(x) This is used to generate a CRC = C(x) to be appended to M(x). Note this
G(x) is prime.
T
I
Steps:1. Multiply M(x) by highest power in G(x). i.e. Add So much zeros to M(x). 2. Divide
E
the result by G(x). The remainder = C(x). Special case: This won't work if bitstring =all
I
zeros. We don't allow such an M(x).But M(x) bitstring = 1 will work, for example. Can
N
divide 1101 into 1000. 3. If: x div y gives remainder c that means: x = n y + c Hence (x-c)
= n y (x-c) div y gives remainder 0 Here (x-c) = (x+c) Hence (x+c) div y gives remainder
0 4. Transmit: T(x) = M(x) + C(x) 5. Receiver end: Receive T(x). Divide by G(x), should
have remainder 0. Note if G(x) has order n - highest power is xn, then G(x) will cover
(n+1) bits and the remainder will cover n bits. i.e. Add n bits (Zeros) to message.
We have an n-bit message. The sender adds a k-bit Frame Check Sequence (FCS)
to this message before sending. The resulting (n+k) bit message is divisible by some
(k+1) bit number. The receiver divides the message ((n+k)-bit) by the same (k+1)-bit
number and if there is no remainder, assumes that there was no error. How do we
choose this number?
For example, if k=12 then 1000000000000 (13-bit number) can be chosen, but this is a
pretty crappy choice. Because it will result in a zero remainder for all (n+k) bit messages
with the last 12 bits zero. Thus, any bits flipping beyond the last 12 go undetected. If
k=12, and we take 1110001000110 as the 13-bit number (incidentally, in decimal
representation this turns out to be 7238). This will be unable to detect errors only if the
corrupt message and original message have a difference of a multiple of 7238. The
54
probability of this is low, much lower than the probability that anything beyond the last
12-bits flips. In practice, this number is chosen after analyzing common network
transmission errors and then selecting a number which is likely to detect these common
errors.
#include<stdio.h>
#include<string.h>
int a, e, c;voidxor()
for(c=1;c<N;c++) cs[c]=((cs[c]==g[c])?'0':'1');
void crc()
T
I
{
E
I
do {
while(e<=a+N-1);
void main()
scanf("%s",t);
55
a=strlen(t);
crc();
printf("\nChecksum is : %s",cs);
printf("\nFinalCodeword is : %s",t);
scanf("%d",&e);
if(e==0)
scanf("%d",&e);
E
t[e]=(t[e]=='0')?'1':'0';
I
N
Output:
56
N
E
I
T
I
57
5. Implementation of Stop and Wait Protocol and Sliding Window Protocol
Flow Control
Consider a situation in which the sender transmits frames faster than the receiver
can accept them. If the sender keeps pumping out frames at high rate, at some point the
receiver will be completely swamped and will start losing some frames. This problem
may be solved by introducing flow control. Most flow control protocols contain a
feedback mechanism to inform the sender when it should transmit the next frame.
· Stop and Wait Protocol: This is the simplest file control protocol in which the sender
transmits a frame and then waits for an acknowledgement, either positive or negative,
from the receiver before proceeding. If a positive acknowledgement is received, the
sender transmits the next packet; else it retransmits the same frame. However, this
protocol has one major flaw in it. If a packet or an acknowledgement is completely
destroyed in transit due to a noise burst, a deadlock will occur because the sender
T
I
cannot proceed until it receives an acknowledgement. This problem may be solved using
timers on the sender's side. When the frame is transmitted, the timer is set. If there is no
E
I
response from the receiver within a certain time interval, the timer goes off and the
N
58
x=rand()%15;
if(x%5==0)
{
for(x2=1;x2<2;x2++)
{
printf("Timer out after waiting for %d seconds\n",x2);
sleep(x2);
}
printf("resending frame %d\n",i);
}
printf("ACK for frame %d is received\n",i);
printf("---------------------------------------------\n");
noframes=noframes-1;
i++;
}
printf("End of stop and wait protocol\n");
T
}
I
#include<stdio.h>
E
#include<stdlib.h>
I
N
#include<time.h>
int main ()
{
printf ("Our first number: %d\n", rand() % 100);
srand( time(NULL) );
printf ("Some random number: %d\n", rand() % 100);
srand( 1 );
printf ("The first number again: %d\n", rand() %100);
return 0;
}
output of the srand example program above:
Our first number: 41
Some random number: 4
The first number again: 41
59
· Sliding Window Protocols:
In spite of the use of timers, the stop and wait protocol still suffers from a few
drawbacks. Firstly, if the receiver had the capacity to accept more than one frame, its
resources are being underutilized. Secondly, if the receiver was busy and did not wish to
receive any more packets, it may delay the acknowledgement. However, the timer on the
T
sender's side may go off and cause an unnecessary retransmission. These drawbacks
I
In sliding window protocols the sender's data link layer maintains a 'sending window'
I
N
In this simple example, there is a 4-byte sliding window. Moving from left to right,
60
the window "slides" as bytes in the stream are sent and acknowledged.
Most sliding window protocols also employ ARQ ( Automatic Repeat reQuest )
mechanism. In ARQ, the sender waits for a positive acknowledgement before proceeding
to the next frame. If no acknowledgement is received within a certain time interval it
retransmits the frame. ARQ is of two types :
1. Go Back 'n': If a frame is lost or received in error, the receiver may simply discard
all subsequent frames, sending no acknowledgments for the discarded frames. In this
case the receive window is of size 1. Since no acknowledgements are being received
the sender's window will fill up, the sender will eventually time out and retransmit all the
unacknowledged frames in order starting from the damaged or lost frame. The
maximum window size for this protocol can be obtained as follows. Assume that the
window size of the sender is n. So the window will initially contain the frames with
sequence numbers from 0 to (w-1). Consider that the sender transmits all these frames
and the receiver's data link layer receives all of them correctly. However, the sender's
data link layer does not receive any acknowledgements as all of them are lost. So the
T
sender will retransmit all the frames after its timer goes off. However the receiver
I
window has already advanced to w. Hence to avoid overlap , the sum of the two
E
Selective Repeat: In this protocol rather than discard all the subsequent frames
following a damaged or lost frame, the receiver's data link layer simply stores them in
buffers. When the sender does not receive an acknowledgement for the first frame it's
timer goes off after a certain time interval and it retransmits only the lost frame.
Assuming error - free transmission this time, the sender's data link layer will have a
sequence of a many correct frames which it can hand over to the network layer. Thus
there is less overhead in retransmission than in the case of go back protocol.
In case of selective repeat protocol the window size may be calculated as follows.
Assume that the size of both the sender's and the receiver's window is w. So initially
both of them contain the values 0 to (w-1). Consider that sender's data link layer
transmits all the w frames, the receiver's data link layer receives them correctly and
sends acknowledgements for each of them. However, all the acknowledgements are
lost and the sender does not advance it's window. The receiver window at this point
61
contains the values w to (2w-1). To avoid overlap when the sender's data link layer
retransmits, we must have the sum of these two windows less than sequence number
space. Hence, we get the condition
#include<stdio.h>
intmain()
intw,i,f,frames[50];
scanf("%d",&w);
scanf("%d",&f);
E
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]);
62
}
else
printf("%d ",frames[i]);
if(f%w!=0)
return 0;
Output:
T
I
E
I
N
63
6. Write a program for congestion control using leaky bucket algorithm.
Theory
The congesting control algorithms are basically divided into two groups: open loop
and closed loop. Open loop solutions attempt to solve the problem by good design, in
essence, to make sure it does not occur in the first place. Once the system is up and
running, midcourse corrections are not made. Open loop algorithms are further divided
into ones that act at source versus ones that act at the destination.
In contrast, closed loop solutions are based on the concept of a feedback loop if there
is any congestion. Closed loop algorithms are also divided into two sub categories:
explicit feedback and implicit feedback. In explicit feedback algorithms, packets are sent
back from the point of congestion to warn the source. In implicit algorithm, the source
deduces the existence of congestion by making local observation, such as the time
needed for acknowledgment to come back.
The presence of congestion means that the load is (temporarily) greater than the
T
resources (in part of the system) can handle. For subnets that use virtual circuits
I
Another open loop method to help manage congestion is forcing the packet to be
N
64
leaky bucket algorithm-code
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
intmain()
{
intsz,i,j,otr,timer,c=0,n;
intpcksz[10];
T
scanf("%d",&sz);
I
N
65
{
printf("no of packets %d\n,packet size %d\n",i+1,pcksz[i]);
c=c+pcksz[i];
if(c>sz)
{
printf("packet %d discarded\n",i+1);
c=c-pcksz[i];
}
for(j=1;j<=timer;j++)
{
if(c>otr)
{
T
c=c-otr;
I
sleep(1);
N
}
else if(c==0)
{
printf("bucket is empty\n");
sleep(1);
}
else
{
printf("%d bytes sent\n",c);
sleep(1);
c=0;
}
66
pcksz[i]=0;
}
printf("time expired\n");
}
printf(" %d bytes in leaky bucket to be sent\n",c);
while(c>otr)
{
printf("%d byte sent \n",otr);
c=c-otr;
}
if(c!=0)
{
T
}
N
67
2 bucket is empty ,packet size 1
size of packet9 time expired 1 bytes sent
3 no of the packet 4 bucket is empty
size of packet10 ,packet size 6 bucket is empty
1 2 bytes sent bucket is empty
no of the packet 1 2 bytes sent bucket is empty
,packet size 2 2 bytes sent time expired
2 bytes sent bucket is empty no of the packet 8
bucket is empty bucket is empty ,packet size 2
bucket is empty time expired 2 bytes sent
bucket is empty no of the packet 5 bucket is empty
bucket is empty ,packet size 5 bucket is empty
T
68
bucket is empty size of packet4 2 bytes sent
bucket is empty 6 time expired
bucket is empty size of packet5 no of the packet 4
time expired 5 ,packet size 6
0 bytes in leaky bucket size of packet6 2 bytes sent
to be sent 3 2 bytes sent
[nieit@localhostpawan]$ size of packet7 time expired
1 no of the packet 5
size of packet8 ,packet size 5
------ 2 packet 5 discarded
[nieit@localhostpawan] size of packet9 2 bytes sent
$ ./a.out
3 2 bytes sent
enter the bucket size
T
10
7 no of the packet 6
E
2
,packet size 2 2 bytes sent
enter the no of packets
2 bytes sent 2 bytes sent
10
bucket is empty time expired
enter the timer value
time expired no of the packet 7
2
no of the packet 2 ,packet size 1
enter the packet size
,packet size 4 2 bytes sent
size of packet1
2 bytes sent bucket is empty
2
2 bytes sent time expired
size of packet2
time expired no of the packet 8
4
no of the packet 3 ,packet size 2
size of packet3
,packet size 8 2 bytes sent
8
2 bytes sent bucket is empty
69
time expired enter the timer value bucket is empty
no of the packet 9 5 bucket is empty
,packet size 3 enter the packet size bucket is empty
2 bytes sent size of packet1 time expired
1 bytes sent 2 no of the packet 2
time expired size of packet2 ,packet size 4
no of the packet 10 4 2 bytes sent
,packet size 7 size of packet3 2 bytes sent
2 bytes sent 15 bucket is empty
2 bytes sent size of packet4 bucket is empty
time expired 6 bucket is empty
3 bytes in leaky bucket size of packet5 time expired
to be sent
T
5 no of the packet 3
I
10 6 ,packet size 6
70
bucket is empty no of the packet 7 2 bytes sent
time expired ,packet size 1 1 bytes sent
no of the packet 5 1 bytes sent bucket is empty
,packet size 5 bucket is empty bucket is empty
2 bytes sent bucket is empty bucket is empty
2 bytes sent bucket is empty time expired
1 bytes sent bucket is empty no of the packet 10
bucket is empty time expired ,packet size 6
bucket is empty no of the packet 8 2 bytes sent
time expired ,packet size 2 2 bytes sent
no of the packet 6 2 bytes sent 2 bytes sent
,packet size 3 bucket is empty bucket is empty
T
to be sent
bucket is empty time expired
[nieit@localhostpawan]$
bucket is empty no of the packet 9
time expired ,packet size 3
1. Define Network?
A network is a set of devices connected by physical media links. A network is recursively
71
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?
T
If the physical links are shared by more than two nodes, it is said to be Multiple Access.
I
a. Security/Encapsulation
I
N
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 network's 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
72
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
T
Timing refers to two characteristics: When data should be sent and how fast they can
I
be sent.
E
a. Connectivity
b. Cost-effective Resource Sharing
c. Support for common Services
d. Performance
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?
73
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.
T
74
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
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
T
c. Application Layer
E
31. Which layer links the network support layers and user support layers?
I
N
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
75
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?
T
The Session layer is the network dialog Controller. It establishes, maintains and
I
a. Dialog control
I
N
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
38. What are the responsibilities of Application Layer?
The Application Layer enables the user, whether human or software, to access the
network. It provides user interfaces and support for services such as e-mail, shared
database management and other types of distributed information services.
a. Network virtual Terminal
b. File transfer, access and Management (FTAM)
c. Mail services
d. Directory Services
39. What are the two classes of hardware building blocks?
Nodes and Links.
76
40. What are the different link types used to build a computer network?
a. Cables
b. Leased Lines
c. Last-Mile Links
d. Wireless Links
41. What are the categories of Transmission media?
a. Guided Media
i. Twisted - Pair cable
1. Shielded TP
2. Unshielded TP
ii. Coaxial Cable
iii. Fiber-optic cable
b. Unguided Media
i. Terrestrial microwave
ii. Satellite Communication
42. What are the types of errors?
T
a. Single-Bit error
I
In a single-bit error, only one bit in the data unit has changed
E
b. Burst Error
I
N
A Burst error means that two or more bits in the data have changed.
43. What is Error Detection? What are its methods?
Data can be corrupted during transmission. For reliable communication errors must be
deducted and Corrected. Error Detection uses the concept of redundancy, which means
adding extra bits for detecting errors at the destination. The common Error Detection
methods are
a. Vertical Redundancy Check (VRC)
b. Longitudinal Redundancy Check (VRC)
c. Cyclic Redundancy Check (VRC)
d. Checksum
44. What is Redundancy?
The concept of including extra information in the transmission solely for the purpose of
comparison. This technique is called redundancy.
45. What is VRC?
It is the most common and least expensive mechanism for Error Detection. In VRC, a
parity bit is added to every data unit so that the total number of 1s becomes even for
even parity. It can detect all single-bit errors. It can detect burst errors only if the total
77
number of errors in each data unit is odd.
46. What is LRC?
In LRC, a block of bits is divided into rows and a redundant row of bits is added to the
whole block. It can detect burst errors. If two bits in one data unit are damaged and bits
in exactly the same positions in another data unit are also damaged, the LRC checker will
not detect an error. In LRC a redundant data unit follows n data units.
47. What is CRC?
CRC, is the most powerful of the redundancy checking techniques, is based on binary
division.
48. What is Checksum?
Checksum is used by the higher layer protocols (TCP/IP) for error detection
49. List the steps involved in creating the checksum.
a. Divide the data into sections
b. Add the sections together using 1's complement arithmetic
c. Take the complement of the final sum, this is the checksum.
50. What are the Data link protocols?
T
Data link protocols are sets of specifications used to implement the data link layer. The
I
2. Synchronous Protocols
I
N
78
codeword.
55. What are Code Words?
"r" redundant bits are added to each block to make the length n = k + r. The resulting n-bit
blocks are called codewords. 2n - 2k codewords that are not used. These codewords are
invalid or illegal.
56. What is a Linear Block Code?
A linear block code is a code in which the exclusive OR (addition modulo-2) of two valid
codewords creates another valid codeword.
57. What are Cyclic Codes?
Cyclic codes are special linear block codes with one extra property. In a cyclic code, if a
codeword is cyclically shifted (rotated), the result is another codeword.
58. Define Encoder?
A device or program that uses predefined algorithms to encode, or compress audio or
video data for storage or transmission use. A circuit that is used to convert between
digital video and analog video.
59. Define Decoder?
T
A device or program that translates encoded data into its original format (e.g. it decodes
I
the data). The term is often used in reference to MPEG-2 video and sound data, which
E
79
in the data, so that the receiver does not mistake the pattern 0111110 for a flag.
64. What is Flow Control?
Flow control refers to a set of procedures used to restrict the amount of data that the
sender can send before waiting for acknowledgment.
65. What is Error Control ?
Error control is both error detection and error correction. It allows the receiver to inform
the sender of any frames lost or damaged in transmission and coordinates the
retransmission of those frames by the sender. In the data link layer, the term error
control refers primarily to methods of error detection and retransmission.
66. What Automatic Repeat Request (ARQ)?
Error control is both error detection and error correction. It allows the receiver to inform
the sender of any frames lost or damaged in transmission and coordinates the
retransmission of those frames by the sender. In the data link layer, the term error
control refers primarily to methods of error detection and retransmission. Error control in
the data link layer is often implemented simply: Any time an error is detected in an
exchange, specified frames are retransmitted. This process is called automatic repeat
T
request (ARQ).
I
In Stop and wait protocol, sender sends one frame, waits until it receives confirmation
I
N
from the receiver (okay to go ahead), and then sends the next frame.
68. What is Stop-and-Wait Automatic Repeat Request?
Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and
retransmitting of the frame when the timer expires.
69. What is usage of Sequence Number in Relaible Transmission?
The protocol specifies that frames need to be numbered. This is done by using sequence
numbers. A field is added to the data frame to hold the sequence number of that frame.
Since we want to minimize the frame size, the smallest range that provides
unambiguous communication. The sequence numbers can wrap around.
70. What is Pipelining ?
In networking and in other areas, a task is often begun before the previous task has
ended. This is known as pipelining.
71. What is Sliding Window?
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, he sender and receiver
need to deal with only part of the possible sequence numbers.
72. What is Piggy Backing?
80
A technique called piggybacking is used to improve the efficiency of the bidirectional
protocols. When a frame is carrying data from A to B, it can also carry control
information about arrived (or lost) frames from B; when a frame is carrying data from B
to A, it can also carry control information about the arrived (or lost) frames from A.
73. What are the two types of transmission technology available?
(i) Broadcast and (ii) point-to-point
74. What is subnet?
A generic term for section of a large networks usually separated by a bridge or router.
75. Difference between the communication and transmission.
Transmission is a physical movement of information and concern issues like bit polarity,
synchronisation, clock etc.
Communication means the meaning full exchange of information between two
communication media.
76. What are the possible ways of data exchange?
(i) Simplex (ii) Half-duplex (iii) Full-duplex.
77. What is SAP?
T
Series of interface points that allow other computers to communicate with the other
I
81
from a remote computer and it hides the networking hardware from applications.
NETBEUI is NetBIOS extended user interface. A transport protocol designed by microsoft
and IBM for the use on small subnets.
84. What is RAID?
A method for providing fault tolerance by using multiple hard disk drives.
85. What is passive topology?
When the computers on the network simply listen and receive the signal, they are
referred to as passive because they don't amplify the signal in any way. Example for
passive topology -linear bus.
86. What is router?
Hybrid devices that combine the features of both bridges and routers.
87. What is cladding?
A layer of a glass surrounding the center fiber of glass inside a fiber-optic cable.
88. What is point-to-point protocol?
A communications protocol used to connect computers to remote networking services
including Internet service providers.
T
A gateway operates at the upper levels of the OSI model and translates information
E
82
Signals are usually transmitted over some transmission media that are broadly
classified in to two categories.
a.) Guided Media: These are those that provide a conduit from one device to another that
include twisted-pair, coaxial cable and fiber-optic cable. A signal traveling along any of
these media is directed and is contained by the physical limits of the medium.
Twisted-pair and coaxial cable use metallic that accept and transport signals in the form
of electrical current. Optical fiber is a glass or plastic cable that accepts and transports
signals in the form of light.
b.) Unguided Media: This is the wireless media that transport electromagnetic waves
without using a physical conductor. Signals are broadcast either through air. This is
done through radio communication, satellite communication and cellular telephony.
95. What is Project 802?
It is a project started by IEEE to set standards to enable intercommunication between
equipment from a variety of manufacturers. It is a way for specifying functions of the
physical layer, the data link layer and to some extent the network layer to allow for
T
1. 802.1 is an internetworking standard for compatibility of different LANs and MANs
N
across protocols.
2. 802.2 Logical link control (LLC) is the upper sublayer of the data link layer which is
non-architecture-specific, that is remains the same for all IEEE-defined LANs.
3. Media access control (MAC) is the lower sublayer of the data link layer that contains
some distinct modules each carrying proprietary information specific to the LAN product
being used. The modules are Ethernet LAN (802.3), Token ring LAN (802.4), Token bus
LAN (802.5).
4. 802.6 is distributed queue dual bus (DQDB) designed to be used in MANs.
96. What is Protocol Data Unit?
The data unit in the LLC level is called the protocol data unit (PDU). The PDU contains of
four fields a destination service access point (DSAP), a source service access point
(SSAP), a control field and an information field. DSAP, SSAP are addresses used by the
LLC to identify the protocol stacks on the receiving and sending machines that are
generating and using the data. The control field specifies whether the PDU frame is a
information frame (I - frame) or a supervisory frame (S - frame) or a unnumbered frame
83
(U - frame).
97. What are the different type of networking / internetworking devices?
1. Repeater: Also called a regenerator, it is an electronic device that operates only at
physical layer. It receives the signal in the network before it becomes weak, regenerates
the original bit pattern and puts the refreshed copy back in to the link.
2. Bridges: These operate both in the physical and data link layers of LANs of same
type. They divide a larger network in to smaller segments. They contain logic that allow
them to keep the traffic for each segment separate and thus are repeaters that relay a
frame only the side of the segment containing the intended recipent and control
congestion.
3. Routers: They relay packets among multiple interconnected networks (i.e. LANs of
different type). They operate in the physical, data link and network layers. They contain
software that enable them to determine which of the several possible paths is the best
for a particular transmission.
4. Gateways: They relay packets among networks that have different protocols (e.g.
T
between a LAN and a WAN). They accept a packet formatted for one protocol and
I
convert it to a packet formatted for another protocol before forwarding it. They operate
E
I
84
receiver.
The reverse address resolution protocol (RARP) allows a host to discover its Internet
address when it knows only its physical address.
101. What is the minimum and maximum length of the header in the TCP segment and IP
datagram?
The header should have a minimum length of 20 bytes and can have a maximum length
of 60 bytes.
102. What is the range of addresses in the classes of internet addresses?
Class A - 0.0.0.0 - 127.255.255.255
Class B - 128.0.0.0 - 191.255.255.255
Class C - 192.0.0.0 - 223.255.255.255
Class D - 224.0.0.0 - 239.255.255.255
Class E - 240.0.0.0 - 247.255.255.255
103. What is the difference between TFTP and FTP application layer protocols?
The Trivial File Transfer Protocol (TFTP) allows a local host to obtain files from a remote
T
I
host but does not provide reliability or security. It uses the fundamental packet delivery
E
The File Transfer Protocol (FTP) is the standard mechanism provided by TCP / IP for
copying a file from one host to another. It uses the services offer by TCP and so is
reliable and secure. It establishes two connections (virtual circuits) between the hosts,
one for data transfer and another for control information.
104. What are major types of networks and explain?
1. Server-based network: provide centralized control of network resources and rely on
server computers to provide security and network administration
2. Peer-to-peer network: computers can act as both servers sharing resources and as
clients using the resources.
105. What are the important topologies for networks?
1. BUS topology: In this each computer is directly connected to primary network cable in a
single line.
Advantages: Inexpensive, easy to install, simple to understand, easy to extend.
2. STAR topology: In this all computers are connected using a central hub.
Advantages: Can be inexpensive, easy to install and reconfigure and easy to trouble
85
shoot physical problems.
3. RING topology: In this all computers are connected in loop. Advantages: All computers
have equal access to network media, installation can be simple, and signal does not
degrade as much as in other topologies because each computer regenerates it.
106. What is mesh network?
A network in which there are multiple network links between computers to provide
multiple paths for data to travel.
107. What is difference between baseband and broadband transmission?
In a baseband transmission, the entire bandwidth of the cable is consumed by a single
signal. In broadband transmission, signals are sent on multiple frequencies, allowing
multiple signals to be sent simultaneously.
108. Explain 5-4-3 rule?
In a Ethernet network, between any two points on the network ,there can be no more than
five network segments or four repeaters, and of those five segments only three of
segments can be populated.
T
I
110. What is the difference between routable and non- routable protocols?
N
Routable protocols can work with a router and can be used to build large networks.
Non-Routable protocols are designed to work on small, local networks and cannot be
used with a router.
111. Why should you care about the OSI Reference Model?
It provides a framework for discussing network operations and design.
112. What is logical link control?
One of two sub layers of the data link layer of OSI reference model, as defined by the
IEEE 802 standard. This sub layer is responsible for maintaining the link between
computers when they are sending data across the physical network connection.
113. What is virtual channel?
Virtual channel is normally a connection from one source to one destination, although
multicast connections are also permitted. The other name for virtual channel is virtual
circuit.
114. What is virtual path?
Along any transmission path from a given source to a given destination, a group of
virtual circuits can be grouped together into what is called path.
86
115. What is packet filter?
Packet filter is a standard router equipped with some extra functionality. The extra
functionality allows every incoming or outgoing packet to be inspected. Packets meeting
some criterion are forwarded normally. Those that fail the test are dropped.
116. What is traffic shaping?
One of the main causes of congestion is that traffic is often busy. If hosts could be made
to transmit at a uniform rate, congestion would be less common. Another open loop
method to help manage congestion is forcing the packet to be transmitted at a more
predictable rate. This is called traffic shaping.
117. What is multicast routing?
Sending a message to a group is called multicasting, and its routing algorithm is called
multicast routing.
118. What is region?
When hierarchical routing is used, the routers are divided into what we will call regions,
with each router knowing all the details about how to route packets to destinations
within its own region, but knowing nothing about the internal structure of other regions.
T
It is a problem that can ruin TCP performance. This problem occurs when data are
E
passed to the sending TCP entity in large blocks, but an interactive application on the
I
N
87
of networks that can be reached within or via each autonomous system.
126. What is autonomous system?
It is a collection of routers under the control of a single administrative authority and that
uses a common Interior Gateway Protocol.
It is a host that has a multiple network interfaces and that requires multiple IP addresses
E
88
N
E
I
T
I
89
Sample Questions
1. Write a program for a HLDC frame to perform the following and execute with example.
i) Bit stuffing
ii) Character stuffing.
2. Write a program for distance vector algorithm to find suitable path for
Transmission execute with example using graph below.
T
I
3. Implement Dijkstra’s algorithm to compute the shortest routing path AND execute with
E
I
4. For the given data, use CRC-CCITT polynomial to obtain CRC code. Verify the
program for the cases execute with example.
a. Without error
b. With error
90
5. Implementation of Stop and Wait Protocol and Sliding Window Protocol execute with
example.
6. Write a program for congestion control using leaky bucket algorithm execute with
example.
7.Implement a point to point network with four nodes and duplex links between them.
Analyse the network performance by setting the queue size and varying the bandwidth
and simulate.
8. 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 and simulate.
10. Implement Ethernet LAN using n nodes and assign multiple traffic to the nodes and
N
11. Implement ESS with transmission nodes in Wireless LAN and obtain the
performance parameters and simulate.
91