0% found this document useful (0 votes)
19 views134 pages

Ilovepdf Merged

Uploaded by

Gaurav Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views134 pages

Ilovepdf Merged

Uploaded by

Gaurav Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 134

MAHARAJA SURAJMAL INSTITUTE OF

TECHNOLOGY

ADVANCED COMPUTER NETWORKS


(ETIT-453)

PRACTICAL FILE

Submitted To: Submitted By:


Ms. Priyanka Kalkandha Name: KANISHK KUMAR
(Assistant Professor) Enrollment No.: 04115003120
Branch: IT-1 (7th Semester)
TABLE OF CONTENTS

Sr. No. Experiment Page No. Remark

1 Study of Cisco Packet Tracer 1

2 To configure basic CISCO router. 9

3 Configuration of IP addressing for a 14


given scenario for a given set of
topologies (Bus and Star).

4 Configuration of DHCP Server. 22

5 To implement and configure 25


ARP/RARP protocol and static
routes.

6 To implement and configure RIP, 36


OSPF and BGP routing protocols.

7 To configure FTP on packet tracer. 51

8 Implementation of Port Scanner. 58

9 Implementation of file transfer 59


using TCP.
10 Implementation of file transfer 61
using UDP.
Experiment – 1

AIM: Study of Cisco Packet Tracer

Introduction
Cisco Packet Tracer is an innovative network simulation and visualization tool. This free
software helps you to practice your network configuration and troubleshooting skills via your
desktop computer or an Android or iOS based mobile device. Packet Tracer is available for
both the Linux and Windows desktop environments.
With Packet Tracer you can choose to build a network from scratch, use a pre-built sample
network, or complete classroom lab assignments. Packet Tracer allows you to easily explore
how data traverses your network. Packet Tracer provides an easy way to design and build
networks of varying sizes without expensive lab equipment.
Packet Tracer User Interface
When you open Packet Tracer, by default you will be presented with the following interface:

Fig 1.1 Packet Tracer User Interface

1|Page
This initial interface contains ten components which are as follows:

This bar provides the File, Edit, Options, View, Tools,


Extensions, and Help menus. You will find basic
1 Menu Bar commands such as Open, Save, Save as Pkz, Print, and
Preferences in these menus. You will also be able to
access the Activity Wizard from the Extensions menu.

This bar provides shortcut icons to the File and Edit menu
commands. This bar also provides buttons for Copy,
Paste, Undo, Redo, Zoom, the Drawing Palette, and the
2 Main Tool Bar Custom Devices Dialog. On the right, you will also find
the Network Information button, which you can use to
enter a description for the current network (or any text
you wish to include).

This bar provides access to these commonly used


workspace tools: Select, Move Layout, Place Note,
3 Common Tools Bar Delete, Inspect, Resize Shape, Add Simple PDU, and
Add Complex PDU. See “Workspace Basics” for more
information.

You can toggle between the Physical Workspace and the


Logical Workspace with the tabs on this bar. In Logical
Workspace, this bar also allows you to go back to a
previous level in a cluster, create a New Cluster, Move
Logical/Physical
Object, Set Tiled Background, and Viewport. In
4 Workspace and
Physical Workspace, this bar allows you to navigate
Navigation Bar
through physical locations, create a New City, create a
New Building, create a New Closet, Move Object, apply
a Grid to the background, Set Background, and go to the
Working Closet.

This area is where you will create your network, watch


5 Workspace simulations, and view many kinds of information and
statistics.

You can toggle between Realtime Mode and Simulation


Mode with the tabs on this bar. This bar also provides
buttons to Power Cycle Devices and Fast Forward Time
Realtime/Simulation
6 as well as the Play Control buttons and the Event List
Bar
toggle button in Simulation Mode. Also, it contains a
clock that displays the relative Time in Realtime Mode
and Simulation Mode.

2|Page
This box is where you choose devices and connections to
Network
7 put into the workspace. It contains the Device-Type
Component Box
Selection Box and the Device-Specific Selection Box.

This box contains the type of devices and connections


Device-Type available in Packet Tracer. The Device-Specific Selection
8
Selection Box Box will change depending on which type of device you
choose.

This box is where you choose specifically which devices


Device-Specific
9 you want to put in your network and which connections to
Selection Box
make.

This window manages the packets you put in the network


User Created Packet
10 during simulation scenarios. See the “Simulation Mode”
Window
section for more details.

Workspaces and Modes


Packet Tracer has two workspaces (Logical and Physical) and two modes (Realtime and
Simulation). Upon start-up, you are in the Logical Workspace in Realtime Mode. You can build
your network and see it run in real time in this configuration. You can switch to Simulation
Mode to run controlled networking scenarios. You can also switch to the Physical Workspace
to arrange the physical aspects (such as the location) of your devices. Note that you view a
simulation while you are in the Physical Workspace. You should return to the Logical
Workspace after you are done in the Physical Workspace.
Cisco devices and packet tracer devices
ROUTERS
A router provides connectivity between two logical networks. Every router in Packet Tracer
can be switched on or off by using the provided power button.
The following routers are available in Packet Tracer:
Cisco 1841: This is an Integrated Service Router (ISR) having two Fast Ethernet ports, two
slots for High Speed WAN Interface Cards (HWICs), and one slot ,for Advanced
Integration Module (AIM)
Cisco 1941: This is similar to the previous model but runs on Cisco IOS Version 15. It has two
ports that operate at Gigabit Ethernet speeds.
Cisco 2620XM: This is a multiservice router with one Fast Ethernet port, two slots for WAN
Interface cards, and one slot for AIM.
Cisco 2621XM: This is similar to the previous model, except that this router has two Fast
Ethernet ports.

3|Page
Cisco 2811: This ISR comes with two Fast Ethernet ports, four WIC slots, and a dual slot for
AIM.
Cisco 2901: This router has two Gigabit Ethernet ports, four WIC slots, and two Digital Signal
Processor (DSP) slots. This router uses Cisco IOS Version 15.
Cisco 2911: This router has three Gigabit Ethernet ports and all the other features of the
previous router. It runs on IOS Version 15.
Generic Router-PT: This is a custom router running on Cisco IOS. It contains 10 slots and
has separate modules with a naming convention beginning with PT.
SWITCHES
A switch, also called a multiport bridge, connects more than two end devices together. Each
switch port is a collision domain.
The following switches are available in Packet Tracer:
Cisco 2950-24: This managed switch comes with 24 Fast Ethernet ports.
Cisco 2950T-24: This switch is a member of the Catalyst 2590 Intelligent Switch family and
has two Gigabit Ethernet ports in addition to the 24 Fast Ethernet ports.
Cisco 2960-24TT: This is another 24-port switch; the previous switch has Gigabit Interface
Converter (GBIC) for Gigabit Ethernet ports, whereas this switch has Small Form-factor
Pluggable (SFP) modules for the same.
Cisco 3560-24PS: This switch is different from the others because it is a layer 3 switch that
can be used to perform routing in addition to switching. The PS suffix implies support for
Power over Ethernet (PoE), which can be used to power up IP phones without using power
adapters.
Bridge PT: This is a device used to segment a NETWORK and it has only two ports (which
is why it is a bridge; if it had more, it'd be called a switch).
Generic Switch PT: This is a Packet-Tracer-designed switch running on Cisco IOS. This is
only customizable switch with 10 slots and several modules.
CONNECTORS

Connection type Connects these devices Picture

automatic connect all except console

4|Page
straight through PC, Server, Laptop, or
Printer to Switch
PC, Server, Laptop, or
Printer to Hub
PC, Server, Laptop, or
Printer to Modem
PC, Server, Laptop, or
Printer to Cloud
Router to Switch
Router to Hub
Router to Modem
Router to cloud
Crossover PC, Server, Laptop, or
printer to PC
PC, Server, Laptop, or
printer to Server PC, Server,
Laptop, or printer to Laptop
PC, Server, Laptop, or
printer to Printer
Switch to Hub
Switch to Switch
Hub to Hub
Router w/o Serial to Router
PC to PC
Fiber All with fiber ports

Phone Cloud to DSL Modem


VoIP to Analog Phone
Analog Phone to Analog
Phone

5|Page
Coaxial Cloud to Cable Modem
Cable Modem to Co-Ax
Splitter (hub)
Co-Ax Splitter to TV
Cable Modem to TV
Cloud to TV
TV to TV
Serial DCE Router to Router Cloud to
Router

Serial DTE Router to Router Cloud to


Router

Console PC/Laptop/Generic to
Router/Switch

Setting a User Profile


You can set your user profile for activity assessment and Multiuser identification. From the
Menu Bar, select Options > User Profile to view the User Profile dialog. In the User Profile
dialog, you can enter your Name, E-Mail, and any Additional Info about yourself that you
may want to share.

6|Page
Fig 1.2 Packet Tracer User Profile
Algorithm Settings
The Algorithms Settings dialog allows the user to make configurations that are otherwise
not available in IOS. It also allows tweaking of algorithm settings to make visualization of
certain algorithm/protocol behaviours more easily viewable.
CBAC Half-Open Session Multiplier: If the number of half-open CBAC sessions multiplied
by this number exceeds the configured max half-open session count, new sessions would not
be opened.
TCP Maximum Number of Connections: If the number of connections in SYN-RECEIVED
state exceeds this number, any new connections would be rejected.
TCP Maximum Number of Opened Sessions: If the number of connections exceeds this
number, any new connections would be rejected.
TCP Maximum Retransmission Timeout in Milliseconds: If a TCP connection does not
receive an acknowledgement to a segment it transmitted in this number, it would retransmit
the segment.
Switching Storm Control Multiplier: If the bandwidth percentage of broadcast frames used
multiplied by this number exceeds the configured threshold, the broadcast frame would be
dropped.

7|Page
Fig 1.3 Packet Tracer Algorithm Settings
Saving a PKZ
Packet Tracer allows you to save your topology (PKT) as well as any custom device icons
and backgrounds that you applied to on the Logical Workspace and Physical Workspace to a
save file called a PKZ. A PKZ is able to retain any external files you add in a single save file,
which allows for portability and compactness from computer to computer. To create a PKZ,
go to File > Save as Pkz. Enter a file name for the PKZ and click on Save. In the Pkz Select
Files dialog, you will be able to add and remove files that you want to save along with PKT.
To add a file, click on the Add button and browse to the file you want to add then click
Open. To remove a file, select the file from the list then click Remove. Once you are done
adding and removing files, click OK to create the PKZ file.

Fig 1.4 Saving the .pkz file

8|Page
Experiment – 2

AIM: To configure basic CISCO router.


Cisco router is a device that switches data packets between two different networks. By default
two different IP network cannot communicate with each other. They need a mediator device
that exchanges their packets. Routers do this job successfully by taking packet from one
network and delivering it to another network. This process is called routing.

We need to perform some initial configurations on router before it can be used for routing.

Cisco IOS supports various command modes, among those followings are the main command
modes.
 User EXEC Mode
 Privileged EXEC Mode
 Global Configuration Mode
 Interface Configuration Mode
 Setup Mode

You need to execute specific commands to navigate from one mode to another.

Mode of Operation Usage How to Enter the Prompt


Mode
User EXEC Change terminal First level accessed. Router>
settings on a
temporary basis,
perform basic tests,
and list system
information.
Privileged EXEC System From user EXEC Router#
administration, set mode, enter enable
operating password command
parameters.

9|Page
Global Config Modify From privileged Router(config)#
configuration that EXEC, enter
affect the system as configure terminal.
a whole.
Interface Config Modify the From global mode, Router(config-if)#
operation of an enter interface type
interface. number.
Setup Create the initial From privileged . Prompted dialog
configuration. EXEC mode, enter
command setup.

Standard order of accessing mode is:

User Exec mode => Privileged Exec mode => Global Configuration mode => Interface
Configuration mode => Sub Interface Configuration mode
Router will enter in setup mode only if it fails to load a valid running configuration.

1.1 Steps to configure basic router:

Step 1. Create a topology in packet tracer workspace.

Fig.2.1 Topology in work space

10 | P a g e
Step 2. Click on the router and access CLI prompt of the router.

Fig.2.2 Accessing CLI prompt

Step 3. Enter the following commands to configure, change hostname and secure the router
with a password.

configure terminal : Enters global configuration mode, when using the console port.

Router> enable
Router# configure terminal
Router(config)#

hostname name : change hostname of the router.

Router(config)# hostname Router


Router(config)#

password : Secure console port with a password.

Router(config)# line console 0


Router(config-line) #password xxx
Router(config-line) #login

Commands with their description:

Command Description

Router(config)#line console 0 Move in console line mode


Router(config-line)#password xxx Set console line password to xxx
Router(config-line)#login Enable password authentication for console
line

11 | P a g e
Step 4. Return to the console mode by using the exit command.

exit: Return to console mode

Router(config-line) #exit
Router(config) #exit
Router #exit

OUTPUT :

Fig.2.3 Router Configured

After executing the above commands. Now your router (Lab1) is secured with a password.

12 | P a g e
Fig.2.4 Router Secured

13 | P a g e
Experiment – 3

AIM: Configuration of IP addressing for a given scenario for a given


set of topologies (Bus and Star).

Bus Topology:
Bus topology uses one main cable to which all nodes are directly connected. The main cable
acts as a backbone for the network. One of the computers in a network typically acts s the
computer server.
Advantage of bus topology is that it is easy to connect a computer or peripheral device. The
second advantage is that the cable requirements are relatively small, resulting in lower cost.
This type of topology is not suitable for large networks.
Steps as follows:
Step 1: Launch the packet tracer
Step 2: Build the Topology
 First select three switches, three clients and connect them by FastEthernet wires.

Fig 3.1 Bus Topology

Step 3: Configure the End Devices:


 Configure the clients by providing their IP Address and subnet mask.
Configure PC0
Click on PC0. Then configure it as follows:
h. Click on the Desktop tab.
i. Click on the IP Configuration Icon.
14 | P a g e
j. Then click on the IP Address dialog box.
k. Type in 192.168.1.1 as the IP address and press enter.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.

Fig 3.2 IP Configuration of PC0

Configure PC1
Click on PC1. Then configure it as follows:
h. Click on the Desktop tab.
i. Click on the IP Configuration Icon.
j. Click on the IP Address dialog box.
k. Type in 192.168.1.2 as the IP address and press enter.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.
m. Type in 192.168.1.1 as the default gateway address.

15 | P a g e
Fig 3.3 IP Configuration of PC1

Configure PC2
Click on PC2. Then configure it as follows:
h. Click on the Desktop tab.
i. Click on the IP Configuration Icon.
j. Click on the IP Address dialog box.
k. Type in 192.168.1.3 as the IP address and press enter.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.
m. Type in 192.168.1.1 as the default gateway address.

16 | P a g e
Fig 3.4 IP Configuration of PC2

Step 4: Check the configuration of the topology:


b. In Realtime mode, add a simple PDU from PC0 to PC2 and check the status at the
bottom right corner of packet tracer.
c. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

17 | P a g e
Fig 3.5 Message Transferred in Realtime Mode

Star Topology:
In star topology, each computer is connected to a central hub using a point-to-point connection.
The central hub can be a server that manages the network, or it can be a much simpler device
that only makes the connections between computers over the network possible.
Advantage of star topology is that it is easy to add new nodes to the network.
Steps as follows:
Step 1: Launch the packet tracer
Step 2: Build the Topology
 First select a switch, 4 clients and connect them by FastEthernet wires.

18 | P a g e
Fig 3.6 Star Topology

Step 3: Configure the End Devices:


 Configure the clients by providing their IP Address and subnet mask.
Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.1 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

19 | P a g e
Fig 3.7 IP Configuration of PC0

Configure PC1
Click on PC1. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

Configure PC2
Click on PC2. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

Configure PC3

20 | P a g e
Click on PC3. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.4 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

Step 4: Check the configuration of the topology:


a. In Realtime mode, add a simple PDU from PC0 to PC2 and check the status at the
bottom right corner of packet tracer.
b. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 3.8 Message Transferred in Realtime Mode

21 | P a g e
Experiment – 4

AIM: Configuration of DHCP Server.


The Bootstrap Protocol (BOOTP) is a client/server protocol and it provides the following:

• IP address

• net mask

• the address of a default router

• the address of a name server.

The Dynamic Host Configuration Protocol (DHCP) provides all the above functionalities of
BOOTP alongwith static and dynamic address allocation that can be manual or automatic.

Steps involved in configuration:

1. Select one router, switch and number of clients for connection setup. And connect them
through fast Ethernet wire with each other.

22 | P a g e
2. Check the properties of each client by going in there config window after selecting DHCP
other than STATIC. It will return unable to connect. Because router is not set up.

3. For setting up a router, go to command window and right commands as follows.

Fig.4.2 Commands executed

R1#config t
R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastethernet 1/0
R1(config-if)#ip address 192.168.1.0 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)#ip dhcp pool


R1(dhcp-config)#network 192.168.1.0 255.255.255.0
R1(dhcp-config)#dns-server 192.168.1.2

23 | P a g e
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#exit

4. Now, Click on any of the PC > Desktop > IP configuration > Choose DHCP.

Now PC will get an IP from DHCP server.

Fig.4.3 Configuring DHCP server

24 | P a g e
Experiment – 5

AIM: To implement and configure ARP/RARP protocol and static


routes.

Address Resolution Protocol (ARP):


Address Resolution Protocol is a communication protocol used for discovering physicaladdress
associated with given network address. Typically, ARP is a network layer to data link layer
mapping process, which is used to discover MAC address for given Internet Protocol Address.
In order to send the data to destination, having IP address is necessary but not sufficient; we
also need the physical address of the destination machine. ARP is used to get the physical
address (MAC address) of destination machine.
Reverse Address Resolution Protocol (RARP):
Reverse ARP is a networking protocol used by a client machine in a local area network to
request its Internet Protocol address (IPv4) from the gateway-router’s ARP table. The network
administrator creates a table in gateway-router, which is used to map the MAC address to
corresponding IP address.

When a new machine is setup or any machine which don’t have memory to store IP address,
needs an IP address for its own use. So, the machine sends a RARP broadcast packet which
contains its own MAC address in both sender and receiver hardware address field.

Steps as follows for ARP:


Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

25 | P a g e
Fig 5.1 Network Topology (ARP)
Step 3: Configure the End Devices:
Configure PC5
Click on PC5. Then configure it as follows:
m. Click on the Desktop tab.
n. Click on the IP Configuration Icon.
o. Click on the IP Address dialog box.
p. Type in 192.168.1.1 as the IP address and press enter.
q. A default value of 255.255.255.0 should appear in the Subnet Mask.
Configure PC1
Click on PC1. Then configure it as follows:
n. Click on the Desktop tab.
o. Click on the IP Configuration Icon.
p. Click on the IP Address dialog box.
q. Type in 192.168.1.2 as the IP address and press enter.
r. A default value of 255.255.255.0 should appear in the Subnet Mask.

Configure PC2
Click on PC2. Then configure it as follows:
n. Click on the Desktop tab.
o. Click on the IP Configuration Icon.
p. Click on the IP Address dialog box.

26 | P a g e
q. Type in 192.168.1.3 as the IP address and press enter.
r. A default value of 255.255.255.0 should appear in the Subnet Mask.
Step 4: ARP configuration:
Click on PC5. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the Command Prompt.
c. Type the following command in the prompt: ping 192.168.1.3 and press enter.
d. If everything is done correctly, then one should see the following output:

Fig 5.2 PC5 Command Prompt

Click on PC5. Then configure it as follows:


a. Click on the Desktop tab.
b. Click on the Command Prompt.
c. Type the following command in the prompt: arp -a and press enter.
d. If everything is done correctly, then one should see the following output:

27 | P a g e
Fig 5.3 PC2 Command Prompt

e. On typing the arp -a command, we get the IP Address and MAC Address of
PC5.
Step 5: To check whether the PC5 has received back the message, go to Command Prompt of
PC0 and type the command arp -a.

Fig 5.4 arp-a command executed

28 | P a g e
Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
PC5 N/A 192.168.1.1 255.255.255.0 0.0.0.0
PC1 N/A 192.168.1.2 255.255.255.0 0.0.0.0
PC2 N/A 192.168.1.3 255.255.255.0 0.0.0.0

Step 6: Check the configuration of the topology:


e. In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.
f. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 5.5 Simulation mode

Static Routing:
Static routing is a form of routing that occurs when a router uses a manually-configured routing
entry, rather than information from a dynamic routing traffic. In many cases, static routes are
manually configured by a network administrator by adding in entries into a routing table,
though this may not always be the case.
Unlike dynamic routing, static routes are fixed and do not change if the network is changed or
reconfigured. Static routing and dynamic routing are not mutually exclusive. Both dynamic
routing and static routing are usually used on a router to maximise routing efficiency and to
provide backups in the event that dynamic routing information fails to be exchanged. Static
routing can also be used in stub networks, or to provide a gateway of last resort.

29 | P a g e
Steps are as follows for static routing:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

Fig 5.6 Network Topology (Static)

Step 3: Configure the End Devices:


Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.

Configure PC1
Click on PC1. Then configure it as follows:
a. Click on the Desktop tab.

30 | P a g e
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.1.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.
Configure PC2
Click on PC2. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.2.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.2.1 as the default gateway address.
Configure PC3
Click on PC3. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.2.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.2.1 as the default gateway address.

Configure PC4
Click on PC4. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.3.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.3.1 as the default gateway address.

31 | P a g e
Configure PC5
Click on PC5. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.3.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.3.1 as the default gateway address.

Step 4: Configure the Network Devices:


Configure Router0
Click on Router0. Then configure it as follows:
j. Click on config tab and then click on the FastEthernet 0/0.
k. Type in 192.168.1.1 as the IP address.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.
m. Tick the Port Status as On.
n. Click on config tab and then click on the FastEthernet 1/0.
o. Type in 192.168.2.1 as the IP address.
p. A default value of 255.255.255.0 should appear in the Subnet Mask.
q. Tick the Port Status as On.
r. Click on the Serial 2/0.
s. Type in 10.10.0.2 as the IP address.
t. A default value of 255.0.0.0 should appear in the Subnet Mask.
u. Tick the Port Status as On.
v. Set the clock rate to 64000ms.
w. Save these settings.
Configure Router1
Click on Router1. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.3.1 as the IP address.

32 | P a g e
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 10.10.0.3 as the IP address.
g. A default value of 255.0.0.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate to 64000ms.
j. Save these settings.
Step 5: Static routing configuration:
Click on the Router0. Then configure it as follows:
a. Click the config tab and then Static tab.
b. Add network address 192.168.3.0
c. Add mask as 255.255.255.0
d. Add next hop as 10.10.0.3
e. Click the add button.
f. Then click the settings tab and then click the save button.
g. The equivalent IOS commands of the above steps are as follows:
Router(config-if)#exit
Router(config)#
Router(config)#ip route 192.168.3.0 255.255.255.0 10.10.0.3
Router(config)#
Click on the Router1. Then configure it as follows:
a. Click the config tab and then Static tab.
b. Add network address 192.168.1.0
c. Add mask as 255.255.255.0
d. Add next hop as 10.10.0.2
e. Click the add button.
f. add network address 192.168.2.0
g. Add mask as 255.255.255.0
h. Add next hop as 10.10.0.2

33 | P a g e
i. Click the add button.
j. Then click the settings tab and then click the save button.
k. The equivalent IOS commands of the above steps are as follows:
Router(config-if)#exit
Router(config)#
Router(config)#ip route 192.168.1.0 255.255.255.0 10.10.0.2
Router(config)#ip route 192.168.2.0 255.255.255.0 10.10.0.2
Router(config)#
Step 6: Check the configuration of the topology:
 In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC4 and
check the status at the bottom right corner of packet tracer.

 If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 5.7 Realtime mode

34 | P a g e
Fig 5.8 Simulation mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Fa1/0 192.168.2.1 255.255.255.0 N/A
Router0 Se2/0 10.10.0.2 255.0.0.0 N/A
Router1 Fa0/0 192.168.3.1 255.255.255.0 N/A
Router1 Se2/0 10.10.0.3 255.0.0.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.1.3 255.255.255.0 192.168.1.1
PC2 N/A 192.168.2.2 255.255.255.0 192.168.2.1
PC3 N/A 192.168.2.3 255.255.255.0 192.168.2.1
PC4 N/A 192.168.3.2 255.255.255.0 192.168.3.1
PC5 N/A 192.168.3.3 255.255.255.0 192.168.3.1

35 | P a g e
Experiment – 6

AIM: To implement and configure RIP, OSPF and BGP routing


protocols.

Routing Information Protocol (RIP):


RIP is a dynamic routing protocol which uses hop count as a routing metric to find the best
path between the source and the destination network. It is a distance vector routing protocol
which has AD value 120 and works on the application layer of OSI model. RIP uses port
number 520.
Steps are as follows for RIP:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

Fig 6.1 Network Topology (RIP)


Step 3: Configure the End Devices:
Configure PC0
Click on PC0. Then configure it as follows:
r. Click on the Desktop tab.
s. Click on the IP Configuration Icon.

36 | P a g e
t. Click on the IP Address dialog box.
u. Type in 192.168.1.2 as the IP address and press enter.
v. A default value of 255.255.255.0 should appear in the Subnet Mask.
w. Type in 192.168.1.1 as the default gateway address.

Configure PC1
Click on PC1. Then configure it as follows:
s. Click on the Desktop tab.
t. Click on the IP Configuration Icon.
u. Click on the IP Address dialog box.
v. Type in 192.168.2.2 as the IP address and press enter.
w. A default value of 255.255.255.0 should appear in the Subnet Mask.
x. Type in 192.168.2.1 as the default gateway address.
Step 4: Configure the Network Devices:
Configure Router0
Click on Router0. Then configure it as follows:
x. Click on config tab and then click on the FastEthernet 0/0.
y. Type in 192.168.1.1 as the IP address.
z. A default value of 255.255.255.0 should appear in the Subnet Mask.
aa. Tick the Port Status as On.
bb. Click on the Serial 2/0.
cc. Type in 10.10.0.2 as the IP address.
dd. A default value of 255.0.0.0 should appear in the Subnet Mask.
ee. Tick the Port Status as On.
ff. Set the clock rate to 64000ms.
gg. Save these settings.
Configure Router1
Click on Router1. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.2.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.

37 | P a g e
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 10.10.0.3 as the IP address.
g. A default value of 255.0.0.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate as not set.
j. Save these settings.
Step 5: RIP routing configuration:
Click on the Router0. Then configure it as follows:
h. Click the config tab and then RIP tab.
i. Add network address 10.0.0.0
j. Add network address 192.168.1.0
k. Then go to settings and click the save button.
l. The equivalent IOS commands of the above steps are as follows:
Router>enable
Router#
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.1.0
Router(config-router)#network 10.0.0.0
Router(config-router)#exit
Click on the Router1. Then configure it as follows:
a. Click the config tab and then RIP tab.
b. Add network address 10.0.0.0
c. Add network address 192.168.2.0
d. Then go to settings and click the save button.
e. The equivalent IOS commands of the above steps are as follows:
Router>enable
Router#

38 | P a g e
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.2.0
Router(config-router)#network 10.0.0.0
Router(config-router)#exit
Step 6: Check the configuration of the topology:
g. In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.
h. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 6.2 Simulation Mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Se2/0 10.10.0.2 255.0.0.0 N/A
Router1 Fa0/0 192.168.2.1 255.255.255.0 N/A
Router1 Se2/0 10.10.0.3 255.0.0.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.2.2 255.255.255.0 192.168.2.1

39 | P a g e
Open Shortest Path First (OSPF):
OSPF is a link-state routing protocol which is used to find the best path between the source
and the destination router using its own Shortest Path First). OSPF is developed by Internet
Engineering Task Force (IETF) as one of the Interior Gateway Protocol (IGP), i.e, the protocol
which aims at moving the packet within a large autonomous system or routing domain. It is a
network layer protocol which works on the protocol number 89 and uses AD value 110. OSPF
uses multicast address 224.0.0.5 for normal communication and 224.0.0.6 for update to
designated router(DR)/Backup Designated Router (BDR).
Steps are as follows for OSPF:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

Fig 6.3 Network Topology (OSPF)


Step 3: Configure the End Devices:
Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.

40 | P a g e
c. Click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.

Configure PC1

Click on PC1. Then configure it as follows:


a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.2.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.2.1 as the default gateway address.
Step 4: Configure the Network Devices:
Configure Router0
Click on Router0. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.1.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 10.10.0.2 as the IP address.
g. A default value of 255.0.0.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate to 64000ms.
j. Click on the Serial 3/0.
k. Type in 11.10.0.2 as the IP address.
l. A default value of 255.0.0.0 should appear in the Subnet Mask.
m. Tick the Port Status as On.
n. Set the clock rate to 64000ms.
o. Save these settings.

41 | P a g e
Configure Router1
Click on Router1. Then configure it as follows:
k. Click on config tab and then click on the FastEthernet 0/0.
l. Type in 192.168.2.1 as the IP address.
m. A default value of 255.255.255.0 should appear in the Subnet Mask.
n. Tick the Port Status as On.
o. Click on the Serial 2/0.
p. Type in 10.10.0.3 as the IP address.
q. A default value of 255.0.0.0 should appear in the Subnet Mask.
r. Tick the Port Status as On.
s. Set the clock rate to 64000ms.
t. Click on the Serial 3/0.
u. Type in 12.10.0.3 as the IP address.
v. A default value of 255.0.0.0 should appear in the Subnet Mask.
w. Tick the Port Status as On.
x. Set the clock rate to 64000ms.
y. Save these settings.
Configure Router2
Click on Router1. Then configure it as follows:
a. Click on the config tab and then on the Serial 2/0.
b. Type in 11.10.0.3 as the IP address.
c. A default value of 255.0.0.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Set the clock rate to 64000ms.
f. Click on the Serial 3/0.
g. Type in 12.10.0.2 as the IP address.
h. A default value of 255.0.0.0 should appear in the Subnet Mask.
i. Tick the Port Status as On.
j. Set the clock rate to 64000ms.
k. Save these settings.

42 | P a g e
Step 5: OSPF routing configuration:
Click on the Router0. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Click on the Router1. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0
Router(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Click on the Router2. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit

43 | P a g e
 Click the config tab and then goto settings tab and click save button.
Step 6: Check the configuration of the topology:
 In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.

 If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 6.4 Realtime mode

44 | P a g e
Fig 6.5 Simulation Mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Se2/0 10.10.0.2 255.0.0.0 N/A
Router0 Se3/0 11.10.0.2 255.0.0.0 N/A
Router1 Fa0/0 192.168.2.1 255.255.255.0 N/A
Router1 Se2/0 10.10.0.3 255.0.0.0 N/A
Router1 Se3/0 12.10.0.3 255.0.0.0 N/A
Router2 Se2/0 11.10.0.3 255.0.0.0 N/A
Router2 Se3/0 12.10.0.2 255.0.0.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.2.2 255.255.255.0 192.168.2.1

Border Gateway Protocol (BGP):


Border Gateway Protocol (BGP) is a standardized exterior gateway protocol designed to
exchange routing and reachability information among autonomous systems (AS) on the
Internet. The protocol is classified as a path vector protocol.
The Border Gateway Protocol makes routing decisions based on paths, network policies, or
rule-sets configured by a network administrator and is involved in making core routing
decisions.
Steps are as follows for BGP:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

45 | P a g e
Fig 6.6 Network Topology (BGP)
Step 3: Configure the End Devices:
Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.
Configure PC1
Click on PC1. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.3.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.3.1 as the default gateway address.
Step 4: Configure the Network Devices:
Configure Router0

46 | P a g e
Click on Router0. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.1.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 192.168.2.2 as the IP address.
g. A default value of 255.255.255.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate to 64000ms.
j. Save these settings.
Configure Router1
Click on Router1. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.3.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 192.168.2.3 as the IP address.
g. A default value of 255.255.255.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate as not set.
j. Save these settings.
Step 5: BGP routing configuration:
Click on the Router0. Then configure it as follows:

 Click the CLI Tab.


 Type the following commands:
Router(config-if)#exit
Router(config)#router bgp 100
Router(config-router)#network 192.168.1.0

47 | P a g e
Router(config-router)#network 192.168.2.0
Router(config-router)#neighbor 192.168.2.3 remote-as 200
Router(config-router)#neighbor 192.168.3.2 remote-as 200
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Click on the Router1. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router bgp 200
Router(config-router)#network 192.168.2.0
Router(config-router)#network 192.168.3.0
Router(config-router)#neighbor 192.168.2.2 remote-as 100
Router(config-router)#neighbor 192.168.1.2 remote-as 100
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Step 6: Check the configuration of the topology:
a. In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.
b. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

48 | P a g e
Fig 6.7 Realtime Mode

Fig 6.8 Simulation Mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Se2/0 192.168.2.2 255.255.255.0 N/A
Router1 Fa0/0 192.168.3.1 255.255.255.0 N/A
Router1 Se2/0 192.168.2.3 255.255.255.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.3.2 255.255.255.0 192.168.3.1

49 | P a g e
Experiment – 7

AIM: To configure FTP on packet tracer.

The file transfer protocol (FTP) is a standard network protocol used to transfer computer files
between client and server on a computer network. FIP is built on a client-server model
architecture and used separate control and data connections between the client and the server.
Steps as follows:
Step 1: Launch the packet tracer
Step 2: Build the Topology
 Select one router, two switches, two clients and one server and name that server as FTP.
 Select a module in the router, keep it in mind server must be switched OFF while
installing module, and ON it after the installation of the module.

Fig 7.1 Router0 device view

 Connect these devices with one another through wires.

50 | P a g e
Fig 7.2 Network Topology
Step 3: Configure the FTP server
Click on FTP server. Then configure it as follows:
 Select Desktop>IP configuration tab. Type the IP Address as 192.168.1.2, subnet mask
as 255.255.255.0 and default gateway as 192.168.1.1.

Fig 7.3 FTP Server IP Configuration

51 | P a g e
 Then click on the services tab and select FTP and provide username and password of
your own choice, also select all the checkboxes provided below and after that click on
ADD.

Fig 7.4 FTP Configuration

Step 4: Configure the END devices


 Click on PC0 and select Desktop>IP configuration. Type IP Address as 192.168.2.2,
Subnet mask as 255.255.255.0 and Default gateway as 192.168.2.1.

52 | P a g e
Fig 7.5 PC0 IP Configuration

 Similarly, click on PC1 and select Desktop>IP configuration. Type IP Address as


192.168.3.2, subnet mask as 255.255.255.0 and Default gateway as 192.168.3.1.

Fig 7.6 PC1 IP Configuration

Step 5: Configure the Router

 Click on the router and click on Config tab, select FastEthernet 0/0 and put the port
status “ON” and also type IP Address as 192.168.2.1 and subnet mask as 255.255.255.0.

53 | P a g e
Similarly, in case of FastEthernet 1/0 put the port status “ON” and type IP Address as
192.168.3.1 and subnet mask as 255.255.255.0. For FastEthernet 6/0 type IP Address
as 192.168.1.1.

Fig 7.7 Router0 FastEthernet Configuration

Step 6: Executing the commands


 Select the first client (PC0) and click on the command prompt tab and write the code
as shown in figure:

54 | P a g e
Fig 7.8 PC0 Command Prompt

Fig 7.9 Commands Executing

55 | P a g e
Fig 7.10 Commands Executing

Fig 7.11 File Transferred

56 | P a g e
Experiment – 8

AIM: Implementation of Port Scanner.


This program creates a simple port scanner program to check the open ports for the specified
host name.

import
java.io.IOException;
import
java.net.InetAddress;
import java.net.Socket;

public class PortScanner {


public static void main(String[] args) throws Exception {
String host = "localhost";
InetAddress inetAddress = InetAddress.getByName(host);

String hostName = inetAddress.getHostName();


for (int port = 0; port <= 65535; port++) {
try {
Socket socket = new Socket(hostName, port);
String text = hostName + " is listening on port " + port;
System.out.println(text);
socket.close();
} catch (IOException e) {
String s = hostName + " is not listening on port " + port;
System.out.println(s);
}
}
}

57 | P a g e
Experiment – 9

AIM: Implementation of file transfer using TCP.

The server module :

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Main {


public static void main(String[] args) throws IOException {
ServerSocket servsock = new ServerSocket(123456);
File myFile = new File("s.pdf");
while (true) {
Socket sock = servsock.accept();
byte[] mybytearray = new byte[(int) myFile.length()];
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(myFile));
bis.read(mybytearray, 0, mybytearray.length);
OutputStream os = sock.getOutputStream();
os.write(mybytearray, 0, mybytearray.length);
os.flush();
sock.close();
}
}
}

The client module :

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.Socket;

public class Main {


public static void main(String[] argv) throws Exception {
Socket sock = new Socket("127.0.0.1", 123456);
byte[] mybytearray = new byte[1024];
InputStream is = sock.getInputStream();

58 | P a g e
FileOutputStream fos = new FileOutputStream("s.pdf");
BufferedOutputStream bos = new BufferedOutputStream(fos);
int bytesRead = is.read(mybytearray, 0, mybytearray.length);
bos.write(mybytearray, 0, bytesRead);
bos.close();
sock.close();
}
}

59 | P a g e
Experiment – 10

AIM: Implementation of file transfer using UDP.


The client module :

import java.net.*;
import java.io.*;
public class client
{
public static void main(String args[])throws Exception
{
byte b[]=new byte[1024];
FileInputStream f=new FileInputStream("D:/raj.txt");
DatagramSocket dsoc=new DatagramSocket(2000);
int i=0;
while(f.available()!=0)
{
b[i]=(byte)f.read();
i++;
}
f.close();
dsoc.send(new DatagramPacket(b,i,InetAddress.getLocalHost(),1000));
}

The server module :

import java.net.*;
import java.io.*;
public class server
{
public static void main(String args[])throws IOException
{
byte b[]=new byte[3072];
DatagramSocket dsoc=new DatagramSocket(1000);
FileOutputStream f=new FileOutputStream("D:/nandha.txt");
while(true)
{
DatagramPacket dp=new DatagramPacket(b,b.length);

60 | P a g e
dsoc.receive(dp);
System.out.println(newString(dp.getData(),0,dp.getLength()));

}
}

61 | P a g e
MAHARAJA SURAJMAL INSTITUTE OF
TECHNOLOGY

ADVANCED COMPUTER NETWORKS


(ETIT-453)

PRACTICAL FILE

Submitted To: Submitted By:


Ms. Priyanka Kalkandha Name: KANISHK KUMAR
(Assistant Professor) Enrollment No.: 04115003120
Branch: IT-1 (7th Semester)
TABLE OF CONTENTS

Sr. No. Experiment Page No. Remark

1 Study of Cisco Packet Tracer 1

2 To configure basic CISCO router. 9

3 Configuration of IP addressing for a 14


given scenario for a given set of
topologies (Bus and Star).

4 Configuration of DHCP Server. 22

5 To implement and configure 25


ARP/RARP protocol and static
routes.

6 To implement and configure RIP, 36


OSPF and BGP routing protocols.

7 To configure FTP on packet tracer. 51

8 Implementation of Port Scanner. 58

9 Implementation of file transfer 59


using TCP.
10 Implementation of file transfer 61
using UDP.
Experiment – 1

AIM: Study of Cisco Packet Tracer

Introduction
Cisco Packet Tracer is an innovative network simulation and visualization tool. This free
software helps you to practice your network configuration and troubleshooting skills via your
desktop computer or an Android or iOS based mobile device. Packet Tracer is available for
both the Linux and Windows desktop environments.
With Packet Tracer you can choose to build a network from scratch, use a pre-built sample
network, or complete classroom lab assignments. Packet Tracer allows you to easily explore
how data traverses your network. Packet Tracer provides an easy way to design and build
networks of varying sizes without expensive lab equipment.
Packet Tracer User Interface
When you open Packet Tracer, by default you will be presented with the following interface:

Fig 1.1 Packet Tracer User Interface

1|Page
This initial interface contains ten components which are as follows:

This bar provides the File, Edit, Options, View, Tools,


Extensions, and Help menus. You will find basic
1 Menu Bar commands such as Open, Save, Save as Pkz, Print, and
Preferences in these menus. You will also be able to
access the Activity Wizard from the Extensions menu.

This bar provides shortcut icons to the File and Edit menu
commands. This bar also provides buttons for Copy,
Paste, Undo, Redo, Zoom, the Drawing Palette, and the
2 Main Tool Bar Custom Devices Dialog. On the right, you will also find
the Network Information button, which you can use to
enter a description for the current network (or any text
you wish to include).

This bar provides access to these commonly used


workspace tools: Select, Move Layout, Place Note,
3 Common Tools Bar Delete, Inspect, Resize Shape, Add Simple PDU, and
Add Complex PDU. See “Workspace Basics” for more
information.

You can toggle between the Physical Workspace and the


Logical Workspace with the tabs on this bar. In Logical
Workspace, this bar also allows you to go back to a
previous level in a cluster, create a New Cluster, Move
Logical/Physical
Object, Set Tiled Background, and Viewport. In
4 Workspace and
Physical Workspace, this bar allows you to navigate
Navigation Bar
through physical locations, create a New City, create a
New Building, create a New Closet, Move Object, apply
a Grid to the background, Set Background, and go to the
Working Closet.

This area is where you will create your network, watch


5 Workspace simulations, and view many kinds of information and
statistics.

You can toggle between Realtime Mode and Simulation


Mode with the tabs on this bar. This bar also provides
buttons to Power Cycle Devices and Fast Forward Time
Realtime/Simulation
6 as well as the Play Control buttons and the Event List
Bar
toggle button in Simulation Mode. Also, it contains a
clock that displays the relative Time in Realtime Mode
and Simulation Mode.

2|Page
This box is where you choose devices and connections to
Network
7 put into the workspace. It contains the Device-Type
Component Box
Selection Box and the Device-Specific Selection Box.

This box contains the type of devices and connections


Device-Type available in Packet Tracer. The Device-Specific Selection
8
Selection Box Box will change depending on which type of device you
choose.

This box is where you choose specifically which devices


Device-Specific
9 you want to put in your network and which connections to
Selection Box
make.

This window manages the packets you put in the network


User Created Packet
10 during simulation scenarios. See the “Simulation Mode”
Window
section for more details.

Workspaces and Modes


Packet Tracer has two workspaces (Logical and Physical) and two modes (Realtime and
Simulation). Upon start-up, you are in the Logical Workspace in Realtime Mode. You can build
your network and see it run in real time in this configuration. You can switch to Simulation
Mode to run controlled networking scenarios. You can also switch to the Physical Workspace
to arrange the physical aspects (such as the location) of your devices. Note that you view a
simulation while you are in the Physical Workspace. You should return to the Logical
Workspace after you are done in the Physical Workspace.
Cisco devices and packet tracer devices
ROUTERS
A router provides connectivity between two logical networks. Every router in Packet Tracer
can be switched on or off by using the provided power button.
The following routers are available in Packet Tracer:
Cisco 1841: This is an Integrated Service Router (ISR) having two Fast Ethernet ports, two
slots for High Speed WAN Interface Cards (HWICs), and one slot ,for Advanced
Integration Module (AIM)
Cisco 1941: This is similar to the previous model but runs on Cisco IOS Version 15. It has two
ports that operate at Gigabit Ethernet speeds.
Cisco 2620XM: This is a multiservice router with one Fast Ethernet port, two slots for WAN
Interface cards, and one slot for AIM.
Cisco 2621XM: This is similar to the previous model, except that this router has two Fast
Ethernet ports.

3|Page
Cisco 2811: This ISR comes with two Fast Ethernet ports, four WIC slots, and a dual slot for
AIM.
Cisco 2901: This router has two Gigabit Ethernet ports, four WIC slots, and two Digital Signal
Processor (DSP) slots. This router uses Cisco IOS Version 15.
Cisco 2911: This router has three Gigabit Ethernet ports and all the other features of the
previous router. It runs on IOS Version 15.
Generic Router-PT: This is a custom router running on Cisco IOS. It contains 10 slots and
has separate modules with a naming convention beginning with PT.
SWITCHES
A switch, also called a multiport bridge, connects more than two end devices together. Each
switch port is a collision domain.
The following switches are available in Packet Tracer:
Cisco 2950-24: This managed switch comes with 24 Fast Ethernet ports.
Cisco 2950T-24: This switch is a member of the Catalyst 2590 Intelligent Switch family and
has two Gigabit Ethernet ports in addition to the 24 Fast Ethernet ports.
Cisco 2960-24TT: This is another 24-port switch; the previous switch has Gigabit Interface
Converter (GBIC) for Gigabit Ethernet ports, whereas this switch has Small Form-factor
Pluggable (SFP) modules for the same.
Cisco 3560-24PS: This switch is different from the others because it is a layer 3 switch that
can be used to perform routing in addition to switching. The PS suffix implies support for
Power over Ethernet (PoE), which can be used to power up IP phones without using power
adapters.
Bridge PT: This is a device used to segment a NETWORK and it has only two ports (which
is why it is a bridge; if it had more, it'd be called a switch).
Generic Switch PT: This is a Packet-Tracer-designed switch running on Cisco IOS. This is
only customizable switch with 10 slots and several modules.
CONNECTORS

Connection type Connects these devices Picture

automatic connect all except console

4|Page
straight through PC, Server, Laptop, or
Printer to Switch
PC, Server, Laptop, or
Printer to Hub
PC, Server, Laptop, or
Printer to Modem
PC, Server, Laptop, or
Printer to Cloud
Router to Switch
Router to Hub
Router to Modem
Router to cloud
Crossover PC, Server, Laptop, or
printer to PC
PC, Server, Laptop, or
printer to Server PC, Server,
Laptop, or printer to Laptop
PC, Server, Laptop, or
printer to Printer
Switch to Hub
Switch to Switch
Hub to Hub
Router w/o Serial to Router
PC to PC
Fiber All with fiber ports

Phone Cloud to DSL Modem


VoIP to Analog Phone
Analog Phone to Analog
Phone

5|Page
Coaxial Cloud to Cable Modem
Cable Modem to Co-Ax
Splitter (hub)
Co-Ax Splitter to TV
Cable Modem to TV
Cloud to TV
TV to TV
Serial DCE Router to Router Cloud to
Router

Serial DTE Router to Router Cloud to


Router

Console PC/Laptop/Generic to
Router/Switch

Setting a User Profile


You can set your user profile for activity assessment and Multiuser identification. From the
Menu Bar, select Options > User Profile to view the User Profile dialog. In the User Profile
dialog, you can enter your Name, E-Mail, and any Additional Info about yourself that you
may want to share.

6|Page
Fig 1.2 Packet Tracer User Profile
Algorithm Settings
The Algorithms Settings dialog allows the user to make configurations that are otherwise
not available in IOS. It also allows tweaking of algorithm settings to make visualization of
certain algorithm/protocol behaviours more easily viewable.
CBAC Half-Open Session Multiplier: If the number of half-open CBAC sessions multiplied
by this number exceeds the configured max half-open session count, new sessions would not
be opened.
TCP Maximum Number of Connections: If the number of connections in SYN-RECEIVED
state exceeds this number, any new connections would be rejected.
TCP Maximum Number of Opened Sessions: If the number of connections exceeds this
number, any new connections would be rejected.
TCP Maximum Retransmission Timeout in Milliseconds: If a TCP connection does not
receive an acknowledgement to a segment it transmitted in this number, it would retransmit
the segment.
Switching Storm Control Multiplier: If the bandwidth percentage of broadcast frames used
multiplied by this number exceeds the configured threshold, the broadcast frame would be
dropped.

7|Page
Fig 1.3 Packet Tracer Algorithm Settings
Saving a PKZ
Packet Tracer allows you to save your topology (PKT) as well as any custom device icons
and backgrounds that you applied to on the Logical Workspace and Physical Workspace to a
save file called a PKZ. A PKZ is able to retain any external files you add in a single save file,
which allows for portability and compactness from computer to computer. To create a PKZ,
go to File > Save as Pkz. Enter a file name for the PKZ and click on Save. In the Pkz Select
Files dialog, you will be able to add and remove files that you want to save along with PKT.
To add a file, click on the Add button and browse to the file you want to add then click
Open. To remove a file, select the file from the list then click Remove. Once you are done
adding and removing files, click OK to create the PKZ file.

Fig 1.4 Saving the .pkz file

8|Page
Experiment – 2

AIM: To configure basic CISCO router.


Cisco router is a device that switches data packets between two different networks. By default
two different IP network cannot communicate with each other. They need a mediator device
that exchanges their packets. Routers do this job successfully by taking packet from one
network and delivering it to another network. This process is called routing.

We need to perform some initial configurations on router before it can be used for routing.

Cisco IOS supports various command modes, among those followings are the main command
modes.
 User EXEC Mode
 Privileged EXEC Mode
 Global Configuration Mode
 Interface Configuration Mode
 Setup Mode

You need to execute specific commands to navigate from one mode to another.

Mode of Operation Usage How to Enter the Prompt


Mode
User EXEC Change terminal First level accessed. Router>
settings on a
temporary basis,
perform basic tests,
and list system
information.
Privileged EXEC System From user EXEC Router#
administration, set mode, enter enable
operating password command
parameters.

9|Page
Global Config Modify From privileged Router(config)#
configuration that EXEC, enter
affect the system as configure terminal.
a whole.
Interface Config Modify the From global mode, Router(config-if)#
operation of an enter interface type
interface. number.
Setup Create the initial From privileged . Prompted dialog
configuration. EXEC mode, enter
command setup.

Standard order of accessing mode is:

User Exec mode => Privileged Exec mode => Global Configuration mode => Interface
Configuration mode => Sub Interface Configuration mode
Router will enter in setup mode only if it fails to load a valid running configuration.

1.1 Steps to configure basic router:

Step 1. Create a topology in packet tracer workspace.

Fig.2.1 Topology in work space

10 | P a g e
Step 2. Click on the router and access CLI prompt of the router.

Fig.2.2 Accessing CLI prompt

Step 3. Enter the following commands to configure, change hostname and secure the router
with a password.

configure terminal : Enters global configuration mode, when using the console port.

Router> enable
Router# configure terminal
Router(config)#

hostname name : change hostname of the router.

Router(config)# hostname Router


Router(config)#

password : Secure console port with a password.

Router(config)# line console 0


Router(config-line) #password xxx
Router(config-line) #login

Commands with their description:

Command Description

Router(config)#line console 0 Move in console line mode


Router(config-line)#password xxx Set console line password to xxx
Router(config-line)#login Enable password authentication for console
line

11 | P a g e
Step 4. Return to the console mode by using the exit command.

exit: Return to console mode

Router(config-line) #exit
Router(config) #exit
Router #exit

OUTPUT :

Fig.2.3 Router Configured

After executing the above commands. Now your router (Lab1) is secured with a password.

12 | P a g e
Fig.2.4 Router Secured

13 | P a g e
Experiment – 3

AIM: Configuration of IP addressing for a given scenario for a given


set of topologies (Bus and Star).

Bus Topology:
Bus topology uses one main cable to which all nodes are directly connected. The main cable
acts as a backbone for the network. One of the computers in a network typically acts s the
computer server.
Advantage of bus topology is that it is easy to connect a computer or peripheral device. The
second advantage is that the cable requirements are relatively small, resulting in lower cost.
This type of topology is not suitable for large networks.
Steps as follows:
Step 1: Launch the packet tracer
Step 2: Build the Topology
 First select three switches, three clients and connect them by FastEthernet wires.

Fig 3.1 Bus Topology

Step 3: Configure the End Devices:


 Configure the clients by providing their IP Address and subnet mask.
Configure PC0
Click on PC0. Then configure it as follows:
h. Click on the Desktop tab.
i. Click on the IP Configuration Icon.
14 | P a g e
j. Then click on the IP Address dialog box.
k. Type in 192.168.1.1 as the IP address and press enter.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.

Fig 3.2 IP Configuration of PC0

Configure PC1
Click on PC1. Then configure it as follows:
h. Click on the Desktop tab.
i. Click on the IP Configuration Icon.
j. Click on the IP Address dialog box.
k. Type in 192.168.1.2 as the IP address and press enter.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.
m. Type in 192.168.1.1 as the default gateway address.

15 | P a g e
Fig 3.3 IP Configuration of PC1

Configure PC2
Click on PC2. Then configure it as follows:
h. Click on the Desktop tab.
i. Click on the IP Configuration Icon.
j. Click on the IP Address dialog box.
k. Type in 192.168.1.3 as the IP address and press enter.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.
m. Type in 192.168.1.1 as the default gateway address.

16 | P a g e
Fig 3.4 IP Configuration of PC2

Step 4: Check the configuration of the topology:


b. In Realtime mode, add a simple PDU from PC0 to PC2 and check the status at the
bottom right corner of packet tracer.
c. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

17 | P a g e
Fig 3.5 Message Transferred in Realtime Mode

Star Topology:
In star topology, each computer is connected to a central hub using a point-to-point connection.
The central hub can be a server that manages the network, or it can be a much simpler device
that only makes the connections between computers over the network possible.
Advantage of star topology is that it is easy to add new nodes to the network.
Steps as follows:
Step 1: Launch the packet tracer
Step 2: Build the Topology
 First select a switch, 4 clients and connect them by FastEthernet wires.

18 | P a g e
Fig 3.6 Star Topology

Step 3: Configure the End Devices:


 Configure the clients by providing their IP Address and subnet mask.
Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.1 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

19 | P a g e
Fig 3.7 IP Configuration of PC0

Configure PC1
Click on PC1. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

Configure PC2
Click on PC2. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

Configure PC3

20 | P a g e
Click on PC3. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Then click on the IP Address dialog box.
d. Type in 192.168.1.4 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.

Step 4: Check the configuration of the topology:


a. In Realtime mode, add a simple PDU from PC0 to PC2 and check the status at the
bottom right corner of packet tracer.
b. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 3.8 Message Transferred in Realtime Mode

21 | P a g e
Experiment – 4

AIM: Configuration of DHCP Server.


The Bootstrap Protocol (BOOTP) is a client/server protocol and it provides the following:

• IP address

• net mask

• the address of a default router

• the address of a name server.

The Dynamic Host Configuration Protocol (DHCP) provides all the above functionalities of
BOOTP alongwith static and dynamic address allocation that can be manual or automatic.

Steps involved in configuration:

1. Select one router, switch and number of clients for connection setup. And connect them
through fast Ethernet wire with each other.

22 | P a g e
2. Check the properties of each client by going in there config window after selecting DHCP
other than STATIC. It will return unable to connect. Because router is not set up.

3. For setting up a router, go to command window and right commands as follows.

Fig.4.2 Commands executed

R1#config t
R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastethernet 1/0
R1(config-if)#ip address 192.168.1.0 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)#ip dhcp pool


R1(dhcp-config)#network 192.168.1.0 255.255.255.0
R1(dhcp-config)#dns-server 192.168.1.2

23 | P a g e
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#exit

4. Now, Click on any of the PC > Desktop > IP configuration > Choose DHCP.

Now PC will get an IP from DHCP server.

Fig.4.3 Configuring DHCP server

24 | P a g e
Experiment – 5

AIM: To implement and configure ARP/RARP protocol and static


routes.

Address Resolution Protocol (ARP):


Address Resolution Protocol is a communication protocol used for discovering physicaladdress
associated with given network address. Typically, ARP is a network layer to data link layer
mapping process, which is used to discover MAC address for given Internet Protocol Address.
In order to send the data to destination, having IP address is necessary but not sufficient; we
also need the physical address of the destination machine. ARP is used to get the physical
address (MAC address) of destination machine.
Reverse Address Resolution Protocol (RARP):
Reverse ARP is a networking protocol used by a client machine in a local area network to
request its Internet Protocol address (IPv4) from the gateway-router’s ARP table. The network
administrator creates a table in gateway-router, which is used to map the MAC address to
corresponding IP address.

When a new machine is setup or any machine which don’t have memory to store IP address,
needs an IP address for its own use. So, the machine sends a RARP broadcast packet which
contains its own MAC address in both sender and receiver hardware address field.

Steps as follows for ARP:


Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

25 | P a g e
Fig 5.1 Network Topology (ARP)
Step 3: Configure the End Devices:
Configure PC5
Click on PC5. Then configure it as follows:
m. Click on the Desktop tab.
n. Click on the IP Configuration Icon.
o. Click on the IP Address dialog box.
p. Type in 192.168.1.1 as the IP address and press enter.
q. A default value of 255.255.255.0 should appear in the Subnet Mask.
Configure PC1
Click on PC1. Then configure it as follows:
n. Click on the Desktop tab.
o. Click on the IP Configuration Icon.
p. Click on the IP Address dialog box.
q. Type in 192.168.1.2 as the IP address and press enter.
r. A default value of 255.255.255.0 should appear in the Subnet Mask.

Configure PC2
Click on PC2. Then configure it as follows:
n. Click on the Desktop tab.
o. Click on the IP Configuration Icon.
p. Click on the IP Address dialog box.

26 | P a g e
q. Type in 192.168.1.3 as the IP address and press enter.
r. A default value of 255.255.255.0 should appear in the Subnet Mask.
Step 4: ARP configuration:
Click on PC5. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the Command Prompt.
c. Type the following command in the prompt: ping 192.168.1.3 and press enter.
d. If everything is done correctly, then one should see the following output:

Fig 5.2 PC5 Command Prompt

Click on PC5. Then configure it as follows:


a. Click on the Desktop tab.
b. Click on the Command Prompt.
c. Type the following command in the prompt: arp -a and press enter.
d. If everything is done correctly, then one should see the following output:

27 | P a g e
Fig 5.3 PC2 Command Prompt

e. On typing the arp -a command, we get the IP Address and MAC Address of
PC5.
Step 5: To check whether the PC5 has received back the message, go to Command Prompt of
PC0 and type the command arp -a.

Fig 5.4 arp-a command executed

28 | P a g e
Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
PC5 N/A 192.168.1.1 255.255.255.0 0.0.0.0
PC1 N/A 192.168.1.2 255.255.255.0 0.0.0.0
PC2 N/A 192.168.1.3 255.255.255.0 0.0.0.0

Step 6: Check the configuration of the topology:


e. In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.
f. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 5.5 Simulation mode

Static Routing:
Static routing is a form of routing that occurs when a router uses a manually-configured routing
entry, rather than information from a dynamic routing traffic. In many cases, static routes are
manually configured by a network administrator by adding in entries into a routing table,
though this may not always be the case.
Unlike dynamic routing, static routes are fixed and do not change if the network is changed or
reconfigured. Static routing and dynamic routing are not mutually exclusive. Both dynamic
routing and static routing are usually used on a router to maximise routing efficiency and to
provide backups in the event that dynamic routing information fails to be exchanged. Static
routing can also be used in stub networks, or to provide a gateway of last resort.

29 | P a g e
Steps are as follows for static routing:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

Fig 5.6 Network Topology (Static)

Step 3: Configure the End Devices:


Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.

Configure PC1
Click on PC1. Then configure it as follows:
a. Click on the Desktop tab.

30 | P a g e
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.1.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.
Configure PC2
Click on PC2. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.2.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.2.1 as the default gateway address.
Configure PC3
Click on PC3. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.2.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.2.1 as the default gateway address.

Configure PC4
Click on PC4. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.3.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.3.1 as the default gateway address.

31 | P a g e
Configure PC5
Click on PC5. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.3.3 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.3.1 as the default gateway address.

Step 4: Configure the Network Devices:


Configure Router0
Click on Router0. Then configure it as follows:
j. Click on config tab and then click on the FastEthernet 0/0.
k. Type in 192.168.1.1 as the IP address.
l. A default value of 255.255.255.0 should appear in the Subnet Mask.
m. Tick the Port Status as On.
n. Click on config tab and then click on the FastEthernet 1/0.
o. Type in 192.168.2.1 as the IP address.
p. A default value of 255.255.255.0 should appear in the Subnet Mask.
q. Tick the Port Status as On.
r. Click on the Serial 2/0.
s. Type in 10.10.0.2 as the IP address.
t. A default value of 255.0.0.0 should appear in the Subnet Mask.
u. Tick the Port Status as On.
v. Set the clock rate to 64000ms.
w. Save these settings.
Configure Router1
Click on Router1. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.3.1 as the IP address.

32 | P a g e
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 10.10.0.3 as the IP address.
g. A default value of 255.0.0.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate to 64000ms.
j. Save these settings.
Step 5: Static routing configuration:
Click on the Router0. Then configure it as follows:
a. Click the config tab and then Static tab.
b. Add network address 192.168.3.0
c. Add mask as 255.255.255.0
d. Add next hop as 10.10.0.3
e. Click the add button.
f. Then click the settings tab and then click the save button.
g. The equivalent IOS commands of the above steps are as follows:
Router(config-if)#exit
Router(config)#
Router(config)#ip route 192.168.3.0 255.255.255.0 10.10.0.3
Router(config)#
Click on the Router1. Then configure it as follows:
a. Click the config tab and then Static tab.
b. Add network address 192.168.1.0
c. Add mask as 255.255.255.0
d. Add next hop as 10.10.0.2
e. Click the add button.
f. add network address 192.168.2.0
g. Add mask as 255.255.255.0
h. Add next hop as 10.10.0.2

33 | P a g e
i. Click the add button.
j. Then click the settings tab and then click the save button.
k. The equivalent IOS commands of the above steps are as follows:
Router(config-if)#exit
Router(config)#
Router(config)#ip route 192.168.1.0 255.255.255.0 10.10.0.2
Router(config)#ip route 192.168.2.0 255.255.255.0 10.10.0.2
Router(config)#
Step 6: Check the configuration of the topology:
 In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC4 and
check the status at the bottom right corner of packet tracer.

 If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 5.7 Realtime mode

34 | P a g e
Fig 5.8 Simulation mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Fa1/0 192.168.2.1 255.255.255.0 N/A
Router0 Se2/0 10.10.0.2 255.0.0.0 N/A
Router1 Fa0/0 192.168.3.1 255.255.255.0 N/A
Router1 Se2/0 10.10.0.3 255.0.0.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.1.3 255.255.255.0 192.168.1.1
PC2 N/A 192.168.2.2 255.255.255.0 192.168.2.1
PC3 N/A 192.168.2.3 255.255.255.0 192.168.2.1
PC4 N/A 192.168.3.2 255.255.255.0 192.168.3.1
PC5 N/A 192.168.3.3 255.255.255.0 192.168.3.1

35 | P a g e
Experiment – 6

AIM: To implement and configure RIP, OSPF and BGP routing


protocols.

Routing Information Protocol (RIP):


RIP is a dynamic routing protocol which uses hop count as a routing metric to find the best
path between the source and the destination network. It is a distance vector routing protocol
which has AD value 120 and works on the application layer of OSI model. RIP uses port
number 520.
Steps are as follows for RIP:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

Fig 6.1 Network Topology (RIP)


Step 3: Configure the End Devices:
Configure PC0
Click on PC0. Then configure it as follows:
r. Click on the Desktop tab.
s. Click on the IP Configuration Icon.

36 | P a g e
t. Click on the IP Address dialog box.
u. Type in 192.168.1.2 as the IP address and press enter.
v. A default value of 255.255.255.0 should appear in the Subnet Mask.
w. Type in 192.168.1.1 as the default gateway address.

Configure PC1
Click on PC1. Then configure it as follows:
s. Click on the Desktop tab.
t. Click on the IP Configuration Icon.
u. Click on the IP Address dialog box.
v. Type in 192.168.2.2 as the IP address and press enter.
w. A default value of 255.255.255.0 should appear in the Subnet Mask.
x. Type in 192.168.2.1 as the default gateway address.
Step 4: Configure the Network Devices:
Configure Router0
Click on Router0. Then configure it as follows:
x. Click on config tab and then click on the FastEthernet 0/0.
y. Type in 192.168.1.1 as the IP address.
z. A default value of 255.255.255.0 should appear in the Subnet Mask.
aa. Tick the Port Status as On.
bb. Click on the Serial 2/0.
cc. Type in 10.10.0.2 as the IP address.
dd. A default value of 255.0.0.0 should appear in the Subnet Mask.
ee. Tick the Port Status as On.
ff. Set the clock rate to 64000ms.
gg. Save these settings.
Configure Router1
Click on Router1. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.2.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.

37 | P a g e
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 10.10.0.3 as the IP address.
g. A default value of 255.0.0.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate as not set.
j. Save these settings.
Step 5: RIP routing configuration:
Click on the Router0. Then configure it as follows:
h. Click the config tab and then RIP tab.
i. Add network address 10.0.0.0
j. Add network address 192.168.1.0
k. Then go to settings and click the save button.
l. The equivalent IOS commands of the above steps are as follows:
Router>enable
Router#
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.1.0
Router(config-router)#network 10.0.0.0
Router(config-router)#exit
Click on the Router1. Then configure it as follows:
a. Click the config tab and then RIP tab.
b. Add network address 10.0.0.0
c. Add network address 192.168.2.0
d. Then go to settings and click the save button.
e. The equivalent IOS commands of the above steps are as follows:
Router>enable
Router#

38 | P a g e
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.2.0
Router(config-router)#network 10.0.0.0
Router(config-router)#exit
Step 6: Check the configuration of the topology:
g. In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.
h. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 6.2 Simulation Mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Se2/0 10.10.0.2 255.0.0.0 N/A
Router1 Fa0/0 192.168.2.1 255.255.255.0 N/A
Router1 Se2/0 10.10.0.3 255.0.0.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.2.2 255.255.255.0 192.168.2.1

39 | P a g e
Open Shortest Path First (OSPF):
OSPF is a link-state routing protocol which is used to find the best path between the source
and the destination router using its own Shortest Path First). OSPF is developed by Internet
Engineering Task Force (IETF) as one of the Interior Gateway Protocol (IGP), i.e, the protocol
which aims at moving the packet within a large autonomous system or routing domain. It is a
network layer protocol which works on the protocol number 89 and uses AD value 110. OSPF
uses multicast address 224.0.0.5 for normal communication and 224.0.0.6 for update to
designated router(DR)/Backup Designated Router (BDR).
Steps are as follows for OSPF:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

Fig 6.3 Network Topology (OSPF)


Step 3: Configure the End Devices:
Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.

40 | P a g e
c. Click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.

Configure PC1

Click on PC1. Then configure it as follows:


a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.2.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.2.1 as the default gateway address.
Step 4: Configure the Network Devices:
Configure Router0
Click on Router0. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.1.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 10.10.0.2 as the IP address.
g. A default value of 255.0.0.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate to 64000ms.
j. Click on the Serial 3/0.
k. Type in 11.10.0.2 as the IP address.
l. A default value of 255.0.0.0 should appear in the Subnet Mask.
m. Tick the Port Status as On.
n. Set the clock rate to 64000ms.
o. Save these settings.

41 | P a g e
Configure Router1
Click on Router1. Then configure it as follows:
k. Click on config tab and then click on the FastEthernet 0/0.
l. Type in 192.168.2.1 as the IP address.
m. A default value of 255.255.255.0 should appear in the Subnet Mask.
n. Tick the Port Status as On.
o. Click on the Serial 2/0.
p. Type in 10.10.0.3 as the IP address.
q. A default value of 255.0.0.0 should appear in the Subnet Mask.
r. Tick the Port Status as On.
s. Set the clock rate to 64000ms.
t. Click on the Serial 3/0.
u. Type in 12.10.0.3 as the IP address.
v. A default value of 255.0.0.0 should appear in the Subnet Mask.
w. Tick the Port Status as On.
x. Set the clock rate to 64000ms.
y. Save these settings.
Configure Router2
Click on Router1. Then configure it as follows:
a. Click on the config tab and then on the Serial 2/0.
b. Type in 11.10.0.3 as the IP address.
c. A default value of 255.0.0.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Set the clock rate to 64000ms.
f. Click on the Serial 3/0.
g. Type in 12.10.0.2 as the IP address.
h. A default value of 255.0.0.0 should appear in the Subnet Mask.
i. Tick the Port Status as On.
j. Set the clock rate to 64000ms.
k. Save these settings.

42 | P a g e
Step 5: OSPF routing configuration:
Click on the Router0. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Click on the Router1. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0
Router(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Click on the Router2. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit

43 | P a g e
 Click the config tab and then goto settings tab and click save button.
Step 6: Check the configuration of the topology:
 In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.

 If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

Fig 6.4 Realtime mode

44 | P a g e
Fig 6.5 Simulation Mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Se2/0 10.10.0.2 255.0.0.0 N/A
Router0 Se3/0 11.10.0.2 255.0.0.0 N/A
Router1 Fa0/0 192.168.2.1 255.255.255.0 N/A
Router1 Se2/0 10.10.0.3 255.0.0.0 N/A
Router1 Se3/0 12.10.0.3 255.0.0.0 N/A
Router2 Se2/0 11.10.0.3 255.0.0.0 N/A
Router2 Se3/0 12.10.0.2 255.0.0.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.2.2 255.255.255.0 192.168.2.1

Border Gateway Protocol (BGP):


Border Gateway Protocol (BGP) is a standardized exterior gateway protocol designed to
exchange routing and reachability information among autonomous systems (AS) on the
Internet. The protocol is classified as a path vector protocol.
The Border Gateway Protocol makes routing decisions based on paths, network policies, or
rule-sets configured by a network administrator and is involved in making core routing
decisions.
Steps are as follows for BGP:
Step 1: Launch the packet tracer
Step 2: Build the Topology
a. Add network devices and End Devices to the workspace.
Using the device selection box, add the network devices and End Devices to the workspace.
b. Add the physical cabling between devices on the workspace.
Using the device selection box, add the physical cabling between devices on the workspace.

45 | P a g e
Fig 6.6 Network Topology (BGP)
Step 3: Configure the End Devices:
Configure PC0
Click on PC0. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.1.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.1.1 as the default gateway address.
Configure PC1
Click on PC1. Then configure it as follows:
a. Click on the Desktop tab.
b. Click on the IP Configuration Icon.
c. Click on the IP Address dialog box.
d. Type in 192.168.3.2 as the IP address and press enter.
e. A default value of 255.255.255.0 should appear in the Subnet Mask.
f. Type in 192.168.3.1 as the default gateway address.
Step 4: Configure the Network Devices:
Configure Router0

46 | P a g e
Click on Router0. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.1.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 192.168.2.2 as the IP address.
g. A default value of 255.255.255.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate to 64000ms.
j. Save these settings.
Configure Router1
Click on Router1. Then configure it as follows:
a. Click on config tab and then click on the FastEthernet 0/0.
b. Type in 192.168.3.1 as the IP address.
c. A default value of 255.255.255.0 should appear in the Subnet Mask.
d. Tick the Port Status as On.
e. Click on the Serial 2/0.
f. Type in 192.168.2.3 as the IP address.
g. A default value of 255.255.255.0 should appear in the Subnet Mask.
h. Tick the Port Status as On.
i. Set the clock rate as not set.
j. Save these settings.
Step 5: BGP routing configuration:
Click on the Router0. Then configure it as follows:

 Click the CLI Tab.


 Type the following commands:
Router(config-if)#exit
Router(config)#router bgp 100
Router(config-router)#network 192.168.1.0

47 | P a g e
Router(config-router)#network 192.168.2.0
Router(config-router)#neighbor 192.168.2.3 remote-as 200
Router(config-router)#neighbor 192.168.3.2 remote-as 200
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Click on the Router1. Then configure it as follows:
 Click the CLI Tab.
 Type the following commands:
Router(config-if)#exit
Router(config)#router bgp 200
Router(config-router)#network 192.168.2.0
Router(config-router)#network 192.168.3.0
Router(config-router)#neighbor 192.168.2.2 remote-as 100
Router(config-router)#neighbor 192.168.1.2 remote-as 100
Router(config-router)#exit
 Click the config tab and then goto settings tab and click save button.
Step 6: Check the configuration of the topology:
a. In Realtime mode or in Simulation mode, add a simple PDU from PC0 to PC1 and
check the status at the bottom right corner of packet tracer.
b. If the status is given as Successful then the configuration of the topology is correct
otherwise there is some error in the IP configuration of the topology.

48 | P a g e
Fig 6.7 Realtime Mode

Fig 6.8 Simulation Mode

Addressing Table
Device Interface IP Address Subnet Mask Def. Gateway
Router0 Fa0/0 192.168.1.1 255.255.255.0 N/A
Router0 Se2/0 192.168.2.2 255.255.255.0 N/A
Router1 Fa0/0 192.168.3.1 255.255.255.0 N/A
Router1 Se2/0 192.168.2.3 255.255.255.0 N/A
PC0 N/A 192.168.1.2 255.255.255.0 192.168.1.1
PC1 N/A 192.168.3.2 255.255.255.0 192.168.3.1

49 | P a g e
Experiment – 7

AIM: To configure FTP on packet tracer.

The file transfer protocol (FTP) is a standard network protocol used to transfer computer files
between client and server on a computer network. FIP is built on a client-server model
architecture and used separate control and data connections between the client and the server.
Steps as follows:
Step 1: Launch the packet tracer
Step 2: Build the Topology
 Select one router, two switches, two clients and one server and name that server as FTP.
 Select a module in the router, keep it in mind server must be switched OFF while
installing module, and ON it after the installation of the module.

Fig 7.1 Router0 device view

 Connect these devices with one another through wires.

50 | P a g e
Fig 7.2 Network Topology
Step 3: Configure the FTP server
Click on FTP server. Then configure it as follows:
 Select Desktop>IP configuration tab. Type the IP Address as 192.168.1.2, subnet mask
as 255.255.255.0 and default gateway as 192.168.1.1.

Fig 7.3 FTP Server IP Configuration

51 | P a g e
 Then click on the services tab and select FTP and provide username and password of
your own choice, also select all the checkboxes provided below and after that click on
ADD.

Fig 7.4 FTP Configuration

Step 4: Configure the END devices


 Click on PC0 and select Desktop>IP configuration. Type IP Address as 192.168.2.2,
Subnet mask as 255.255.255.0 and Default gateway as 192.168.2.1.

52 | P a g e
Fig 7.5 PC0 IP Configuration

 Similarly, click on PC1 and select Desktop>IP configuration. Type IP Address as


192.168.3.2, subnet mask as 255.255.255.0 and Default gateway as 192.168.3.1.

Fig 7.6 PC1 IP Configuration

Step 5: Configure the Router

 Click on the router and click on Config tab, select FastEthernet 0/0 and put the port
status “ON” and also type IP Address as 192.168.2.1 and subnet mask as 255.255.255.0.

53 | P a g e
Similarly, in case of FastEthernet 1/0 put the port status “ON” and type IP Address as
192.168.3.1 and subnet mask as 255.255.255.0. For FastEthernet 6/0 type IP Address
as 192.168.1.1.

Fig 7.7 Router0 FastEthernet Configuration

Step 6: Executing the commands


 Select the first client (PC0) and click on the command prompt tab and write the code
as shown in figure:

54 | P a g e
Fig 7.8 PC0 Command Prompt

Fig 7.9 Commands Executing

55 | P a g e
Fig 7.10 Commands Executing

Fig 7.11 File Transferred

56 | P a g e
Experiment – 8

AIM: Implementation of Port Scanner.


This program creates a simple port scanner program to check the open ports for the specified
host name.

import
java.io.IOException;
import
java.net.InetAddress;
import java.net.Socket;

public class PortScanner {


public static void main(String[] args) throws Exception {
String host = "localhost";
InetAddress inetAddress = InetAddress.getByName(host);

String hostName = inetAddress.getHostName();


for (int port = 0; port <= 65535; port++) {
try {
Socket socket = new Socket(hostName, port);
String text = hostName + " is listening on port " + port;
System.out.println(text);
socket.close();
} catch (IOException e) {
String s = hostName + " is not listening on port " + port;
System.out.println(s);
}
}
}

57 | P a g e
Experiment – 9

AIM: Implementation of file transfer using TCP.

The server module :

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Main {


public static void main(String[] args) throws IOException {
ServerSocket servsock = new ServerSocket(123456);
File myFile = new File("s.pdf");
while (true) {
Socket sock = servsock.accept();
byte[] mybytearray = new byte[(int) myFile.length()];
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(myFile));
bis.read(mybytearray, 0, mybytearray.length);
OutputStream os = sock.getOutputStream();
os.write(mybytearray, 0, mybytearray.length);
os.flush();
sock.close();
}
}
}

The client module :

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.Socket;

public class Main {


public static void main(String[] argv) throws Exception {
Socket sock = new Socket("127.0.0.1", 123456);
byte[] mybytearray = new byte[1024];
InputStream is = sock.getInputStream();

58 | P a g e
FileOutputStream fos = new FileOutputStream("s.pdf");
BufferedOutputStream bos = new BufferedOutputStream(fos);
int bytesRead = is.read(mybytearray, 0, mybytearray.length);
bos.write(mybytearray, 0, bytesRead);
bos.close();
sock.close();
}
}

59 | P a g e
Experiment – 10

AIM: Implementation of file transfer using UDP.


The client module :

import java.net.*;
import java.io.*;
public class client
{
public static void main(String args[])throws Exception
{
byte b[]=new byte[1024];
FileInputStream f=new FileInputStream("D:/raj.txt");
DatagramSocket dsoc=new DatagramSocket(2000);
int i=0;
while(f.available()!=0)
{
b[i]=(byte)f.read();
i++;
}
f.close();
dsoc.send(new DatagramPacket(b,i,InetAddress.getLocalHost(),1000));
}

The server module :

import java.net.*;
import java.io.*;
public class server
{
public static void main(String args[])throws IOException
{
byte b[]=new byte[3072];
DatagramSocket dsoc=new DatagramSocket(1000);
FileOutputStream f=new FileOutputStream("D:/nandha.txt");
while(true)
{
DatagramPacket dp=new DatagramPacket(b,b.length);

60 | P a g e
dsoc.receive(dp);
System.out.println(newString(dp.getData(),0,dp.getLength()));

}
}

61 | P a g e
MAHARAJA SURAJMAL INSTITUTE OF
TECHNOLOGY
C-4, JANAKPURI, NEW DELHI-110058

ACN PRACTICAL FILE


(ADVANCE COMPUTER NETWORKS)
(ETIT-453)
---------------------------------------
Name GAURAV KUMAR
Branch B. TECH – IT-1(M)
Year 4th Year - 7 Sem
Enrollment Number 02515003120
Class Serial Number 23
Submitted to Ms. PRIYANKA KALKANDA
Assistant Professor, IT
Department
TABLE OF CONTENTS
Sr. No. Experiment Sign

1 Write an experiment to study the concept


of Frequency Reuse.

2 Write an experiment to study the concept


and implementation of CDMA.

3 Write an experiment to create/setup wireless


networks.

4 Write an experiment for Simulation in NS3 to


connect.

5 Write an experiment to simulate Adhoc networks


using NS3.

6 Simulation in NS3 to create WiFi simple


infrastructure nodes.

7 Write an experiment to analyse network traffic using


WIRESHARK tool.

8 Experiment to capture, filter and inspect


elements using WIRESHARK tool.

1
MAHARAJA SURAJMAL INSTITUTE OF
TECHNOLOGY
C-4, JANAKPURI, NEW DELHI-110058

ACN PRACTICAL FILE


(ADVANCE COMPUTER NETWORKS)
(ETIT-453)
---------------------------------------
Name DIWAKAR JHA
Branch B. TECH – IT-1(M)
Year 4th Year - 7 Sem
Enrollment Number 02415003120
Class Serial Number 22
Submitted to Ms. PRIYANKA KALKANDA
Assistant Professor, IT
Department
TABLE OF CONTENTS
Sr. No. Experiment Sign

1 Write an experiment to study the concept


of Frequency Reuse.

2 Write an experiment to study the concept


and implementation of CDMA.

3 Write an experiment to create/setup wireless


networks.

4 Write an experiment for Simulation in NS3 to


connect.

5 Write an experiment to simulate Adhoc networks


using NS3.

6 Simulation in NS3 to create WiFi simple


infrastructure nodes.

7 Write an experiment to analyse network traffic using


WIRESHARK tool.

8 Experiment to capture, filter and inspect


elements using WIRESHARK tool.

You might also like