Computer Networks: Practical File K. Manisha 2018UIT2523 It Sec-1
Computer Networks: Practical File K. Manisha 2018UIT2523 It Sec-1
PRACTICAL FILE
K. MANISHA
2018UIT2523
IT SEC-1
1. To study the various Physical layer
components of networking.
A.CONNECTIONS
BNC : The BNC (Bayonet Neill–Concelman) connector is a miniature quick
connect / disconnect radio frequency connector used for coaxial cable. It
features two bayonet lugs on the female connector; mating is fully achieved
with a quarter turn of the coupling nut. BNC connectors are most commonly
made in 50 ohm and 75 ohm versions, matched for use with cables of the
same characteristic impedance. The 75 ohm connector is dimensionally slightly
different from the 50 ohm variant, but the two nevertheless can be made to
mate. The 75 ohm types can sometimes be recognized by the reduced or
absent dielectric in the mating ends but this is by no means reliable. There was
a proposal in the early 1970s for the dielectric material to be coloured red in
75 ohm connectors, and while this is occasionally implemented, it did not
become standard. The 75 ohm connectors are typically specified for use at
frequencies up to 2 GHz. 75 ohm BNC connectors are primarily used in Video
(particularly HD video signals) and DS3 Telco central office applications. Many
VHF receivers use 75 ohm antenna inputs, so they often used 75 ohm BNC
connectors. The 50 ohm connectors are typically specified for use at
frequencies up to 4 GHz. 50 ohm connectors are used for data and RF. A 95
ohm variant is used within the aerospace sector, but rarely elsewhere. It is
used with the 95 ohm video connections for glass cockpit displays on some
aircraft.
similar to a telephone jack, but is slightly wider. Since Ethernet cables have an
RJ45
connector on each end, Ethernet cables are sometimes also called RJ45 cables.
The "RJ" in RJ45 stands for "registered jack," since it is a standardized
networking interface.
The "45" simply refers to the number of the interface standard. Each RJ45
connector has
eight pins, which means an RJ45 cable contains eight separate wires. If you
look closely at
the end of an Ethernet cable, you can actually see the eight wires, which are
each a different
color. Four of them are solid colors, while the other four are striped.
B.CABLES
CO-AXIAL : Coaxial cable is a type of copper cable specially built with a
metal shield and other components engineered to block signal interference. It
is primarily used by cable TV companies to connect their satellite antenna
facilities to customer homes and businesses. It is also sometimes used by
telephone companies to connect central offices to telephone poles near
customers. Some homes and offices use coaxial cable, too, but its widespread
use as an Ethernet connectivity medium in enterprises and data centers has
been supplanted by the deployment of twisted pair cabling. Coaxial cable
received its name because it includes one physical channel that carries the
signal surrounded -- after a layer of insulation -- by another concentric physical
channel, both running along the same axis. The outer channel serves as a
ground. Many of these cables or pairs of coaxial tubes can be placed in a single
outer sheathing and, with repeaters, can carry information for a great
distance.
How coaxial cables work : Coaxial cables have concentric layers of electrical
conductors and insulating material. This construction ensures signals are
enclosed within the cable and prevents electrical noise from interfering with
the signal.
The center conductor layer is a thin conducting wire, either solid or braided
copper. A dielectric layer, made up of an insulating material with very well-
defined electrical characteristics, surrounds the wire. A shield layer then
surrounds the dielectric layer with metal foil or braided copper mesh. The whole
assembly is wrapped in an insulating jacket.The outer metal shield layer of the
coaxial cable is typically grounded in the connectors at both ends to shield the
signals and as a place for stray interference signals to dissipate.
Reason for Twisting : All transmissions are prone to noise, interferences, and
crosstalks. When the wires are twisted, some part of the noise signals is in the
direction of data signals while the other parts are in the opposite directions. Thus
the external waves cancel out due to the different twists. The receiver calculates
the difference in the voltages of the two wires for retrieving data.Thus a much
better immunity against noise is obtained.
1. In telephone lines
2. In DSL lines
3. In LANs
UTP: UTP Cable is a shorter way of saying unshielded twisted pair. This is one of
the least expensive wires and works for basic needs of phone systems so it is one
of the most commonly installed in residential industries. The twisted cable pairs
work to cancel out EMI (electromagnetic interference) from external sources. This
would be interference from electromagnetic radiation, ground water, pressure,
root systems and more. It also cuts down on crosstalk. Interestingly enough, UTP
wire is accredited with being discovered by Alexander Graham Bell. It is no
surprise that UTP Cable is the single most common type of copper telephone
wire.The two wires in each pair carry opposite signals. Each signal is detected as
the opposite end when the signal reaches the receiver. Twisting the pairs
together is how the effects of crosstalk are countered. Multiple pair cabling is a
necessity for handling all forms of communication needs. The purpose of the
cable really determines how many pairs are needed. Analog systems, digital
systems and ethernet systems all require a different number of pairs. Sometimes,
because it is less expensive than coaxial cable, UTP and STP (Shielded twisted
pair) are sometimes used in basic LAN installations. Most of the time though, UTP
cables are used in computer networking and in modern Ethernet solutions. It is
also used in data networks as networks which have short or medium length will
save money over optical fiber or coaxial cable.UTP cable is also finding a home in
video applications. Mostly it is security cameras, not the cinematic type. The
bandwidth of UTP has been improved so it now matches baseband needed to
connect.
iv) Router: Routers operate on the third layer of the OSI Model, the Network-
Control Layer. Rather than passing packets based on the Media Access Control
(MAC) Layer addresses (as bridges do), a router examines the packet's data
structure and determines whether or not to forward it. This determination is
made based on the network information within the packet. Once the router
determines where the packet should be sent, it finds the fastest route to send the
data to its destination. The router also has to send this data in the most
appropriate format for transferring information. That means it may repackage or
break the data into smaller pieces than the receiving destinations can handle.
Routers don't have a bridge's ability to learn addresses, so they have to do more
data processing than bridges do. Routers also have to be aware of the network
protocols they serve and often have more complex installation and configuration
requirements.
2. Write down important information from the top or bottom of the card such
3. Ensure you are familiar with ESD and its potential dangers.
Before installing the network card, verify that the jumpers are properly set.
Today, most computers do not have jumpers for a network card installation and
allow for the network card to be set up and configured through software or plug
Today, network cards connect to the PCI slot. Locate an available slot in the
computer and gently push the card into the slot until it snaps into place. Once
the card is in the expansion slot, place a screw into the top of the card to hold
If your computer has a network card already installed and you are replacing or
upgrading that network card, you need to remove the existing network card
Most network cards will not include internal cables, but you may find Wake-on-
LAN cable, which wakes the computer when network activity is present. If cables
are included with the network card and your computer supports these cables,
install the cables now. The Wake-on-LAN cable must also be a supported feature
of the computer motherboard. The cable will connect to the Wake-on-LAN or
similar connection on the motherboard. Consult the motherboard documentation
or manufacturer for additional information if this is a supported feature or where
the cable should be connected.
Software setup
Once connected, turn the computer on and install the drivers for the Network
card. If you do not have drivers for your network card or the network card drivers
included appear not to work, you can find links to network drivers on our network
card drivers page. Once the Network card is installed, set the configuration values
for the network card in the software. These values will depend on the
configuration of your network. If it is a corporate or business network, and you
aren't sure how to configure your network card, contact your network's
administrator for detailed instructions.
The lowest layer of the OSI reference model is the physical layer. It is responsible
for the actual physical connection between the devices. The physical layer
contains information in the form of bits. It is responsible for transmitting
individual bits from one node to the next. When receiving data, this layer will get
the signal received and convert it into 0s and 1s and send them to the Data Link
layer, which will put the frame back together.
2. Bit rate control: The Physical layer also defines the transmission rate i.e. the
number of bits sent per second.
4. Transmission mode: Physical layer also defines the way in which the data flows
between the two connected devices. The various transmission modes possible
are: Simplex, half-duplex and full-duplex.
Hub, Repeater, Modem, Cables are Physical Layer devices. Network Layer, Data
Link Layer and Physical Layer are also known as Lower Layers or Hardware Layers.
The data link layer is responsible for the node to node delivery of the
message.
The main function of this layer is to make sure data transfer is error-free
from one node to another, over the physical layer. When a packet arrives in
a network, it is the responsibility of DLL to transmit it to the Host using its
MAC address.
Data Link Layer is divided into two sub layers :
1. Logical Link Control (LLC)
2. Media Access Control (MAC)
The packet received from Network layer is further divided into frames
depending on the frame size of NIC(Network Interface Card). DLL also
encapsulates Sender and Receiver’s MAC address in the header.
The Receiver’s MAC address is obtained by placing an ARP(Address
Resolution Protocol) request onto the wire asking “Who has that IP
address?” and the destination host will reply with its MAC address.
The functions of the data Link layer are :
1. Framing: Framing is a function of the data link layer. It provides a way for
a sender to transmit a set of bits that are meaningful to the receiver. This
can be accomplished by attaching special bit patterns to the beginning and
end of the frame.
2. Physical addressing: After creating frames, Data link layer adds physical
addresses (MAC address) of sender and/or receiver in the header of each
frame.
3. Error control: Data link layer provides the mechanism of error control in
which it detects and retransmits damaged or lost frames.
4. Flow Control: The data rate must be constant on both sides else the data
may get corrupted thus , flow control coordinates that amount of data that
can be sent before receiving acknowledgement.
5. Access control: When a single communication channel is shared by
multiple devices, MAC sub-layer of data link layer helps to determine which
device has control over the channel at a given time. The Packet in Data Link
layer is referred as Frame.
5.Bit Stuffing
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int a[20],b[30],i,j,k,count,n;
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)
{
if(a[i]==1)
{
b[j]=a[i];
for(k=i+1; a[k]==1 && k<n && count<5; k++)
{
j++;
b[j]=a[k];
count++;
if(count==5)
{
j++;
b[j]=0;
}
i=k;
}
}
else
{
b[j]=a[i];
}
i++;
j++;
}
printf("After Bit Stuffing :");
for(i=0; i<j; i++)
printf("%d",b[i]);
getch();
}
Byte Stuffing
#include<stdio.h>
#include<string.h>
main()
{
char a[30], fs[50] = " ", t[3], sd, ed, x[3], s[3], d[3], y[3];
int i, j, p = 0, q = 0;
Parity Check
#include <iostream>
using namespace std;
bool findParity(int n)
{
int count = 0;
int temp = n;
while (temp>=2)
{
if(temp & 1)
count++;
temp = temp >> 1;
}
return (count % 2)?true:false;
}
int main()
{
int n;
cout << "Enter a number: "; cin >>n;
cout << "Parity of " << n << " is "<<(findParity(n)?"Odd":"Even");
}
CRC
#include<stdio.h>
main()
{
int da[20],di[20],te[20],tem[20],l;
int i,j,m,n,data,div,t,k,e;
clrscr();
printf("\nEnter the total bit of data and divisor");
scanf("%d %d",&data,&div);
m=data+div-1;
printf("\nEnter the data:");
for(i=0;i<data;i++)
{
scanf("%d",&da[i]);te[i]=da[i];
}
for(i=data;i<m;i++)
{
te[i]=0;
}
printf("\nEnter the divisor");
for(i=0;i<div;i++)
{ scanf("%d",&di[i]); }
l=div;t=0;
k=0;
for(i=0;i<data;i++)
{
e=0;t=0;
for(j=1;j<div;j++)
{
if(((da[j]==1)&&(di[j]==1))||((da[j]==0)&&(di[j]==0)))
{
tem[j-1]=0;
if(e!=1)
{
k=k+1;
t=t+1;
i=i+1;
}
}
else
{
tem[j-1]=1;
e=1;
}
}
j=0;
for(e=t;e<div-1;e++)
{
da[j]=tem[e];
j++;
}
for(j=j;j<div;j++)
{
if(l>=data+1)
{
da[j]=0;
}
else
{
da[j]=te[l];
l=l+1;
}
}
}
printf("\n The CRC BITS are\t ");
for(i=0;i<div-1;i++)
{
printf(" %d",tem[i]);
}
}
Checksum
#include<stdio.h>
#include<string.h>
int main()
{
char a[20],b[20];
char sum[20],complement[20];
int i,length;
printf("Enter first binary string\n");
scanf("%s",&a);
printf("Enter second binary string\n");
scanf("%s",&b);
if(strlen(a)==strlen(b)){
length = strlen(a);
char carry='0';
for(i=length-1;i>=0;i--)
{
sum[i]='0';
carry='0';
}
else if(a[i]=='0' && b[i]=='0' && carry=='1')
{
sum[i]='1';
carry='0';
}
else if(a[i]=='0' && b[i]=='1' && carry=='0')
{
sum[i]='1';
carry='0';
}
else if(a[i]=='0' && b[i]=='1' && carry=='1')
{
sum[i]='0';
carry='1';
}
else if(a[i]=='1' && b[i]=='0' && carry=='0')
{
sum[i]='1';
carry='0';
}
else if(a[i]=='1' && b[i]=='0' && carry=='1')
{
sum[i]='0';
carry='1';
}
else if(a[i]=='1' && b[i]=='1' && carry=='0')
{
sum[i]='0';
carry='1';
}
else if(a[i]=='1' && b[i]=='1' && carry=='1')
{
sum[i]='1';
carry='1';
}
else
break;
}
printf("\nSum=%c%s",carry,sum);
for(i=0;i<length;i++)
{
if(sum[i]=='0')
complement[i]='1';
else
complement[i]='0';
}
if(carry=='1')
carry='0';
else
carry='1';
printf("\nChecksum=%c%s",carry,complement);
}
else {
printf("\nWrong input strings");
}
}
7. Implement Error Correcting technique like hamming
code.
#include<stdio.h>
void main() {
int data[10];
int dataatrec[10],c,c1,c2,c3,i;
printf("Enter 4 bits of data one by one\n");
scanf("%d",&data[0]);
scanf("%d",&data[1]);
scanf("%d",&data[2]);
scanf("%d",&data[4]);
//Calculation of even parity
data[6]=data[0]^data[2]^data[4];
data[5]=data[0]^data[1]^data[4];
data[3]=data[0]^data[1]^data[2];
printf("\nEncoded data is\n");
for(i=0;i<7;i++)
printf("%d",data[i]);
printf("\n\nEnter received data bits one by one\n");
for(i=0;i<7;i++)
scanf("%d",&dataatrec[i]);
c1=dataatrec[6]^dataatrec[4]^dataatrec[2]^dataatrec[0];
c2=dataatrec[5]^dataatrec[4]^dataatrec[1]^dataatrec[0];
c3=dataatrec[3]^dataatrec[2]^dataatrec[1]^dataatrec[0];
c=c3*4+c2*2+c1 ;
if(c==0) {
printf("\nNo error while transmission of data\n");
}
else {
printf("\nError on position %d",c);
printf("\nData sent : ");
for(i=0;i<7;i++)
printf("%d",data[i]);
printf("\nData received : ");
for(i=0;i<7;i++)
printf("%d",dataatrec[i]);
printf("\nCorrect message is\n");
if(dataatrec[7-c]==0)
dataatrec[7-c]=1;
else
dataatrec[7-c]=0;
for (i=0;i<7;i++)
{
printf("%d",dataatrec[i]);
}
}
}
8.Implement Distant vector routing algorithm.
#include<stdio.h>
struct node
{
unsigned dist[20];
unsigned from[20];
}rt[10];
int main()
{
int costmat[20][20];
int nodes,i,j,k,count=0;
printf("\nEnter the number of nodes : ");
scanf("%d",&nodes);
printf("\nEnter the cost matrix :\n");
for(i=0;i<nodes;i++)
{
for(j=0;j<nodes;j++)
{
scanf("%d",&costmat[i][j]);
costmat[i][i]=0;
rt[i].dist[j]=costmat[i][j];
rt[i].from[j]=j;
}
}
do
{
count=0;
for(i=0;i<nodes;i++)
for(j=0;j<nodes;j++)
for(k=0;k<nodes;k++)
if(rt[i].dist[j]>costmat[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<nodes;i++)
{
printf("\n\n For router %d\n",i+1);
for(j=0;j<nodes;j++)
{
printf("\t\nnode %d via %d Distance %d ",j+1,rt[i].from[j]+1,rt[i].dist[j]);
}
}
printf("\n\n");
getch();
}
IPV6
An Internet Protocol Version 6 address (IPv6 address) is a numerical label
that is used to identify a network interface of a computer or a network
node participating in an IPv6 computer network and for locating it in the
network. IP addresses are transmitted in the fields of the packet header to
indicate the source and the destination of each network packet. The
IP address of the destination address is used to make decisions about
routing IP packets to other networks.
IPv6 is the successor to the first addressing infrastructure of the Internet,
Internet Protocol version 4 (IPv4). In contrast to IPv4, which defined an IP
address as a 32-bit value, IPv6 addresses have a size of 128 bits. Therefore,
IPv6 has a vastly enlarged address space
compared to IPv4.
IPv6 addresses are classified by the primary addressing and routing
methodologies common in networking: unicast addressing, anycast
addressing, and multicast addressing.
A unicast address identifies a single network interface. The Internet
Protocol delivers packets sent to a unicast address to that specific interface.
An anycast address is assigned to a group of interfaces, usually belonging to
different nodes.
A packet sent to an anycast address is delivered to just one of the member
interfaces, typically the nearest host, according to the routing protocol's
definition of distance. Any cast addresses cannot be identified easily, they
have the same format as unicast addresses, and differ only by their
presence in the network at multiple points. Almost any unicast address can
be employed as an anycast address.
A multicast address is also used by multiple hosts, which acquire the
multicast address destination by participating in the multicast distribution
protocol among the network routers. A packet that is sent to a multicast
address is delivered to all interfaces that have joined the
corresponding multicast group. IPv6 does not implement broadcast
addressing. Broadcast's traditional role is subsumed by multicast addressing
to the all-nodes link-local multicast group
ff02::1. However, the use of the all-nodes group is not recommended, and
most IPv6 protocols use a dedicated link-local multicast group to avoid
disturbing every interface in the network.
An IPv6 address consists of 128 bits. For each of the major addressing and
routing methodologies, various address formats are recognized by logically
dividing the 128 address bits into bit groups and establishing rules for
associating the values of these bit groups with special addressing features.
Net ID
Classful Addressing
A classful network is a network addressing architecture used in the Internet
from 1981 until the introduction of Classless Inter-Domain Routing in 1993.
The method divides the IP address space for Internet Protocol version 4
(IPv4) into five address classes based on the leading four address bits.
Classes A, B, and C provide unicast addresses for networks of three
different network sizes. Class D is for multicast networking and the class E
address range is reserved for future or experimental purposes.
Since its discontinuation, remnants of classful network concepts have
remained in practice only in limited scope in the default configuration
parameters of some network software and hardware components, most
notably in the default configuration of subnet masks.
Host ID
Host ID is a specific piece of information which uniquely identifies a
computer. Host IDs are used to generate MATLAB license files, which are
machine-specific. Most of the time, the host ID is the lowest-enumerated
MAC address of the computer. However, there are exceptions to this:
Examples:
● ipconfig /all - Retrieves All TCP/IP Network Information (MAC address,
adapter description, DHCP details)
● ipconfig /release - Releases the IPv4 Address of All Network Adapters
● ipconfig /release6 - Releases the IPv6 Address of All Network Adapters
● ipconfig /release <adapter> - Releases the IP Address of a Specific
Network Adapter
● ipconfig /renew - Get a New IPv4 Address for All Network Adapter
● ipconfig /renew6 - Get a New IPv6 Address for All Network Adapters
Example:
pathping /n corp1
Tracing route to corp1 [10.54.1.196]
over a maximum of 30 hops:
0 172.16.87.35
1 172.16.87.218
2 192.168.52.1
3 192.168.80.1
4 10.54.247.14
5 10.54.1.196
e) Arp:
ARP Command is a TCP/IP utility and Microsoft Windows command for
viewing and modifying the local Address Resolution Protocol (ARP) cache,
which contains recently resolved MAC addresses of Internet Protocol (IP)
hosts on the network. When one host on a TCP/IP network wants to
communicate with a second host, the first host begins by using the
ARP to resolve the IP address of the second host into its associated MAC
address. The MAC address is needed for communication to take place over
the network.
ARP Command example
Typing arp -a displays the MAC addresses of recently resolved IP addresses.
A sample display could be
Interface: 172.16.8.50
Internet Address Physical Address Type
172.16.8.25 00-20-af-b4-a1-4e dynamic
172.16.8.200 00-40-95-d1-29-6c static