0% found this document useful (0 votes)
731 views

DCC Lab Manual - 2020-2021

The document is a laboratory manual that provides instructions and objectives for 14 experiments involving data and computer communications. The first experiment explains the RS232-C standard and UART functions, describing the advantages of serial data transfer over parallel, hardware properties of serial ports, and pinouts of D-type connectors. It also discusses null modems and the UART 8250 chip that controls serial ports.

Uploaded by

Jay Patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
731 views

DCC Lab Manual - 2020-2021

The document is a laboratory manual that provides instructions and objectives for 14 experiments involving data and computer communications. The first experiment explains the RS232-C standard and UART functions, describing the advantages of serial data transfer over parallel, hardware properties of serial ports, and pinouts of D-type connectors. It also discusses null modems and the UART 8250 chip that controls serial ports.

Uploaded by

Jay Patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Laboratory Manual for

EC-702 Data & Computer Communications

B. Tech.

SEM. VII (EC)

Department of Electronics & Communication


Faculty of Technology
Dharmsinh Desai University
Nadiad
TABLE OF CONTENTS

PART I LABORATORY MANUAL

Sr No. Title Page No.


1. UART and RS232-C standard 1
2. Byte Transfer using Serial Port 7
3. File Transfer using Serial Port 8
4. Character stuffing and de-stuffing using Serial Port 10
5. Stop & Wait protocol 13
6. IP Addressing 17
7. Network Planning 19
8. Network Commands 25
9. Packet capturing tool (Wireshark) 30
10. TCP and IP Header using Wireshark 33
11. PING Commands using Wireshark 35
12. TRACERT Command using Wireshark 38
13. Introduction to LAN Trainer kit 40

PART II DATASHEETS

PART III SESSIONAL QUESTION PAPERS


PART I

LABORATORY MANUAL
EXPERIMENT 1

UART AND RS232-C STANDARD

OBJECTIVES:
(i) To understand RS232-C standard and UART functions.
(ii) To study RS232-C cabling scheme.
(iii) To test RS232-C cable using Windows inbuilt utility.

In most cases, any device you connect to the serial port will need the serial transmission
converted back to parallel so that it can be used. This can be done using a UART. On software
side, there are many more registers that you have to attend to than on a Standard Parallel Port.
(SPP)

Advantages of Serial Data Transfer Over Parallel Data Transfer

Serial Cables can be longer than Parallel cables. The serial port transmits a '1' as -3 to -
25 volts and a '0' as +3 to +25 volts where as a parallel port transmits a '0' as 0v and a
'1' as 5v. Therefore the serial port can have a maximum swing of 50V compared to the
parallel port which has a maximum swing of 5 Volts. Therefore cable loss is not as much
of a problem for serial cables then they are for parallel.
You don't need as many wires then parallel transmission. If your device needs to be
mounted a far distance away from the computer then 3 core cable (Null Modem
Configuration) is going to be cheaper that running 19 or 25 core cable. However you
must take into account the cost of the interfacing at each end.
Many electronic diaries and palmtop computers have infra red capabilities build in. Serial
transmission is used where one bit is sent at a time. IrDA-1 (The first infra red
specifications) was capable of 115.2k baud and was interfaced into a UART. The pulse
length however was cut down to 3/16th of an RS 232 bit length to conserve power
considering these devices are mainly used on diaries, laptops and palmtops.
Serial Communication reduces the pin count of Microcontrollers. Only two pins are
commonly used, Transmit Data (TXD) and Receive Data (RXD) compared with at least 8
pins if you use an 8 bit Parallel method (You may also require a Strobe).

Hardware Properties

Devices which use serial cables for their communication are split into two categories. These are
DCE (Data Communications Equipment) and DTE (Data Terminal Equipment.) Data
Communications Equipments are devices such as your modem, TA adapter, plotter etc while
Data Terminal Equipment is your Computer or Terminal
The electrical specifications of the serial port are contained in the RS232C standard. It states
many parameters such as

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 1
Table1.1 RS232 standard parameters

1. A "Space" (logic 0) will be between +3 and +25 Volts.


2. A "Mark" (Logic 1) will be between -3 and -25 Volts
3. The region between +3 and -3 volts is undefined.
4. An open circuit voltage should never exceed 25 volts. (In Reference
to GND)
5. A short circuit current should not exceed 500mA. The driver should
be able to handle this without damage. (Take note of this one!)

The RS 232 C standard specifies a maximum baud rate of 20,000 BPS. Serial Ports come in
two "sizes". There are the D-Type 25 pin connector and the D-Type 9 pin connector both of
which are male on the back of the PC, thus you will require a female connector on your device.
Below is a table of pin connections for the 9 pin and 25 pin D-Type connectors.

Serial Pin outs (D25 and D9 Connectors)


Table1.1 D9 & D25 Pin Connector Pin Configuration

D-Type-25 Pin No. D-Type-9 Pin No. Abbreviation Full Name


Pin 2 Pin 3 TD Transmit Data
Pin 3 Pin 2 RD Receive Data
Pin 4 Pin 7 RTS Request To Send
Pin 5 Pin 8 CTS Clear To Send
Pin 6 Pin 6 DSR Data Set Ready
Pin 7 Pin 5 SG Signal Ground
Pin 8 Pin 1 CD Carrier Detect
Pin 20 Pin 4 DTR Data Terminal Ready
Pin 22 Pin 9 RI Ring Indicator

Pin Functions
Table1.3 Pin Function of D9 Pin Connector

Abbreviation Full Name Function


TD Transmit Data Serial Data Output (TXD)
RD Receive Data Serial Data Input (RXD)
CTS Clear to Send This line indicates that the Modem is ready to exchange
data.
DCD Data Carrier Detect When the modem detects a "Carrier" from the modem at the
other end of the phone line, this Line becomes active.
DSR Data Set Ready This tells the UART that the modem is ready to establish a
link.

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 2
DTR Data Terminal Ready This is the opposite of DSR. This tells the Modem that the
UART is ready to link.
RTS Request To Send This line informs the Modem that the UART is ready to
exchange data.
RI Ring Indicator Goes active when modem detects a ringing signal from the
PSTN.

Null Modems

A Null Modem is used to connect two DTE's together without using intermediate DCEs..

9D to 25D Conversion

Fig.1.1 Null Modem Configuration

The UART (8250 and Compatibles)

UART stands for Universal Asynchronous Receiver / Transmitter. UART 8250 is the device that
controls the serial port. Most cards will have the UART's integrated into other chips which may
also control your parallel port, games port, floppy or hard disk drives and are typically surface
mount devices. The 8250 series, which includes the 16450, 16550, 16650, & 16750 UARTS are
the most commonly found type in your PC.

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 3
All the UARTs pins are TTL compatible. That includes TD, RD, RI, DCD, DSR, CTS, DTR and
RTS which all interface into your serial plug, typically a D-type connector. Therefore RS 232
Level Converters are used.

The UART requires a Clock to run. If you look at your serial card a common crystal found is
either a 1.8432 MHZ or an 18.432 MHZ Crystal. This clock will be used for the Programmable
Baud Rate Generator which directly interfaces into the transmit timing circuits but not directly
into the receiver timing circuits. For this an external connection mast be made from pin 15 (Baud
Out) to pin 9 (Receiver clock in.) Note that the clock signal will be at Baud rate * 16.

Registers

RBR, THR, IER, IIR, FCR, LCR, MCR, LSR, MSR, SCR, DLL, DLM
The communication between the processor and the UART is completely controlled by twelve
registers. These registers can be read or written to check and change the behavior of the
communication device. Each register is eight bits wide. On a PC compatible, the registers are
accessible in the I/O port map.

RBR: Receiver buffer register (RO)

The receiver buffer register contains the byte received if no FIFO is used, or the oldest unread
byte with Fife
next byte, until no more bytes are present. Bit 0 in the line status register can be used to
check if all received bytes have been read. This bit will change to zero if no more bytes are
present.

THR: Transmitter holding register (WO)

The transmitter holding register is used to buffer outgoing characters. If no FIFO buffering is
used, only one character can be stored. Otherwise the amount of characters depends on the
type of UART. Bit 5 in the line status register can be used to check if new information must be
written to the transmitter holding register. The value 1 indicates that the register is empty. If
FIFO buffering is used, more than one character can be written to the transmitter holding
register when the bit signals an empty state. There is no indication of the amount of bytes
currently present in the transmitter FIFO.

The transmitter holding register is not used to transfer the data directly. The byte is first
transferred to a shift register where the information is broken in single bits which are sent one
by one.

LCR: Line control registers (R/W)

The line control register is used at initialization to set the communication parameters. Parity
and number of data bits can be changed for example. The register also controls the

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 4
accessibility of the DLL and DLM registers. Because they are only accessed at initialization
when no communication occurs this register swapping has no influence on performance.

Table1.4 LCR: Line Control Registers

Bit Value Detail


0,1 Bit 1 Bit 0 Data Word Length
0 0 5 Bits
0 1 6 Bits
1 0 7 Bits
1 1 8 Bits
2 0 1 stop bit
1 1.5 stop bits(5 bits word)
2 stop bits (6,7 or 8 bit word)
3,4,5 Bit 5 Bit 4 Bit 3
X X 0 No parity
0 0 1 Odd Parity
0 1 1 Even Parity
1 0 1 High Parity(stick)
1 1 1 Low Parity(stick)
6 0 Break signal disabled
1 Break signal enabled
7 0 DLAB : RBR, THR and IER accessible
1 DLAB : DLL and DLM accessible

Common settings are:


8 data bits, one stop bit, no parity
7 data bits, one stop bit, even parity

LSR : Line status register (RO)

The line status register shows the current state of communication. Errors are reflected in this
register. The state of the receiver and transmitter buffers is also available.

Table1.5 LSR : Line status register

Bit Comment
0 Data available
1 Overrun error
2 Parity error
3 Framing error
4 Break signal received

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 5
5 THR is empty
6 THR is empty, and line is idle
7 Erroneous data in FIFO

Bit 5 and 6 both show the state of the transmitting cycle. The difference is, that bit 5 turns high
as soon as the transmitter holding register is empty whereas bit 6 indicates that also the shift
register which outputs the bits on the line is empty

DLL and DLM : Divisor latch registers (R/W)

The frequency (1.8432 MHz) is divided by 16 to generate the time base for communication.
Because of this division, the maximum allowed communication speed is 115200 bps. Modern
UARTS like the 16550 are capable of handling higher input frequencies up to 24 MHz which
makes it possible to communicate with a maximum speed of 1.5 Mbps. This 115200 bps
communication speed is not suitable for all applications. To change the communication speed,
the frequency can be further decreased by dividing it by a programmable value. For very slow
communications, this value can go beyond 255. Therefore, the divisor is stored in two
separate bytes, the DLL and DLM which contain the least, and most significant byte.

It is necessary that both the transmitting and receiving UART use the same time base. Default
values have been defined which are commonly used. The table shows the most common
values with the appropriate settings of the divisor latch bytes.

Table1.6 DLL and DLM : Divisor latch registers

Speed(bps) Divisor DLL DLM


50 2304 0x00 0x09
300 384 0x80 0x01
1200 96 0x60 0x00
2400 48 0x30 0x00
4800 24 0x18 0x00
9600 12 0x0C 0x00
19200 6 0x06 0x00
38400 3 0x03 0x00
57600 2 0x02 0x00
115200 1 0x01 0x00

CONLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 6
EXPERIMENT 2

BYTE TRANSFER USING SERIAL PORT

OBJECTIVE:
(i) To verify serial port communication between two PCs by writing simple C code.(Byte
transfer)

SAMPLE PROGRAM (TRANSMITTER) :


#include<unistd.h>
#include <stdio.h>
#include <sys/io.h>
int main()
{
char data='B';
ioperm(0x3f8,7,1);
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
while(((inb(0x3fd))&0x60)!=0x60);
outb(data,0x3f8);
printf("data transmitted=%c",data);
}

SAMPLE PROGRAM (RECEIVER) :

#include<unistd.h>
#include <stdio.h>
#include <sys/io.h>
int main( ){
char data;
ioperm(0x3f8,7,1);
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
while(((inb(0x3fd)) & 0x01)!=0x01);
data=inb(0x3f8);
printf("data received=%c",data);
}

CONLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 7
EXPERIMENT 3

FILE TRANSFER USING SERIAL PORT

OBJECTIVES:
(i) Implement simple file transfer utility
(ii) Implementation of file transfer with Framing techniques (character count / character
stuffing)

SAMPLE PROGRAM (TRANSMITTER) :

#include<unistd.h>
#include<stdio.h>
#include<sys/io.h>
int main()
{
FILE *f1;
char c;
ioperm(0x3f8,7,1);
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
f1=fopen("tx.txt","r");
do
{
while((inb(0x3fd) & 0x60)!=0x60);
c=getc(f1);
outb(c,0x3f8);
printf("%c",c);
}while(c!=EOF);
fclose(f1);
printf("\nthe file transmitted\n");
}

SAMPLE PROGRAM (RECEIVER) :

#include<stdio.h>
#include<sys/io.h>
#include<unistd.h>
int main()
{
FILE *f1;

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 8
char ch;
ioperm(0x3f8,7,1);
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
f1=fopen("Rx.txt","w");
do
{
while(((inb(0x3fd)) & 0x01)!=0x01);
ch=inb(0x3f8);
putc(ch,f1);
printf("%c",ch);
}while(ch!=EOF);
fclose(f1);
printf("\nTHE FILE RECEIVED\n");
}

MODIFICATION :

(1) Modify the above program to use faming concept.

CONLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 9
EXPERIMENT - 4

CHARACTER STUFFING AND DE-STUFFING

OBJECTIVE:
(i) Implement character stuffing & de-stuffing concept

SAMPLE PROGRAM (TRANSMITTER):

#include<unistd.h>
#include<stdio.h>
#include<sys/io.h>
#define DLE 0x10
#define STX 0x02
#define ETX 0x03
int main()
{
FILE *f1;
char a[20];
int i=2,flag=0,j;
ioperm(0x3f8,7,1);
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
f1=fopen("Tx.txt","r");

do
{
a[0]=DLE;
a[1]=STX;
i=2;
j=0;
while((j<8) && (flag==0))
{
a[i]=getc(f1);
if (a[i]==EOF)
flag=1;
if (a[i]==DLE)
{
i++;
a[i]=DLE;
}

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 10
i++;
j++;
}
a[i]=DLE;
i++;
a[i]=ETX;
j=0;

do
{
while((inb(0x3fd) & 0x60)!=0x60);
outb(a[j],0x3f8);
printf("%c",a[j]);
j++;
}while(j<(i+1));
}while(flag!=1);
printf("\nthe file transmitted\n\n");
}

SAMPLE PROGRAM (RECEIVER):

#include<unistd.h>
#include<stdio.h>
#include<sys/io.h>
#define DLE 0x10
#define STX 0x02
#define ETX 0x03
int main()
{
FILE *f1;
char a[20];
int i,j,flag=0;
ioperm(0x3f8,7,1);
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
f1=fopen("hp6.txt","w");
do
{ i=0;
do
{
while(((inb(0x3fd)) & 0x01)!=0x01);
a[i]=inb(0x3f8);

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 11
i++;
}while(a[i-1]!=ETX);
for(j=0;j<i;j++)
{
printf("%c",a[j]);
}
j=0;
while(j<i)
{
if(a[j]==EOF)
flag=1;

if((a[j]!=DLE) && (a[j]!=STX) && (a[j]!=ETX))


{ putc(a[j],f1);
j++;
}
else if((a[j]==DLE) && (a[j+1]==DLE))
{putc(a[j],f1);
j+=2;
}
else
j++;
}
}while(flag==0);
fclose(f1);
printf("\nTHE FILE RECEIVED\n");
}
}

CONLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 12
EXPERIMENT 5

STOP & WAIT PROTOCOL

OBJECTIVES:
(i) To implement simple stop & wait protocol
(ii) To understand the role of timer in the protocol

SAMPLE PROGRAM (TRANSMITTER):

#include<stdio.h>
#include<conio.h>
#include<dos.h>
void baud( ) /* Baud rate setting */
{
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
}
void frm_nw_layer( ) /* Go get something to send */
{
int i;
fp=fopen("number.txt",'r');
for (i=0;i<8;i++)
{
data[i]=fgetc(fp);
if (data[i]= =EOF)
{
flag=1;
break;
}
}
fclose(fp);
}
void frame_generate( ) /* To generate a frame */
{
frame[0]=seq; /* Put Seq. No. into frame */
for(i=0;i<8;i++)
{
frame[i+1]=data[i]; /* Put data into frame */
}
frame[i+1]='0';

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 13
if(seq=='1') /* Alter the seq. */
seq='0';
else
seq='1';
}
void to_phy_layer( ) /* Transmit the frame */
{
int i;
status=0;
do
{
for(i=0;i<10;i++)
{
while((inb(0x3fd)&(0x60))!=0x60);
outportb(0x3f8,frame[i]);
}
delay(5000); /* Wait for given delay */
while((inb(0x3fd)&(0x01))!=0x10);
ack=inb(0x3f8);
if(ack= =seq)
{
status=1;
break;
}
}
while(!status= =1 && ack= =seq);
}
char data[8],frame[10];
char seq='0',ack;
FILE *fp;
int status,flag=0,i;

void main( )
{
baud( ); /* Baud rate Setting */
frm_nw_layer( ); /* Go get something to send */
frame_generate( ); /* Get data from network layer and bound
it into frame */
to_phy_layer( ); /* Transmit frame through any physical
medium */
}

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 14
SAMPLE PROGRAM (RECEIVER):

#include<stdio.h>
#include<conio.h>
#include<dos.h>
int flag=0,R=0,i;
char ack,frame[10],data[8];
FILE *fp;
void baud( ) //Baud rate setting
{
outb(0x83,0x3fb);
outb(0x0c,0x3f8);
outb(0x00,0x3f9);
outb(0x03,0x3fb);
}
void fr_phy_layer() //To get the frame from physical layer.
{
int DF;
do
{
DF=0; //Set the Duplicate flag as 0 initially.
for(i=1;i<10;i++)
{
if ((inb(0x3fd)&(0x01))==0x01)
frame[i]=inb(0x3f8);
}
if(frame[9]=='0')
{
if(frame[0]=='0')
ack='1';
if(frame[0]=='1')
ack='0';
if ((inb(0x3fd)&(0x60))==0x60)
outb(ack,0x3f8);
}
if(frame[0]!=R)
{
DF=1;
}
}while(DF!=0);

if(R==0)
R=1;
else

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 15
R=0;
for(i=0;i<8;i++)
{
data[i]=frame[i+1];
}
}
void to_nw_lyr() //Pass the data to Network Layer.
{
for(i=0;i<8;i++)
{
if(data[i]!=EOF)
{
fputc(data[i],fp);
}
else
{
flag=1;
break;
}
}
}
void main()
{
fp=fopen("Rx.txt","w");
do
{
fr_phy_layer(); //Call the function from physical layer.
to_nw_lyr(); //Call the function to network layer.
}while(flag!=1); //Continue untill the flag bit become 1.
fclose(fp); //Close the file.
}

MODIFICATIONS:

(1) Demonstrate the retransmission of data at sender side using


Wrong Acknowledgement
Include the timer at sender (After the timeout retransmission will take place)
(2) Calculate the throughput.

CONLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 16
EXPERIMENT 6

IP ADDRESSING

OBJECTIVES:
(i) To implement a program for IP class identification
(ii) To implement a program for IP address conversion (BCD to Binary)
(iii) To implement a program for finding Network ID (with or without subnet mask)and
number of hosts

SAMPLE PROGRAM (BINARY TO DOTTED DECIMAL FORM):

#include<stdio.h>
int main(){
int i=0;
long bin[4];
int dec[4];
int convert(long);
printf("Enter IP address in binary notation ( separate each byte by space :\n ");
for(i=0;i<4;i++)
{
scanf("%ld",&bin[i]);
dec[i]=convert(bin[i]);
}
printf("IP address in dotted decimal form :\n");
printf("%d.%d.%d.%d",dec[0],dec[1],dec[2],dec[3]);
}
int convert(long data)
{
int power2(int , int);
int sum = 0,i;
for(i=0;data>0;i++)
{
sum+=(data%10)*(power2(2,i));
data = data/10;
}
return sum;
}
int power2(int m , int n)
{
int ans = 1,i;
for(i=1;i<=n;i++)
ans *= m;

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 17
return ans;
}
SAMPLE PROGRAM (DOTTED DECIMAL TO BINARY FORM):

#include<stdio.h>
int main()
{
int i=0;
long bin[4];
int dec[4];
long convert(int);
clrscr();
printf("Enter IP address in dotted decimal notation ( separate each byte by . :\n ");
scanf("%d.%d.%d.%d",&dec[0],&dec[1],&dec[2],&dec[3]);
for(i=0;i<4;i++)
bin[i]=convert(dec[i]);
printf("IP address in pure binary notation :\n");
printf("%08ld %08ld %08ld %08ld",bin[0],bin[1],bin[2],bin[3]);
}
long convert(int data)
{
long power2(long , long);
long sum = 0,i;
for(i=0;data>0;i++)
{
sum+=(data%2)*(power2(10,i));
data = data/2;
}
return sum;
}
long power2(long m , long n)
{
long ans = 1,i;
for(i=1;i<=n;i++)
ans *= m;
return ans;
}
MODIFICATIONS:

(1) Modify the above programs to find network id and host id from entered IP address (either
in binary or dotted decimal form)
(2) Modify the above programs to find class as well as subnet mask of entered IP address.

CONLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 18
EXPERIMENT 7

NETWORK PLANNING

OBJECTIVES:
(i) To study network devices and the specifications of each for existing network plan
(ii) To study existing network plan
(iii) To draw a new network plan as per the new constraints

Hub

A network hub or repeater hub is a device for connecting multiple twisted pair or fiber optic
Ethernet devices together and thus making them act as a single network segment. Hubs work at
the physical layer (layer 1) of the OSI model. The device is thus a form of multiport repeater.
Repeater hubs also participate in collision detection, forwarding a jam signal to all ports if it
detects a collision.

Hubs also often come with a BNC and/or AUI connector to allow connection to legacy 10BASE2
or 10BASE5 network segments. The availability of low-priced network switches has largely
rendered hubs obsolete but they are still seen in older installations and more specialized
applications.

A network hub is a fairly unsophisticated broadcast device. Hubs do not manage any of the
traffic that comes through them, and any packet entering any port is broadcast out on all other
ports. Since every packet is being sent out through all other ports, packet collisions result
which greatly impedes the smooth flow of traffic.

Types of Hubs

1. Passive (A hub which does not need an external power source, because it does not
regenerate the signal and therefore falls as part of the cable, with respect to maximum cable
lengths)
2. Active (A hub which regenerates the signal and therefore needs an external power supply)
3. Intelligent (A hub which provides error detection (e.g. excessive collisions) and also does
what an active hub does)

Passive hubs do not amplify the electrical signal of incoming packets before broadcasting them
out to the network. Active hubs, on the other hand, do perform this amplification, as does a
different type of dedicated network device called a repeater. Another, not so common, name for
the term concentrator is referring to a passive hub and the term multiport repeater is referred to
an active hub.

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 19
Intelligent hubs add extra features to an active hub that are of particular importance to
businesses. An intelligent hub typically is stackable (built in such a way that multiple units can
be placed one on top of the other to conserve space). It also typically includes remote
management capabilities via Simple Network Management Protocol (SNMP) and virtual LAN
(VLAN) support.

Uses

For inserting a protocol analyzer into a network connection, a hub is an alternative to a network
tap or port mirroring.

Some computer clusters require each member computer to receive all of the traffic going to the
cluster A hub will do this naturally; using a switch requires special configuration.

When a switch is accessible for end users to make connections, for example, in a conference
room, an inexperienced or careless user (or saboteur) can bring down the network by
connecting two ports together, causing a loop. This can be prevented by using a hub, where a
loop will break other users on the hub, but not the rest of the network. (It can also be prevented
by buying switches that can detect and deal with loops, for example by implementing the
Spanning Tree Protocol.)

A hub with a 10BASE2 port can be used to connect devices that only support 10BASE2 to a
modern network. The same goes for linking in an old thicknet network segment using an AUI
port on a hub (individual devices that were intended for thicknet can be linked to modern
Ethernet by using an AUI-10BASE-T transceiver).

Switch

In networks, a device that filters and forwards packets between LAN segments. Switches
operate at the data link layer (layer 2) and sometimes the network layer (layer 3) of the OSI
Reference Model and therefore support any packet protocol. LANs that use switches to join
segments are called switched LANs or, in the case of Ethernet networks, switched Ethernet
LANs.

Layer-1 Hubs Versus Higher-Layer Switches

A network hub, or repeater, is a fairly unsophisticated network device. Hubs do not manage any
of the traffic that comes through them. Any packet entering a port is broadcast out or "repeated"
on every other port, except for the port of entry. Since every packet is repeated on every other
port, packet collisions result, which slows down the network.

There are specialized applications where a hub can be useful, such as copying traffic to multiple
network sensors. High end switches have a feature which does the same thing called port

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 20
mirroring. There is no longer any significant price difference between a hub and a low-end
switch.

Layer 2

A network bridge, operating at the Media Access Control (MAC) sublayer of the data link layer,
may interconnect a small number of devices in a home or office. This is a trivial case of bridging,
in which the bridge learns the MAC address of each connected device. Single bridges also can
provide extremely high performance in specialized applications such as storage area networks.

Once a bridge learns the topology through a spanning tree protocol, it forwards data link layer
frames using a layer 2 forwarding method. There are four forwarding methods a bridge can use,
of which the second through fourth method were performance-increasing methods when used
on "switch" products with the same input and output port speeds:

1. Store and forward: The switch buffers and, typically, performs a checksum on each frame
before forwarding it on.
2. Cut through: The switch reads only up to the frame's hardware address before starting to
forward it. There is no error checking with this method.
3. Fragment free: A method that attempts to retain the benefits of both "store and forward"
and "cut through". Fragment free checks the first 64 bytes of the frame, where addressing
information is stored. According to Ethernet specifications, collisions should be detected
during the first 64 bytes of the frame, so frames that are in error because of a collision will
not be forwarded. This way the frame will always reach its intended destination. Error
checking of the actual data in the packet is left for the end device in Layer 3 or Layer 4
(OSI), typically a router.
4. Adaptive switching: A method of automatically switching between the other three modes.

Cut-through switches have to fall back to store and forward if the outgoing port is busy at the
time the packet arrives. While there are specialized applications, such as storage area
networks, where the input and output interfaces are the same speed, this is rarely the case in
general LAN applications. In LANs, a switch used for end user access typically concentrates
lower speed (e.g., 10/100 Mbit/s) into a higher speed (at least 1 Gbit/s). Alternatively, a switch
that provides access to server ports usually connects to them at a much higher speed than is
used by end user devices.

Layer 3

Within the confines of the Ethernet physical layer, a layer 3 switch can perform some or all of
the functions normally performed by a router. A true router is able to forward traffic from one
type of network connection (e.g., T1, DSL) to another (e.g., Ethernet, WiFi).

The most common layer-3 capability is awareness of IP multicast. With this awareness, a layer-
3 switch can increase efficiency by delivering the traffic of a multicast group only to ports where
the attached device has signaled that it wants to listen to that group. If a switch is not aware of

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 21
multicasting and broadcasting, frames are also forwarded on all ports of each broadcast
domain, but in the case of IP multicast this causes inefficient use of bandwidth. To work around
this problem some switches implement IGMP snooping.

Layer 4

While the exact meaning of the term Layer-4 switch is vendor-dependent, it almost always starts
with a capability for network address translation, but then adds some type of load distribution
based on TCP sessions. The device may include a stateful firewall, a VPN concentrator, or be
an IPSec security gateway.

Layer 7

Layer 7 switches may distribute loads based on URL or by some installation-specific technique
to recognize application-level transactions. A Layer-7 switch may include a web cache and
participate in a content delivery network.

Fig.7.1 Router
Router

A device that forwards data packets along networks. A router is connected to at least two networks,
commonly two LANs or WANs or a LAN and its network. Routers are located at gateways, the places
where two or more networks connect.

Routers use headers and forwarding tables to determine the best path for forwarding the
packets, and they use protocols such as ICMP to communicate with each other and configure
the best route between any two hosts. Very little filtering of data is done through routers.

Types of routers

Routers may provide connectivity inside enterprises, between enterprises and the Internet, and
inside Internet Service Providers (ISPs). The largest routers (for example the Cisco CRS-1 or
Juniper T1600) interconnect ISPs, are used inside ISPs, or may be used in very large enterprise

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 22
networks. The smallest routers provide connectivity for small and home offices. Routers for
Internet connectivity and internal use

Routers intended for ISP and major enterprise connectivity will almost invariably exchange
routing information with the Border Gateway Protocol (BGP). RFC 4098 defines several types of
BGP-speaking routers:

Edge Router: Placed at the edge of an ISP network, it speaks external BGP (eBGP) to a
BGP speaker in another provider or large enterprise Autonomous System(AS).
Subscriber Edge Router: Located at the edge of the subscriber's network, it speaks eBGP
to its provider's AS(s). It belongs to an end user (enterprise) organization.
Inter-provider Border Router: Interconnecting ISPs, this is a BGP speaking router that
maintains BGP sessions with other BGP speaking routers in other providers' ASes.
Core router: A router that resides within the middle or backbone of the LAN network rather
than at its periphery.

Within an ISP: Internal to the provider's AS, such a router speaks internal BGP (iBGP) to that
provider's edge routers, other intra-provider core routers, or the provider's inter-provider border
routers.

"Internet backbone:" The Internet does not have a clearly identifiable backbone, as did its
predecessors. See default-free zone (DFZ). Nevertheless, it is the major ISPs' routers that make
up what many would consider the core. These ISPs operate all four types of the BGP-speaking
routers described here. In ISP usage, a "core" router is internal to an ISP, and used to
interconnect its edge and border routers. Core routers may also have specialized functions in
virtual private networks based on a combination of BGP and Multi-Protocol Label Switching
(MPLS). Routers are also used for port forwarding for private servers.

RJ45

The RJ45 is a modular connector used to terminate twisted pair and multiconductor flat
cable. It is not in common use, but RJ45 is used as the name for the 8P8C modular connector,
which is commonly used to terminate Ethernet cable.

Originally, there was only the true telephone RJ45. It is one of the many registered jacks, like
RJ11, a standard from which it gets the "RJ" in its name. As a registered jack, true telephone
RJ45 specifies both the physical connector and wiring pattern. The true telephone RJ45 uses a
special, keyed 8P2C modular connector, with Pins 5 and 4 wired for tip and ring of a single
telephone line and Pins 7 and 8 connected to a programming resistor. It is meant to be used
with a high speed modem, and is obsolete today.

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 23
D-LINK DE-824TP 24 PORT HUB (HUB A)
DE-816TP 16 PORT HUB (HUB B)

BACKBONE N/W

SWITCH
LAB SERVER 192.168.1.X BACKUP SERVER
192.168.11.15 192.168.11.14
GateWay
192.168.11.1
NETID
192.168.11.0

HUB-DLINK B
HUB-DLINK A 24PORT
24PORT

192.168.11.16 192.168.11.17 192.168.11.18 192.168.11.34 192.168.11.35 192.168.11.36 192.168.11.37

192.168.11.11 192.168.11.12 192.168.11.40 192.168.11.39 192.168.11.38


192.168.11.10 192.168.11.13 192.168.11.41

192.168.11.43 192.168.11.45
192.168.11.42 192.168.11.44

192.168.11.9 192.168.11.8 192.168.11.7 192.168.11.6

192.168.11.46
192.168.11.20 192.168.11.3 192.168.11.4 192.168.11.5 192.168.11.49 192.168.11.48 192.168.11.47

FIG.7.2 Network Diagram of lab 9

In this diagram BACKBONE SERVER connected to GATEWAY SERVER through SWITCH


192.168.1.X. this GATEWAY further connected with HUB A. HUB A is internally connected
with HUB B and all the computers of IP address 192.168.11.2 to 192.168.11.18. and HUB B is
connected with all computers with IP address 192.168.11.34 to 192.168.11.46.

CONCLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 24
EXPERIMENT 8

NETWORK COMMANDS

OBJECTIVES:
(i) To test different network utilities like ping, tracert, arp, ipconfig
(ii) To study and use different options for these utilities

Ping

If any system (host or router) want to communicate with the other system (host or route) then it
is necessary to check the communication is possible or not? For this, first of all we have to
check for destination system is reachable or not. Due to hardware failure or any other reason it
is possible the system may on network but not reachable. How can we detect that the
destination system is reachable or not?

PING command is useful for checking the reach ability of the system.

PROCEDURE:

(1) First go to command prompt


(2) For help and information about this command type ping /?
(3) Type ping IP address of system

Example(Different Ping Options):

1. [root@ec20 root]# ping 192.168.51.1

PING 192.168.51.1 (192.168.51.1) 56(84) bytes of data.


64 bytes from 192.168.51.1: icmp_seq=1 ttl=253 time=0.444 ms
64 bytes from 192.168.51.1: icmp_seq=2 ttl=253 time=0.406 ms
64 bytes from 192.168.51.1: icmp_seq=3 ttl=253 time=0.421 ms
64 bytes from 192.168.51.1: icmp_seq=4 ttl=253 time=0.402 ms
^C
--- 192.168.51.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3034ms
rtt min/avg/max/mdev = 0.402/0.418/0.444/0.021 ms

2. [student@local ~]$ ping -t 1 192.168.51.1

PING 192.168.51.1 (192.168.51.1) 56(84) bytes of data.


From 192.168.11.1 icmp_seq=1 Time to live exceeded
From 192.168.11.1 icmp_seq=2 Time to live exceeded

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 25
From 192.168.11.1 icmp_seq=3 Time to live exceeded
^C
--- 192.168.51.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2400ms

3. [student@local ~]$ ping -t 2 192.168.51.1

PING 192.168.51.1 (192.168.51.1) 56(84) bytes of data.


From 192.168.11.1 icmp_seq=1 Time to live exceeded
From 192.168.11.1 icmp_seq=2 Time to live exceeded
From 192.168.11.1 icmp_seq=3 Time to live exceeded
^C
--- 192.168.51.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2400ms

4. [student@local ~]$ ping -t 3 192.168.51.1

PING 192.168.51.1 (192.168.51.1) 56(84) bytes of data.


64 bytes from 192.168.51.1: icmp_seq=1 ttl=253 time=0.444 ms
64 bytes from 192.168.51.1: icmp_seq=2 ttl=253 time=0.406 ms
64 bytes from 192.168.51.1: icmp_seq=3 ttl=253 time=0.421 ms
64 bytes from 192.168.51.1: icmp_seq=4 ttl=253 time=0.402 ms
^C
--- 192.168.51.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3034ms
rtt min/avg/max/mdev = 0.402/0.418/0.444/0.021 ms

5. [student@local ~]$ ping -c 2 192.168.51.1

PING 192.168.51.1 (192.168.51.1) 56(84) bytes of data.


64 bytes from 192.168.51.1: icmp_seq=1 ttl=253 time=0.436 ms
64 bytes from 192.168.51.1: icmp_seq=2 ttl=253 time=0.408 ms

--- 192.168.51.1 ping statistics ---


2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.408/0.422/0.436/0.014 ms

6. [student@local ~]$ ping -I eth0 192.168.51.1


Warning: cannot bind to specified iface, falling back: Operation not permitted
ping: unknown iface eth0

7. [student@local ~]$ ping -I eth1 192.168.51.1


PING 192.168.51.1 (192.168.51.1) from 192.168.11.14 eth1: 56(84) bytes of data.
64 bytes from 192.168.51.1: icmp_seq=1 ttl=253 time=0.428 ms

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 26
64 bytes from 192.168.51.1: icmp_seq=2 ttl=253 time=0.395 ms
64 bytes from 192.168.51.1: icmp_seq=3 ttl=253 time=0.404 ms
64 bytes from 192.168.51.1: icmp_seq=4 ttl=253 time=0.402 ms
64 bytes from 192.168.51.1: icmp_seq=5 ttl=253 time=0.407 ms
^C
--- 192.168.51.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4315ms
rtt min/avg/max/mdev = 0.395/0.407/0.428/0.016 ms

8. [student@local ~]$ ping -r 2 192.168.51.1


Pinging 192.168.51.1 with 32 bytes of data:
Reply from 192.168.51.1: bytes=32 time<1ms TTL=255
Route: 192.168.51.1 ->
192.168.51.1
Reply from 192.168.51.1: bytes=32 time<1ms TTL=255
Route: 192.168.51.1 ->
192.168.51.1
Reply from 192.168.51.1: bytes=32 time<1ms TTL=255
Route: 192.168.51.1 ->
192.168.51.1
Reply from 192.168.51.1: bytes=32 time<1ms TTL=255
Route: 192.168.51.1 ->
192.168.51.1
Ping statistics for 192.168.51.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Tracert / Tracepath

When one system (host or router) send the packet of data to another system then there be two
possibilities, Packet directly reach to destination system or it pass through one or more routers.
TRACERT command is useful to trace the route through which packet passes.

Procedure:

(1) First go to command prompt


(2) For help and information about this command type tracert /?
(3) Type tracert IP address or name of the destination.

Example:

1. [root@ec20 root]# tracert 192.168.1.100


tracert 192.168.1.100

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 27
Tracing route to 192.168.1.100 over a maximum of 30 hops

1 <1 ms <1 ms <1 ms 192.168.51.1


2 <1 ms <1 ms <1 ms 192.168.1.100

Trace complete.

Ipconfig

The "ifconfig" command allows the operating system to setup network interfaces and allow the
user to view information about the configured network interfaces. In absence of arguments , it
displays the status of currently active interface. If a single interface argument is given it displays
the status of the given interface only.

PROCEDURE:
(1) First go to command prompt
(2) For help and information about this command type ipconfig /?
(3) Type ipconfig.

Example:

1. [root@ec20 root]# ifconfig


eth0 Link encap:Ethernet HWaddr 00:80:AD:83:2B:1C
inet addr:192.168.11.20 Bcast:192.168.11.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:600 (600.0 b) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0xc000

lo Link encap:Local Loopback


inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:700 (700.0 b) TX bytes:700 (700.0 b)

ARP

The Address Resolution Protocol (or ARP) is used to map the Internet Protocol address of a
machine to its Ethernet address. It simply uses a table which lists each host, its IP address and
its Ethernet address. You can view the the ARP table on your machine via the arp -a command

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 28
When a datagram is received addressed to an IP address on your network the router uses this
table to find the Ethernet address of the specified host and forwards the datagram appropriately.

Procedure

(1) First go to command prompt


(2) For help and information about this command type tracert /?
(3) Type arp -a

Example(with different arp options):

1. [root@local student]# cat /proc/net/arp or arp -e


IP address HW type Flags HW address Mask Device
192.168.11.3 0x1 0x2 00:19:db:68:d4:9c * eth1
192.168.11.4 0x1 0x2 00:19:db:68:d4:8a * eth1
192.168.11.1 0x1 0x2 00:50:af:0a:5b:80 * eth1

2. [root@local student]# arp -d 192.168.11.3

3. [root@local student]# cat /proc/net/arp or arp -e


IP address HW type Flags HW address Mask Device
192.168.11.3 0x1 0x0 00:19:db:68:d4:9c * eth1
192.168.11.4 0x1 0x2 00:19:db:68:d4:8a * eth1
192.168.11.1 0x1 0x2 00:50:af:0a:5b:80 * eth1

CONCLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 29
EXPERIMENT 9

PACKET CAPTURING TOOL (WIRESHARK)

OBJECTIVE:
(i) Understanding of packet capturing tool

Wireshark is a network packet analyzer. A network packet analyzer will try to capture network
packets and tries to display that packet data as detailed as possible.

PROCEDURE:

(1) Open Wireshark

Fig.9.1 Main Window of Wireshrk

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 30
(2) Goto Capture option

Fig.9.2 Capture Option

3. Select the Interface and Start capture

Fig.9.3 Start Capturing

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 31
Stop capturing after some time.

4. It will display the captured packet and details of those packets

Fig.9.4 Packet Captured

5. It will display the captured packet and details of those packets.

CONCLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 32
EXPERIMENT 10

TCP AND IP HEADER USING WIRESHARK

OBJECTIVES:
(i) Analysis of captured packets
(ii) Access the TCP and IP header using Wireshark

PROCEDURE :

(1) Prepare Wireshark for a packet capture.


(2) Open a Command Prompt window. (In Linux , from menu the run command and type
konsole).
(3)
(4) Start Wireshark packet capture.
(5) Press ENTER in Command Prompt window. You should obtain a series of replies in
command prompt.
(6) Stop packet capture when Command Prompt returns.
(7) Save the contents in the Command Prompt window using a screen capture.

Protocol Analysis
IP Header
Command : ping 192.168.11.16

Fig.10.1 IP Packet Format Using Wireshrk

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 33
TCP Header
Command : ftp 192.168.11.6

Fig.10.2 TCP Packet Format Using Ehtereal

CONCLUSION :

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 34
EXPERIMENT - 11

PING COMMAND USING WIRESHARK

OBJECTIVE:
(i) Investigate an applications of the Internet Control Message Protocol (ICMP)

PROCEDURE:
(1) Prepare Wireshark for a packet capture.
(2) Open a Command Prompt window. (In Linux , from menu the run command and type
konsole).
(3)
(4) Start Wireshark packet capture.
(5) Press ENTER in Command Prompt window. You should obtain a series of replies in
command prompt.
(6) Stop packet capture when Command Prompt returns.
(7) Save the contents in the Command Prompt window using a screen capture.

Protocol Analysis

1. ICMP Echo Request and Reply


Command : ping 192.168.11.1

Fig.11.1 Request and Reply

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 35
2. IP Time-to-Live
Command : ping -t 1 192.168.51.1

Fig.11.2 IP Time to Live Request

Command : ping -t 2 192.168.51.1

Fig.11.3 IP Time to Live Reply

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 36
Command : ping -t 3 192.168.51.1

Fig.11.4 IP Time to Live = 3


3. Time Exceeded Message
Command : ping -t 1 192.168.11.4

Fig.11.5 Time Exceeded Message

CONCLUSION :

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 37
EXPERIMENT 12

TRACERT COMMAND USING WIRESHARK


OBJECTIVE:
(i) Investigate internal working of TRACERT as an applications of the Internet Control
Message Protocol (ICMP)

PROCEDURE:

(1) Prepare Wireshark for a packet capture.


(2) Open a Command Prompt window. (In Linux , from menu the run command and type
konsole).
(3)
(4) Start Wireshark packet capture.
(5) Press ENTER in Command Prompt window. You should obtain a series of replies in
command prompt.
(6) Stop packet capture when Command Prompt returns.
(7) Save the contents in the Command Prompt window using a screen capture.

PROTOCOL ANALYSIS:

1. ICMP Echo Request and Reply


Command : tracert 192.168.1.100 (ttl = 1)

Fig.12.1 ICMP Request and Reply

ttl=2

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 38
Fig.12.2 ttl =2
Reply Packet:

Fig.12.3 ICMP Reply

CONCLUSION:

Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 39

You might also like