Study of Networking Devices: Network Interface Cards
Study of Networking Devices: Network Interface Cards
Study of Networking Devices: Network Interface Cards
Hubs:-
A hub contains multiple ports. When a packet arrives at one port, it is copied to
all the ports of the hub for transmission. In a hub, a frame is passed along or
"broadcast" to every one of its ports. It doesn't matter that the frame is only
destined for one port. The hub has no way of distinguishing which port a frame
should be sent to. Passing it along to every port ensures that it will reach its
intended destination.
Switches:-
The switch is a relatively new network device that has replaced both hubs and
bridges in LANs. A switch uses an internal address table to route incoming data
frames via the port associated with their destination MAC address. Switches can
be used to connect together a number of end-user devices such as workstations,
or to interconnect multiple network segments. A switch that interconnects end-
user devices is often called a workgroup switch.
Routers:-
Routers are networking devices that forward data packets between networks
using headers and forwarding tables to determine the best path to forward the
packets. A network environment that consists of several interconnected
networks employing different network protocols and architectures requires a
sophisticated device to manage the flow of traffic between these diverse
networks. Such a device, sometimes referred to as an intermediate system, but
more commonly called a router, must be able to determine how to get incoming
packets (or datagrams) to the destination network by the most efficient route.
Gateways:-
A node on a network that serves as an entrance to another network. In
enterprises, the gateway is the computer that routes the traffic from
a workstation to the outside network that is serving the Web pages. In homes,
the gateway is the ISP that connects the user to the internet.
In enterprises, the gateway node often acts as a proxy server and a firewall. The
gateway is also associated with both a router, which use headers and
forwarding tables to determine where packets are sent, and a switch, which
provides the actual path for the packet in and out of the gateway.
Study of Inter-networking Devices
An internetworking device is a widely-used term for any hardware within
networks that connect different network resources. Key devices that comprise
a network are routers, bridges, repeaters and gateways.
All devices have searately installed scope features, per network requirements
and scenarios.
Repeaters:-
A repeater is an electronic device that receives a signal and retransmits it at a
higher power level, or to the other side of an obstruction, so that the signal can
cover longer distances without degradation. In most twisted pair ethernet
configurations, repeaters are required for cable runs longer than 100 meters
away from the computer. As signals travel along a transmission medium there
will be a loss of signal strength i.e. attenuation.
Bridges:-
A network bridge connects multiple network segments at the data link layer
(layer 2) of the OSI model. Bridges do not copy traffic to all ports, as hubs do,
but learn which MAC addresses are reachable through specific ports. Once the
bridge associates a port and an address, it will send traffic for that address only
to that port. Bridges do send broadcasts to all ports except the one on which the
broadcast was received.
Modem:-
A modem (modulator-demodulator) is a network hardware device
that modulates one or more carrier wave signals to encode digital
information for transmission and demodulates signals to decode the
transmitted information. The goal is to produce a signal that can be transmitted
easily and decoded to reproduce the original digital data. Modems can be used
with any means of transmitting analog signals, from light emitting
diodes to radio. A common type of modem is one that turns the digital data of
a computer into modulated electrical signal for transmission over telephone
lines and demodulated by another modem at the receiver side to recover the
digital data.
Modems are generally classified by the amount of data they can send in a
given unit of time, usually expressed in bits per second (symbol bit/s,
sometimes abbreviated "bps"), or bytes per second (symbol B/s).
Study of IP Addressing
IP address:-
In the most widely installed level of the Internet Protocol (IP) today, an IP
address is a 32-bit number that identifies each sender or receiver of information
that is sent in packets across the Internet. An IP address has two parts: the
identifier of a particular network on the Internet and an identifier of the
particular device (which can be a server or a workstation) within that network.
Each device must know its own IP address and the IP address of the device with
which it needs to communicate (source and destination). To communicate on
the Internet, every organization must have at least one valid Internet IP address.
This unique network number is included in any packet sent out of the network
onto the Internet. In addition to the network address or number, information is
needed about which specific machine or host in a network is sending or
receiving a message. So the IP address needs both the unique network number
and a host number (which is unique within the network).
Address does not change - good for web servers, email servers and other
Internet servers.
Use DNS to map domain name to IP address, and use domain name to
address the static IP address. Similar can be achieved with Dynamic DNS
for dynamic IP address, but it's not as clean as the static IP address.
Dynamic IP address:-
IP ADDRESS CLASSES:-
Class A
Class A addresses always have the first bit of their IP addresses set to 0. Since
Class A networks have an 8-bit network mask, the use of a leading zero leaves
only 7 bits for the network portion of the address, allowing for a maximum of
128 possible network numbers, ranging from 0.0.0.0 127.0.0.0. Number
127.x.x.x is reserved for loopback, used for internal testing on the local
machine.
Class B
Class B addresses always have the first bit set to 1 and their second bit set to
0. Since Class B addresses have a 16-bit network mask, the use of a leading
10 bit-pattern leaves 14 bits for the network portion of the address, allowing
for a maximum of 16,384 networks, ranging from 128.0.0.0 181.255.0.0.
Class C
Class C addresses have their first two bits set to 1 and their third bit set to 0.
Since Class C addresses have a 24-bit network mask, this leaves 21 bits for the
network portion of the address, allowing for a maximum of 2,097,152 network
addresses, ranging from 192.0.0.0 223.255.255.0.
Class D
Class D addresses are used for multicasting applications. Class D addresses have
their first three bits set to 1 and their fourth bit set to 0. Class D addresses
are 32-bit network addresses, meaning that all the values within the range of
224.0.0.0 239.255.255.255 are used to uniquely identify multicast groups.
There are no host addresses within the Class D address space, since all the hosts
within a group share the groups IP address for receiver purposes.
Class E
This IP Class is reserved for experimental purposes only for R&D or Study. IP
addresses in this class ranges from 240.0.0.0 to 255.255.255.254. Like Class
D, this class too is not equipped with any subnet mask
Write a Program to develop CRC:-
#include<stdio.h>
#include<string.h>
#define N strlen(g)
char t[28],cs[28],g[]="10001000000100001";
int a,e,c;
void xoro(){
for(c = 1;c < N; c++)
cs[c] = (( cs[c] == g[c])?'0':'1');
}
void crc(){
for(e=0;e<N;e++)
cs[e]=t[e];
do{
if(cs[0]=='1')
xoro();
for(c=0;c<N-1;c++)
cs[c]=cs[c+1];
cs[c]=t[e++];
}while(e<=a+N-1);
}
int main()
{
printf("\nEnter data : ");
scanf("%s",t);
printf("\n----------------------------------------");
printf("\nGeneratng polynomial : %s",g);
a=strlen(t);
for(e=a;e<a+N-1;e++)
t[e]='0';
printf("\n----------------------------------------");
printf("\nModified data is : %s",t);
printf("\n----------------------------------------");
crc();
printf("\nChecksum is : %s",cs);
for(e=a;e<a+N-1;e++)
t[e]=cs[e-a];
printf("\n----------------------------------------");
printf("\nFinal codeword is : %s",t);
printf("\n----------------------------------------");
printf("\nTest error detection 0(yes) 1(no)? : ");
scanf("%d",&e);
if(e==0)
{
do{
printf("\nEnter the position where error is to be inserted : ");
scanf("%d",&e);
}while(e==0 || e>a+N-1);
t[e-1]=(t[e-1]=='0')?'1':'0';
printf("\n----------------------------------------");
printf("\nErroneous data : %s\n",t);
}
crc();
for(e=0;(e<N-1) && (cs[e]!='1');e++);
if(e<N-1)
printf("\nError detected\n\n");
else
printf("\nNo error detected\n\n");
printf("\n----------------------------------------\n");
return 0;
}
Write a Program to develop LRC:-
#include<stdio.h>
#include<conio.h>
int binary(int);
void parity(int [],int []);
int arr[8],arr1[8],parityarr[8];
char chr;
int go,temp,temp1,i;
int main()
{ char chr1;
go=0;
Sender:
if(go==0)
printf("Enter Data : \n");
printf("\nEnter a character : ");
scanf("%c %c",&chr,&chr1);
temp=chr;
binary(temp);
printf("\n\nAscii value is : %d\n",temp);
printf("\nBinary Form : ");
for(i=7;i>=0;i--)
{
arr1[i]=arr[i];
printf("%d ",arr[i]);
}
printf("\n");
temp1=chr1;
binary(temp1);
printf("\n\nAscii value is : %d\n",temp1);
printf("\nBinary Form : ");
for(i=7;i>=0;i--)
{
printf("%d ",arr[i]);
}
parity(arr,arr1);
for(i=7;i>=0;i--)
{
arr[i]=0;
arr1[i]=0;
}
getch();
}
void parity(int arr[],int arr1[])
{
printf("Receiver Side :\n");
printf("\n\nLRC :\n");
for(i=7;i>=0;i--)
{
printf("%d ",arr[i]);
}
printf("\n");
for(i=7;i>=0;i--)
{
printf("%d ",arr1[i]);
}
printf("\n---------------------\n");
for(i=0;i<8;i++)
{
if(arr[i]==0 && arr1[i]==0 || arr[i]==1 && arr1[i]==1)
{
parityarr[i]=0;
}
else if(arr[i]==1 && arr1[i]==0 || arr[i]==0 && arr1[i]==1)
{
parityarr[i]=1;
}
}
for(i=7;i>=0;i--)
{
printf("%d ",parityarr[i]);
}
}
int binary(int x)
{
int rem;
int ctr=0,i=1;
do
{
rem=x%2;
arr[i]=rem;
if(rem==1)
{
ctr++;
}
x=x/2;
i++;
}
while(x!=0);
if(ctr%2==0)
{
arr[0]=0;
}
else
{
arr[0]=1;
}
return(0);
}
Write a Program to develop VRC:-
#include<iostream>
#include<conio.h>
int binary(int);
void parity(int[]);
int arr[9],arr1[9];
char chr;
int temp,temp1,i;
int main()
{ char chr1;
printf("Enter Data :");
scanf("%c %c",&chr,&chr1);
temp=chr;
binary(temp);
printf("\nAscii value is : %d\n",temp);
printf("\nBinary Form : ");
for(i=0;i<8;i++)
{
arr1[i]=arr[i];
printf("%d ",arr[i]);
}
printf("\n");
parity(arr);
temp1=chr1;
binary(temp1);
printf("\n\nAscii value is : %d\n",temp1);
printf("\nBinary Form : ");
for(i=0;i<8;i++)
{
printf("%d ",arr[i]);
}
parity(arr);
getch();
}
void parity(int a[])
{
int count;
count=0;
for(i=0;i<8;i++)
{
if(a[i]==1)
count++;
}
if(count%2==0)
a[8]=0;
else
a[8]=1;
count=0;
printf("Receiver Side :\n");
printf("\n\nVRC : \n");
for(i=0;i<9;i++)
{
if(i==8)
printf(" | ");
printf("%d ",a[i]);
}
}
int binary(int x)
{
int rem;
int ctr=0,i=1;
do
{
rem=x%2;
arr[i]=rem;
if(rem==1)
{
ctr++;
}
x=x/2;
i++;
}
while(x!=0);
if(ctr%2==0)
{
arr[0]=0;
}
else
{
arr[0]=1;
}
return(0);
}