CN Practical-Swapnil Tiwari 1713310233

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 63

Experiment 1

AIM- To make UTP cable with RJ45 connector and built and test simple network using
UTP cable (crossover) and a hub based (straight thru) cable.

Theory- Physical layer defines the cable or physical medium itself, e.g., thinnet,
thicknet, unshielded twisted pairs (UTP). It transmits raw bit stream over physical cable,
defines cables, cards, and physical aspects ,defines NIC attachments to ,hardware, how
cable is attached to NIC, defines techniques to transfer bit stream to cable. All media are
functionally equivalent. The main difference is in convenience and cost of installation and
maintenance. Network Cabling Cable is the medium through which information usually
moves from one network device to another. There are several types of cable which are
commonly used with LANs. In some cases, a network will utilize only one type of cable,
other networks will use a variety of cable types. The type of cable chosen for a network is
related to the network's topology, protocol, and size. Types of cables used in networks
are:

1. Unshielded Twisted Pair (UTP) Cable

2. Shielded Twisted Pair (STP) Cable

3. Coaxial Cable

4. Fiber Optic Cable

5. wireless media
Categories of Unshielded Twisted Pair defined Ethernet Cable Summary
by EIA/TIA

Type Use Specificatio Maximum


Cable Type
ns length
Category 1 Voice Only (Telephone Wire)

Unshielded
Category 2 Data to 4 Mbps (LocalTalk) Twisted
10BaseT 100 meters
Pair
Category 3 Data to 10 Mbps (Ethernet)

10Base2 Thin Coaxial 185 meters


Data to 20 Mbps (16 Mbps Token
Category 4
Ring) 10Base5 Thick Coaxial 500 meters

Category 5 Data to 100 Mbps (Fast Ethernet) 10BaseF Fiber Optic 2000 meters

Category 6 10 Gbps (Gigabit Ethernet) 55 meters Unshielded


100BaseT Twisted 100 meters
Category 7 10 Gbps (Gigabit Ethernet) 100 meters Pair

Unshielded
100BaseTX Twisted 220 meters
Pair

Unshielded Twisted Pair Connector-The standard connector for unshielded twisted pair
cabling is an RJ-45 connector.

Swapnil Tiwari
1713310233
Fig. 2. RJ-45 connector

Shielded Twisted Pair (STP) Cable -A disadvantage of UTP is that it may be


susceptible to radio and electrical frequency interference. Shielded twisted pair (STP) is
suitable for environments with electrical interference; however, the extra shielding can
make the cables quite bulky. Shielded twisted pair is often used on networks using Token
Ring topology.

Ethernet Cable : color – code Standards

T-568A Straight-Through Ethernet Cable

The T-568A standard is supposed to be used in new network installations. Most off-the-
shelf Ethernet cables are still of the T-568B standard; however, it makes no functional
difference.

T-568B Straight-Through Ethernet Cable

Swapnil Tiwari
1713310233
Both the T-568A and the T-568B standard Straight-Through cables are used most often as
patch cords for Ethernet connections. If we require a cable to connect two Ethernet
devices directly together without a hub or when connecting two hubs together, we need to
use a Crossover cable instead.

RJ-45 Crossover Ethernet Cable

Standard End Crossover End

Pin 1 White/Orange Pin 1 White/Green

Pin 2 Orange Pin 2 Green

Pin 3 White/Green Pin 3 White/Orange

Pin 4 Blue Pin 4 Blue

Swapnil Tiwari
1713310233
Pin 5 White/Blue Pin 5 White/Blue

Pin 6 Green Pin 6 Orange

Pin 7 White/Brown Pin 7 White/Brown

Pin 8 Brown Pin 8 Brown

Crossover Ethernet cable is to wire one end using the T-568A standard and the other end
using the T-568B standard. Another way of remembering the color coding is to simply
switch the Green set of wires in place with the Orange set of wires. Specifically, switch
the solid Green (G) with the solid Orange, and switch the green/white with the
orange/white.

By looking at a T-568A UTP Ethernet straight-thru cable and an Ethernet crossover cable
with a T-568B end, we see that the TX (transmitter) pins are connected to the
corresponding RX (receiver) pins, plus to plus and minus to minus. You can also see that
both the blue and brown wire pairs on pins 4, 5, 7, and 8 are not used in either standard.
What you may not realize is that, these same pins 4, 5, 7, and 8 are not used or required in
100BASE-TX as well. So why bother using these wires, well for one thing its simply
easier to make a connection with all the wires grouped together. Otherwise you'll be
spending time trying to fit those tiny little wires into each of the corresponding holes in
the RJ-45 connector.

Deciding which cable to use :


here's a small chart that will give an idea which cable should go where:

computer to computer    crossover cable

computer to hub    straight through cable

hub port to hub port    crossover cable

hub uplink to hub port    straight through cable

Swapnil Tiwari
1713310233
computer to broadband router port    straight through cable

computer to switch    straight through cable

computer to cable modem    crossover cable

cable modem to router    crossover cable

hub uplink to switch port    straight through cable

Two computers scenario:


If we have only two computers, it will need two nic's and a crossover cable. If you also
require both computers to have internet access, then you could either 
(a). Install another NIC (connect it to the cable/DSL modem with a crossover cable) or
fax modem in one and connect it to the internet, then use a software proxy, ICS, Wingate,
etc to share the internet.

OR

(b). Get a router (Connect  it  using a  crossover  cable to the cable  modem  and connect 
the  computers to the built in switch on the router. Some routers don't have built in
switches, in this case you will need to get a switch or hub.

c) More than two computers scenario (hub/switch cascading):


With more computers we will need a hub/switch and straight through cables, connect all
computers to the hub/switch with straight through cable. If  you  run out of  ports  then
add another hub/switch to your network. Connect the uplink of one hub/switch to a port
on the other hub/switch using a straight through cable, or connect port  to port using a
crossover  cable.  

Swapnil Tiwari
1713310233
If we have more than two hubs/switches, then connect all the hub/switches using uplink
ports and straight through cables, to regular ports on a main hub/switch.

If you require internet connectivity:


(a) Install another NIC (connect it to the cable/DSL modem with a crossover cable), or
fax modem in one machine and connect it to the internet. Use a software proxy, ICS,
Wingate, etc to share the internet.
Now connect the gateway computer and the rest of the computers to the hub's ports using
straight through cables.

OR

(b) Using a broadband router, connect a cable modem with a crossover cable to the WAN
port of the router, then connect the other computers to the router's LAN ports If you do
not have enough ports then get more hub/switches. Connect the uplink ports to the
router's LAN port with straight through cables and connect your computers to the
hubs/switches.

  Procedure-

1. Start on one end of cable and strip the cable jacket off using a stripper.

Swapnil Tiwari
1713310233
2. Spread, untwist the pairs, and arrange the wires in the order of the desired cable
end. Flatten the end between your thumb and forefinger. Trim the ends of the
wires so they are even with one another.

3. Hold the RJ-45 plug with the clip facing down.Push the wires firmly into the plug.
Inspect each wire is flat even at the front of the plug. Check the order of the
wires.Check that the jacket is fitted right against the stop of the plug.Carefully
hold the wire and firmly crimp the RJ-45 with the crimper.

4. Check the color orientation, check that the crimped connection is not about to
come apart, and check to see if the wires are flat against the front of the plug

5. Similarly make end 2 according to the color coding for straight through cable or
crossover cable on the basis of requirement.

Connecting PC’s using direct cable UTP –

1.use crossover UTP cable.

2.Insert RJ45 connector to both PC’s NIC card.

3.restart both computers and both of them detect the network after logon.

Connecting PC to hub-

1 use straight through UTP cable.

2.Insert RJ45 connector to computer’s NIC card and other end to HUB.

3.Switch o power of HUB and computer.

Swapnil Tiwari
1713310233
Precautions-

 A straight-thru cable has identical ends.


 A crossover cable has different ends.

 A straight-thru is used as a patch cord in Ethernet connections.

 A crossover is used to connect two Ethernet devices without a hub or for


connecting two hubs.

 No more than 1/2" of the Ethernet cable should be untwisted otherwise it will be
susceptible to crosstalk.

 Do not deform, do not bend, do not stretch, do not staple, do not run parallel with
power cables, and do not run Ethernet cables near noise inducing components.

Swapnil Tiwari
1713310233
EXPERIMENT 2

AIM- Implementation of CRC algorithm in C.

#include <stdio.h>

#include <conio.h>

#include <string.h>

void main()

int i,j,keylen,msglen;

char input[100], key[30],temp[30],quot[100],rem[30],key1[30];

clrscr();

printf("Enter Data: ");

gets(input);

printf("Enter Key: ");

gets(key);

keylen=strlen(key);

msglen=strlen(input);

strcpy(key1,key);

for(i=0;i<keylen-1;i++)

input[msglen+i]='0';

for(i=0;i<keylen;i++)

Swapnil Tiwari
1713310233
temp[i]=input[i];

for(i=0;i<msglen;i++)

quot[i]=temp[0];

if(quot[i]=='0')

for(j=0;j<keylen;j++)

key[j]='0';

else

for(j=0;j<keylen;j++)

key[j]=key1[j];

for(j=keylen-1;j>0;j--)

if(temp[j]==key[j])

rem[j-1]='0';

else

rem[j-1]='1';

rem[keylen-1]=input[i+keylen];

strcpy(temp,rem);

strcpy(rem,temp);

printf("\nQuotient is ");

for(i=0;i<msglen;i++)

printf("%c",quot[i]);

Swapnil Tiwari
1713310233
printf("\nRemainder is ");

for(i=0;i<keylen-1;i++)

printf("%c",rem[i]);

printf("\nFinal data is: ");

for(i=0;i<msglen;i++)

printf("%c",input[i]);

for(i=0;i<keylen-1;i++)

printf("%c",rem[i]);

getch();

Output:

Swapnil Tiwari
1713310233
Swapnil Tiwari
1713310233
EXPERIMENT 3

Objective: Implement framing at data link layer such as bit stuffing.


Theory:

In data transmission and telecommunication, bit stuffing (also known -- uncommonly --


as positive justification) is the insertion of non-information bits into data. Stuffed bits
should not be confused with overhead bits.

Bit stuffing is used for various purposes, such as for bringing bit streams that do not
necessarily have the same or rationally related bit rates up to a common rate, or to fill
buffers or frames. The location of the stuffing bits is communicated to the receiving end
of the data link, where these extra bits are removed to return the bit streams to their
original bit rates or form. Bit stuffing may be used to synchronize several channels before
multiplexing or to rate-match two single channels to each other..

Use reserved bit patterns to indicate the start and end of a frame. For instance, use the 4-
bit sequence of 0111 to delimit consecutive frames. A frame consists of everything
between two delimiters.

Within the frame, replace every occurrence of two consecutive 1's with 110. E.g., append
a zero bit after each pair of 1's in the data. This prevents 3 consecutive 1's from ever
appearing in the frame.

Example: The frame 1011101 would be transmitted over the physical layer as
0111101101010111.

Algorithm: -
Bit stuffing
 Each frame begins with a start and end bit sequence, e.g., 01111110
 When sender’s data link layer sees five 1’s in a row, it stuffs a zero bit
 The receiver “unstuffs” a zero after five consecutive 1’s.

Bit unstuffing
 When a pattern of five 1s appears, examine sixth bit
 If the sixth bit is 0, remove it (stuffed bit)
 If the sixth bit is 1, check seventh bit
 If 0, accept as flag (BOF or EOF)
If 1, error

Source Code for stuffing is: -

Swapnil Tiwari
1713310233
#include<conio.h>
#include<stdio.h>
void main()
{ int data[25],n,n1,i,j,k,temp,count=0;
int flag[]={0,1,1,1,1,1,1,0};
clrscr();
printf("\n ENTER NO.OF BITS\n");
scanf("%d",&n);
printf("\nENTER DATA WITHOUT FLAG\n");
for(i=0;i<n;i++)
{ scanf("%d",&data[i]);
}
n1=n;
for(i=0;i<n;i++)
{ if(data[i]==0)

{ for(k=i+1;k<i+8;k++)

{ while(count!=5)

{ if(data[k]==1)

{ count=count+1;

k++;

else

{ count=0;

break;

if(count==5)

{ printf("\n5 ONE's ARE THERE, STUFFING OCCURS\n");


Swapnil Tiwari
1713310233
for(j=n1+1;j>=k;j--)

{ data[j]=data[j-1];

data[k]=0;

n1++;

i=i+7;

count=0;

}
}
printf("\nTHE STUFFED DATA WITH FLAG IS\n");
for(i=0;i<8;i++)

{ printf("%d",flag[i]);

}
printf("-");
for(i=0;i<n1;i++)

{ printf("%d",data[i]);

printf("-");
for(i=0;i<8;i++)

{ printf("%d",flag[i]);

}
getch();
}

Swapnil Tiwari
1713310233
Source Code for Unstuffing is: -

#include<conio.h>
#include<stdio.h>
void main()
{ int data[25],n,n1,i,j,k,temp,count=0;
printf("\n ENTER NO.OF BITS\n");
scanf("%d",&n);
printf("\nENTER DATA\n");
for(i=0;i<n;i++)
{ scanf("%d",&data[i]);
}
n1=n;
for(i=0;i<n;i++)
{ if(data[i]==0)
{
for(k=i+1;k<i+8;k++)
{
while(count!=5)
{
if(data[k]==1)
{
count=count+1;
k++;
}
else
{ count=0;
break;
}
}
if(count==5)
{ if(data[k]==0)

{ printf("\n5 ONE's ARE THERE,UNSTUFFING OCCURS\n");


for(i=k;i<n-1;i++)
{ data[i]=data[i+1];
}
n1--;
i=i+6;

Swapnil Tiwari
1713310233
count=0;
}
else
{ if(data[k+1]==1)
{ printf("\n THE DATA IS ERRONEOUS\n");
getch();
exit(0);
}
else
{ printf("\nFLAG IS PRESENT\nUNSTUFFING WILL NOT OCCUR ");
count=0;
}
}
}
}
}
}
printf("\nTHE UNSTUFFED/RECEIVED DATA \n");
for(i=0;i<n1;i++)

{ printf("%d",data[i]);

}
getch();
}

Swapnil Tiwari
1713310233
Experiment 4

AIM: Implementation of a Hamming (7, 4) code to limit the noise. We have to code the
4 bit data in to 7 bit data by adding 3 parity bit. Implementation will be in C or
python.

Algorithm:-

Around 1947 Richard W. Hamming developed technique for detecting and correcting
single bit errors in transmitted data. His technique requires that three parity bits (or check
bits) be transmitted with every four data bits. The algorithm is called a (7, 4) code,
because it requires seven bits to encoded four bits of data.

Forward Error Correction (FEC), the ability of receiving station to correct a transmission
error, can increase the throughput of a data link operating in a noisy environment. The
transmitting station must append information to the data in the form of error correction
bits, but the increase in frame length may be modest relative to the cost of re
transmission. (Sometimes the correction takes too much time and we prefer to re
transmit). Hamming codes provide for FEC using a "block parity" mechanism that can be
inexpensively implemented. In general, their use allows the correction of single bit errors
and detection of two bit errors per unit data, called a code word.

The fundamental principal embraced by Hamming codes is parity. Hamming codes, as


mentioned before, are capable of correcting one error or detecting two errors but not
capable of doing both simultaneously. You may choose to use Hamming codes as an error
detection mechanism to catch both single and double bit errors or to correct single bit
error. This is accomplished by using more than one parity bit, each computed on different
combination of bits in the data.

The number of parity or error check bits required is given by the Hamming rule, and is a
function of the number of bits of information transmitted. The Hamming rule is expressed
by the following inequality:

d+p+1<=2

Where d is the number of data bits and p is the number of parity bits.

To find out length of hamming code

L=2n -1 where l=0, 1, 2, 3…

To find out parity bit positions in hamming code

A parity bit can be inserted at each 2n position in hamming code, where n=0, 1, 2, 3

Swapnil Tiwari
1713310233
20=1

21=2

22=4

23=8

For example in a 7-bit hamming code parity bit positions will be 1, 2, and 4 only.

For finding parity bit values, remember the followings

1. Check PARITY for positions 1,3,5,7 to get P1


2. Check PARITY for positions 2,3,6,7 to get p2
3. Check PARITY for positions 3,5,6,7 to get p3 and then put their values in
hamming code format to get hamming code word.
D7 D6 D5 P4 D3 P2 P1

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]);
  
   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];

Swapnil Tiwari
1713310233
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 errorneous bit is 0 we complement it else vice versa
if(dataatrec[7-c]==0)
dataatrec[7-c]=1;
        else
dataatrec[7-c]=0;

for (i=0;i<7;i++) {

printf("%d",dataatrec[i]);
}
}
}

Swapnil Tiwari
1713310233
EXPERIMENT 5

AIM-Utilization of TCP/IP commands: ipconfig, tracert, netstat, ping, ftp, nslookup, telnet.

Theory and Procedure-

1.) ipconfig

This command details how IP is setup on the machine you are logged into.

At the command prompt, type: ipconfig

There are also a variety of switches for ipconfig that add functions. These are invoked by entering
"ipconfig /{switch}". To obtain a list of switches, enter "ipconfig /?" or "ipconfig -?".

These are shown in the figure below.

ipconfig [/? | /all | /release [adapter] | /renew [adapter]]

/? Display this help message.

/all Display full configuration information.

/release
Release the IP address for the specified adapter.

/renew
Renew the IP address for the specified adapter.

Swapnil Tiwari
1713310233
For a detailed output of network parameters, use the command "ipconfig /all". Unless you are experienced
with networks, however, this may be more than we want to know.

TRACERT

This command shows you all the routers that your TCP/IP message goes through in order to make a
connection to another IP address. 

At the command prompt, type: tracert xxx Where xxx is the IP address or URL of the machine that we are
trying to connect to.

e.g.  tracert192.168.0.18 

Swapnil Tiwari
1713310233
eg.tracert 192.168.0.25

because the host(192.168.0.25) is shut down.

eg.tracert yahoo.com

Swapnil Tiwari
1713310233
Here is the result of tracert from college computer to yahoo.com ( DNS has resolved the name
“yahoo.com” to 129.64.99.33)

Other options available in tracert command

tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name

-d  Do not resolve addresses to hostnames.

-h maximum_hops
Maximum number of hops to search for target. 

-j host-list Loose source route along host-list. 

-w timeoutWait timeout milliseconds for each reply 

NETSTAT

The netstat command is used to display the TCP/IP network protocol statistics and informatio n

NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]

Swapnil Tiwari
1713310233
-a Displays all connections and listening ports. (Server-side connections are normally not shown).

-e  Displays Ethernet statistics. This may be combined with the -s option. 

-n Displays addresses and port numbers in numerical form. 

Shows connections for the protocol specified by proto; proto may be tcp or udp. If used with
-p proto 
the -s option to display per-protocol statistics, proto may be tcp, udp, or ip. 

-r  Displays the contents of the routing table. 

Displays per-protocol statistics. By default, statistics are shown for TCP, UDP and IP; the -p
-s 
option may be used to specify a subset of the default. 

Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C
interval  to stop redisplaying statistics. If omitted, netstat will print the current configuration
information once. 

Swapnil Tiwari
1713310233
ARP

Display or manipulate the arp information on a network device or computer.

ARP -s inet_addr eth_adr [if_addr]


ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr]

-a Displays current ARP entries by interrogating the current protocol data. If inet_

addr is specified, the IP and Physical addresses for only the specified computer

are displayed. If more than one network interface uses ARP, entries for each

ARP table are displayed.


-g Same as –a

-N if addr   Displays the ARP entries for the network interface specified by if_addr.
-d Deletes the host specified by inet_addr.

Swapnil Tiwari
1713310233
-s Adds the host and associates the Internet address inet_addr with the Physical

address eth_addr. The Physical address is given as 6 hexadecimal bytes separated

by hyphens. The entry is permanent.


eth_addr Specifies a physical address
if_addr If present, this specifies the Internet address of the interface whose address

translation table should be modified. If not present, the first applicable interface

will be used.

Ping command

The ping command is a Command Prompt command used to test the ability of the source
computer to reach a specified destination computer. The ping command is usually used as
a simple way to verify that a computer can communicate over the network with another
computer or network device.

The ping command operates by sending Internet Control Message Protocol (ICMP)


Echo Request messages to the destination computer and waiting for a response. How
many of those responses are returned, and how long it takes for them to return, are the two
major pieces of information that the ping command provides.

For example, you might find that there are no responses when pinging a network printer,
only to find out that the printer is offline and its cable needs replaced. Or maybe you need
to ping a router to verify that your computer can connect to it, to eliminate it as a possible
cause for a networking issue.

Example:

Ping www.google.com

Swapnil Tiwari
1713310233
Ping 192.168.4.1

Ping Command Options

Item Explanation

-t Using this option will ping the target until you force it to stop by using Ctrl-C.

-a This ping command option will resolve, if possible, the hostname of an IP


address target.

-ncount This option sets the number of ICMP Echo Requests to send, from 1 to
4294967295. The ping command will send 4 by default if -n isn't used.

-l size Use this option to set the size, in bytes, of the echo request packet from 32 to
65,527. The ping command will send a 32-byte echo request if you don't use the -
l option.

-f Use this ping command option to prevent ICMP Echo Requests from being
fragmented by routers between you and the target. The -f option is most often
used to troubleshoot Path Maximum Transmission Unit (PMTU) issues.

-i TTL This option sets the Time to Live (TTL) value, the maximum of which is 255.

-v TOS This option allows you to set a Type of Service (TOS) value. Beginning in
Windows 7, this option no longer functions but still exists for compatibility
reasons.

-rcount Use this ping command option to specify the number of hops between your
computer and the target computer or device that you'd like to be recorded and
displayed. The maximum value for count is 9, so use the tracert command instead
if you're interested in viewing all the hops between two devices.

-scount Use this option to report the time, in Internet Timestamp format, that each echo
request is received and echo reply is sent. The maximum value for count is 4,
meaning that only the first four hops can be time stamped.

- Specifying a timeout value when executing the ping command adjusts the amount
wtimeout of time, in milliseconds, that ping waits for each reply. If you don't use the -

Swapnil Tiwari
1713310233
Ping Command Options

w option, the default timeout value of 4000 is used, which is 4 seconds.

-R This option tells the ping command to trace the round trip path.

-SsrcaddrUse this option to specify the source address.

-p Use this switch to ping a Hyper-V Network Virtualization provider address.

-4 This forces the ping command to use IPv4 only but is only necessary if target is a
hostname and not an IP address.

-6 This forces the ping command to use IPv6 only but as with the -4option, is only
necessary when pinging a hostname.

target This is the destination you wish to ping, either an IP address or a hostname.

/? Use the help switch with the ping command to show detailed help about the
command's several options.

ping 127.0.01

In the above example, we're pinging 127.0.0.1, also called the IPv4 localhost IP address or
IPv4 loopback IP address, without options.

Using the ping command to ping 127.0.0.1 is an excellent way to test that Windows'
network features are working properly but it says nothing about your own
network hardware or your connection to any other computer or device. The IPv6 version of
this test would be ping ::1.

FTP Command

Command Function Example(s)

Swapnil Tiwari
1713310233
Connect to an FTP server
ftp
(type this command in the
ftp ftp ftp.servername.com
terminal window to begin an FTP
ftp 123.456.789.012
session)

Opens a connection with an FTP


server
open open ftp.servername.com
(may be followed by a login
prompt)

help OR ? Display a list of commands help

? Display helpful information about


? chmod
[command] a command

Display the current directory on


pwd pwd
the FTP server

Change the directory on the FTP cd www (open the "www" directory)
Cd
server cd .. (move up one directory)

Chage the directory on your local


Lcd lcd Documents
computer

ls OR dir List the contents of a directory ls

rename Rename a file rename test1.html test2.html

delete Delete a file delete test.html

mkdir Create a new directory mkdir testing

rmdir Remove an existing directory rmdir testing

Set the file transfer mode to


ascii ascii
ASCII text

Set the file transfer mode to


binary binary
Binary

Retrieves a file from the FTP


Get get test1.php Documents/test2.php
server

Swapnil Tiwari
1713310233
put Sends a file to the FTP server put Documents/test1.php test2.php

Retrieves multiple files from the


FTP server
mget mget test1.php test2.php test3.php
(requires "Y" or "N" before
downloading each file)

Sends multiple files to the FTP


server
mput mput test1.php test2.php test3.php
(requires "Y" or "N" before
sending each file)

close Close the current FTP session close

quit, exit,
Exit the FTP program quit
or bye

Nslookup command

Swapnil Tiwari
1713310233
Stands for “Name Server Lookup” is a useful command for getting information from DNS
server. It is a network administration tool for querying the Domain Name System (DNS) to
obtain domain name or IP address mapping or any other specific DNS record. It is also
used to troubleshoot DNS related problems.

nslookup google.com : 

nslookup followed by the domain name will display the “A Record” (IP Address) of
the domain. Use this command to find the address record for a domain. It queries to
domain name servers and get the details.

nslookup 192.168.0.10 :

Reverse DNS lookup you can also do the reverse DNS look-up by providing the IP
Address as argument to nslookup.

nslookup -type=any google.com 

Lookup for any record we can also view all the available DNS records using -
type=any option.

Swapnil Tiwari
1713310233
nslookup -type=soa redhat.com :

Lookup for an soa record SOA record (start of authority), provides the authoritative
information about the domain, the e-mail address of the omain admin, the domain
serial number, etc

Swapnil Tiwari
1713310233
nslookup -type=ns google.com 

Lookup for an ns record NS (Name Server) record maps a domain name to a list of
DNS servers authoritative for that domain. It will output the name serves which are
associated with the given domain.

nslookup -type=a google.com 

Lookup for an a record We can also view all the available DNS records for a
particular record using -type=a option.

Swapnil Tiwari
1713310233
nslookup -type=mx google.com :

Lookup for an mx record MX (Mail Exchange) record maps a domain name to a list
of mail exchange servers for that domain. The MX record tells that all the mails sent
to “google.com” should be routed to the Mail server in that domain.

nslookup -type=txt google.com :

Lookup for an txt record TXT records are useful for multiple types of records like
DKIM, SPF, etc. You can find all TXT records configured for any domain using
below command.

Swapnil Tiwari
1713310233
Telnet commands

Swapnil Tiwari
1713310233
Host Specifies the hostname or IP address of the remote computer.

Port Specifies the port number or service name.

telnet [host [port]]


Commands available through the actual telnet program:
Close Close current connection.

display Display operating parameters.

Open Connect to a site.

Quit Exit telnet.

Set Set options (type 'set ?' for a list).

status Print status information.

?/help Print help information.

telnet myhost.com : Telnet to the computer myhost.com

Swapnil Tiwari
1713310233
EXPERIMENT 6

//WAP in java to find the IP address of local host

import java.net.*;

public class MyAddress {

public static void main(String[] args) {

try {
InetAddress me = InetAddress.getLocalHost();
String dottedQuad = me.getHostAddress();
System.out.println("My address is " + dottedQuad);
}
catch (UnknownHostException ex) {
System.out.println("I'm sorry. I don't know my own address.");
}

Swapnil Tiwari
1713310233
Experiment 7

Objective: To find the IP address of the any site if name is given.


import java.net.*;

public class OReillyByName {

public static void main (String[] args) {

try {

InetAddress address = InetAddress.getByName("www.oreilly.com");

System.out.println(address);

catch (UnknownHostException ex) {

System.out.println("Could not find www.oreilly.com");

Swapnil Tiwari
1713310233
}

EXPERIMENT 8

Obejctive To trace the ports of a particular host in Java

import java.net.*;

import java.io.*;

public class ports

{ public static void main ( String[] args ) throws IOException

{ String hostname;

BufferedReader input = new BufferedReader ( new InputStreamReader(System.in) );

Socket s = null;

System.out.print("\n");

System.out.print("Host name: ");

hostname = input.readLine();

Swapnil Tiwari
1713310233
try

{ // this is to see if host exists:

InetAddress ipaddress = InetAddress.getByName(hostname);

//int p = 21;

// ftp

//int p = 23;

// telnet

//int p = 25;

// smtp

int p = 80;

// http

//int p = 110;

// pop3

try{ s = new Socket(hostname, p);

System.out.println("A server is running on port " + p + ".");

s.close();

catch (IOException e)

System.out.println("No server on port " + p + ".");

catch ( UnknownHostException e )

System.out.println("Could not find host: " + hostname);

} if (s != null)

{ try

Swapnil Tiwari
1713310233
{
s.close();

catch ( IOException ioEx )

{
printf(“Exception”,e);
}
}
}
}

Swapnil Tiwari
1713310233
EXPERIMENT 9

Objective: To list all the networking Interfaces in Java

import java.net.*;
import java.util.*;

public class InterfaceLister {

public static void main(String[] args) throws Exception {

Enumeration interfaces = NetworkInterface.getNetworkInterfaces();


while (interfaces.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) interfaces.nextElement();
System.out.println(ni);
}
}}

Swapnil Tiwari
1713310233
EXPERIMENT 10

Objective: To implement the Echo Server.

import java.net.*;
import java.io.*;

public class EchoServer


{
public static void main(String[] args) throws IOException
{
ServerSocket serverSocket = null;

try {
serverSocket = new ServerSocket(10007);
}
catch (IOException e)
{
System.err.println("Could not listen on port: 10007.");
System.exit(1);
}
Swapnil Tiwari
1713310233
Socket clientSocket = null;
System.out.println ("Waiting for connection.....");

try {
clientSocket = serverSocket.accept();
}
catch (IOException e)
{
System.err.println("Accept failed.");
System.exit(1);
}

System.out.println ("Connection successful");


System.out.println ("Waiting for input.....");

PrintWriter out = new PrintWriter(clientSocket.getOutputStream(),


true);
BufferedReader in = new BufferedReader(
new InputStreamReader( clientSocket.getInputStream()));

String inputLine;

while ((inputLine = in.readLine()) != null)


{
System.out.println ("Server: " + inputLine);
out.println(inputLine);

if (inputLine.equals("Bye."))
break;
}

out.close();
in.close();
clientSocket.close();
serverSocket.close();
}
}

Swapnil Tiwari
1713310233
EXPERIMENT 11

Objective: To Implement Echo Client

import java.io.*;
import java.net.*;

public class EchoClient {


public static void main(String[] args) throws IOException {

String serverHostname = new String ("127.0.0.1");

if (args.length > 0)
serverHostname = args[0];
System.out.println ("Attemping to connect to host " +
serverHostname + " on port 10007.");

Socket echoSocket = null;


PrintWriter out = null;
BufferedReader in = null;

Swapnil Tiwari
1713310233
try {
// echoSocket = new Socket("taranis", 7);
echoSocket = new Socket(serverHostname, 10007);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: " + serverHostname);
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to: " + serverHostname);
System.exit(1);
}

BufferedReader stdIn = new BufferedReader(


new InputStreamReader(System.in));
String userInput;
System.out.print ("input: ");
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
System.out.print ("input: ");
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}

Swapnil Tiwari
1713310233
EXPERIMENT 12

Swapnil Tiwari
1713310233
Objective : Introduction to Network Devices (Repeater, Hub, Bridge, Switch,
Router, Gateways, NIC etc.

Repeater – A repeater operates at the physical layer. Its job is to regenerate the
signal over the same network before the signal becomes too weak or corrupted so
as to extend the length to which the signal can be transmitted over the same
network. An important point to be noted about repeaters is that they do not
amplify the signal. When the signal becomes weak, they copy the signal bit by bit
and regenerate it at the original strength. It is a 2 port device.

Hub –  A hub is basically a multiport repeater. A hub connects multiple wires


coming from different branches, for example, the connector in star topology
which connects different stations. Hubs cannot filter data, so data packets are sent
to all connected devices.  In other words, collision domain of all hosts connected
through Hub remains one.  Also, they do not have intelligence to find out best
path for data packets which leads to inefficiencies and wastage.

Types of Hub

Active Hub:- These are the hubs which have their own power supply and
can clean, boost and relay the signal along with the network. It serves both
as a repeater as well as wiring centre. These are used to extend the
maximum distance between nodes.
Passive Hub :- These are the hubs which collect wiring from nodes and
power supply from active hub. These hubs relay signals onto the network
without cleaning and boosting them and can’t be used to extend the
distance between nodes.

Bridge – A bridge operates at data link layer. A bridge is a repeater, with add on
the functionality of filtering content by reading the MAC addresses of source and
destination. It is also used for interconnecting two LANs working on the same
protocol. It has a single input and single output port, thus making it a 2 port
device.

Types of Bridges

Transparent Bridges:- These are the bridge in which the stations are


completely unaware of the bridge’s existence i.e. whether or not a bridge is
added or deleted from the

network, reconfiguration of the stations is unnecessary. These bridges


make use of two processes i.e. bridge forwarding and bridge learning.

Source Routing Bridges:- In these bridges, routing operation is


performed by source station and the frame specifies which route to follow.
The hot can discover frame by sending a special frame called discovery
frame, which spreads through the entire network using all possible paths to
destination.

Swapnil Tiwari
1713310233
Switch – A switch is a multiport bridge with a buffer and a design that can boost
its efficiency(a large number of ports imply less traffic) and performance. A
switch is a data link layer device. The switch can perform error checking before
forwarding data, that makes it very efficient as it does not forward packets that
have errors and forward good packets selectively to correct port only.  In other
words, switch divides collision domain of hosts, but broadcast domain remains
same.
 
Routers – A router is a device like a switch that routes data packets based on their
IP addresses. Router is mainly a Network Layer device. Routers normally connect
LANs and WANs together and have a dynamically updating routing table based
on which they make decisions on routing the data packets. Router divide
broadcast domains of hosts connected through it.

Gateway – A gateway, as the name suggests, is a passage to connect two


networks together that may work upon different networking models. They
basically work as the messenger agents that take data from one system, interpret
it, and transfer it to another system. Gateways are also called protocol converters
and can operate at any network layer. Gateways are generally more complex than
switch or router.

A network interface card (NIC) is a hardware component without which


a computer cannot be connected over a network. It is a circuit board installed in
a computer that provides a dedicated network connection to the computer. It is
also called network interface

Swapnil Tiwari
1713310233
EXPERIMENT 13

Objective: Introduction to CISCO Packet Tracer. Design Bus, Star, Mesh, Ring
Topology and check the connectivity using ping command.

CISCO PACKET TRACER

Packet Tracer is a cross-platform visual simulation tool designed by Cisco Systems that


allows users to create network topologies and imitate modern computer networks. The
software allows users to simulate the configuration of Cisco routers and switches using a
simulated command line interface. Packet Tracer makes use of a drag and drop user
interface, allowing users to add and remove simulated network devices as they see fit.
The software is mainly focused towards Certified Cisco Network Associate Academy
students as an educational tool for helping them learn fundamental CCNA concepts.

Packet Tracer can be run on Linux and Microsoft Windows.


Similar Android and iOS apps are also available. Packet Tracer allows users to create
simulated network topologies by dragging and dropping routers, switches and various
other types of network devices. A physical connection between devices is represented by
a "cable" item. Packet Tracer supports an array of simulated Application Layer protocols,
as well as basic routing with RIP, OSPF, EIGRP, BGP, to the extents required by the
current CCNA curriculum. As of version 5.3, Packet Tracer also supports the Border
Gateway Protocol.
In addition to simulating certain aspects of computer networks, Packet Tracer can also be
used for collaboration. As of Packet Tracer 5.0, Packet Tracer supports a multi-user
system that enables multiple users to connect multiple topologies together over
a computer network. Packet Tracer also allows instructors to create activities that students
have to complete. Packet Tracer is often used in educational settings as a learning
aid. Cisco Systems claims that Packet Tracer is useful for network experimentation.
Packet Tracer allows students to design complex and large networks, which is often not
feasible with physical hardware, due to costs. Packet Tracer is commonly used by CCNA
Academy students, since it is available to them for free. However, due to functional
limitations, it is intended by CISCO to be used only as a learning aid, not a replacement
for Cisco routers and switches. The application itself only has a small number of features
found within the actual hardware running a current Cisco IOS version. Thus, Packet
Tracer is unsuitable for modelling production networks. It has a limited command set,
meaning it is not possible to practice all of the IOS commands that might be required.
Packet Tracer can be useful for understanding abstract networking concepts, such as
the Enhanced Interior Gateway Routing Protocol by animating these elements in a visual
form. Packet Tracer is also useful in education by providing additional components,
including an authoring system, network protocol simulation and improving knowledge an
assessment system.

Design of different Topologies and check their connectivity using ping command.

Swapnil Tiwari
1713310233
1. Bus Topology-A bus topology is a topology for a Local Area Network (LAN) in which
all the nodes are connected to a single cable. The cable to which the nodes connect is
called a "backbone". If the backbone is broken, the entire segment fails.

2. Mesh Topology- Mesh topology is a type of networking where all nodes cooperate to
distribute data amongst each other.

3. Ring Topology- A ring network is a network topology in which each node connects to
exactly two other nodes, forming a single continuous pathway for signals through each
node - a ring. Data travels from node to node, with each node along the way handling
every packet.

4. Star Topology-A star topology is a topology for a Local AreaNetwork (LAN) in which


all nodes are individually connected to a central connection point, like a hub or a switch.
A star takes more cable than e.g. a bus, but the benefit is that if a cable fails, only one
node will be brought down.

Swapnil Tiwari
1713310233
EXPERIMENT 14

Objective:- Switch Configuration on CISCO packet tracer using CLI.

1. Enable Switch

switch> enable

2. show running-config

Swapnil Tiwari
1713310233
Swapnil Tiwari
1713310233
3. show version

Swapnil Tiwari
1713310233
4.dirflash

5.For configuring terminal:

Swapnil Tiwari
1713310233
6. show interface

Swapnil Tiwari
1713310233
Swapnil Tiwari
1713310233
Swapnil Tiwari
1713310233
7. show vlan

Swapnil Tiwari
1713310233
8. configure terminal

9. configure

10. interface fa0/1

Swapnil Tiwari
1713310233
11. show vlan

12. show-mac-address-table

Swapnil Tiwari
1713310233

You might also like