computer networks lab manual

Upload: jenisha

Post on 21-Feb-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 Computer Networks Lab Manual

    1/61

    Powered By www.technoscriptz.com

    TABLE OF CONTENTS

    Ex.No TITLE PAGE NO.

    1 Study Of Networking Devices 2

    2 Study Of Networking Commands 8

    3 Cable Construction 11

    4 PC To PC Communication Using Serial Parallel Adapter 14

    5 PC To PC Communication Using Switch 18

    6 Secured Data Transfer Using Serial/Parallel Adapter 23

    7 Simulation Of Token Ring Protocol 29

    8 Simulation Of Token Bus Protocol 33

    9 Simulation Of CSMA/CD 37

    10 Simulation Of CSMA/CA 41

    11 Simulation Of Ring Topology Using LAN Trainer Kit 45

    12 Simulation Of Bus Topology Using LAN Trainer Kit 47

    13 Simulation Of Star Topology Using LAN Trainer Kit 49

    14 Implementation Of Stop And Wait Protocol 51

    15 Implementation Of Go Back N Protocol 53

    16 Implementation Of Distance Vector Routing 55

    17 Implementation Of Link State Routing 57

    18 Client-Server Communication Using Switch 59

  • 7/24/2019 Computer Networks Lab Manual

    2/61

    2

    Ex No: 1

    STUDY OF NETWORKING DEVICES

    Aim:

    To study the functions of various networking devices used in local area networks.

    Theory:

    LAYER1_DEVICE:

    (i) Repeater:

    A repeater receives a signal, regenerates it, and passes it on. It can regenerate and retime

    network signals at the bit level to allow them to travel a longer distance on the media.

    (ii) Hub:

    Hubs are actually multiport repeaters. Using a hub changes the network topology from a

    linear bus, where each device plugs directly into the wire, to a star. Hubs are also called

    concentrators. Three Different types of hubs

  • 7/24/2019 Computer Networks Lab Manual

    3/61

    3

    Passive:

    A passive hub serves as a physical connection point only. It does not manipulate or view the

    traffic that crosses it. It does not boost or clean the signal. A passive hub is used only to share

    the physical media. As such, the passive hub does not need electrical power.

    Active:

    An active hub must be plugged into an electrical outlet because it needs power to amplify the

    incoming signal before passing it out to the other ports.

    Intelligent:

    Intelligent hubs are sometimes called smart hubs. These devices basically function as active

    hubs, but also include a microprocessor chip and diagnostic capabilities. Intelligent hubs are

    more expensive than active hubs, but are useful in troubleshooting situations.

    LAYER2_DEVICES:

    (iii) BRIDGES

    Layer 2 devices are more intelligent than Layer 1 devices. Layer 2 devices make forwarding

    decisions based on Media Access Control (MAC) addresses contained within the headers of

    transmitted data frames.

    A bridge is a Layer 2 device used to divide, or segment, a network. Bridges collect and selectively

    pass data frames between two network segments.

    In order to do this, bridges learn the MAC address of devices on each connected segment. With

    this information, the bridge builds a bridging table and forwards or blocks traffic based on that

    table.

    This results in smaller collision domains and greater network efficiency.

  • 7/24/2019 Computer Networks Lab Manual

    4/61

    4

    Bridges do not restrict broadcast traffic.

    When a bridge receives a frame on the network, the destination MAC address is looked up in the

    bridge table to determine whether to filter, flood, or copy the frame onto another segment.

    If the destination device is on the same segment as the frame, the bridge blocks the frame from

    going on to other segments. This process is known as filtering.

    If the destination device is on a different segment, the bridge forwards the frame to the appropriate

    segment.

    If the destination address is unknown to the bridge, the bridge forwards the frame to all segments

    except the one on which it was received. This process is known as flooding.

    (iv) Switches

    A switch is sometimes described as a multiport bridge.

    A switch chooses the port to which the destination device or workstation is connected.

    Switches improve network performance by improving speed and bandwidth.

    Switching data frames is the process by which a frame is received on an input medium and then

    transmitted to an output medium.

  • 7/24/2019 Computer Networks Lab Manual

    5/61

    5

    The second is the maintenance of switching operations where switches build and maintain

    switching tables.

    Switches make forwarding decisions based on MAC addresses contained within transmitted data

    frames. Switches learn the MAC addresses of devices connected to each port and this information

    is entered into a switching table.

    Switches create a virtual circuit between two connected devices that want to communicate. When

    the virtual circuit is created, a dedicated communication path is established between the two

    devices.

    LAYER3_DEVICE:

    (v) Routers:

    A router is a Layer 3 device. Routers make decisions based on groups of network addresses, or

    classes, as opposed to individual MAC addresses. Routers use routing tables to record the Layer 3

    addresses of the networks that are directly connected to the local interfaces and network paths

    learned from neighbor routers.

    The following are functions of a router:

    Examine inbound packets of Layer 3 data.

    Choose the best path for the data through the network.

    Route the data to the proper outbound port.

    Routers do not forward broadcasts unless they are programmed to do so. Therefore, routers reduce

    the size of both the collision domains and the broadcast domains in a network.

  • 7/24/2019 Computer Networks Lab Manual

    6/61

    6

    Routers are the most important devices to regulate traffic on large networks. Routers enable

    communication between two computers regardless of location or operating system.

    A router is a special type of computer.

    It has the same basic components as a standard desktop PC.

    It has a CPU, memory, a system bus, and various input/output interfaces.

    However, routers are designed to perform some very specific functions that are not typically

    performed by desktop computers.

    Routers do not forward broadcasts unless they are programmed to do so. Therefore, routers reduce

    the size of both the collision domains and the broadcast domains in a network.

    Routers are the most important devices to regulate traffic on large networks. Routers enable

    communication between two computers regardless of location or operating system.

    (vi) Gateway:

    A network gateway is an internetworking system capable of joining together two networks that

    use different protocols. It can be implemented completely in software, completely in hardware or in

    firmware. Depending upon the types of protocols they support network gateways can operate at any levels

    of OSI model. Because by definition it appears at the edge of a network, related capabilities like firewalls

    tend to be integrated with it. A gateway may basically contain devices such as protocol translators,

    impedance matching devices, rate converters, fault isolations or signal translators as necessary to provide

    system interoperability.

  • 7/24/2019 Computer Networks Lab Manual

    7/61

    7

    Result:

    Thus the networking devices with its uses were studied.

    PC

    PC

    PC

    LANGate way

    PC PC

    PC

  • 7/24/2019 Computer Networks Lab Manual

    8/61

    8

    Ex No: 2

    STUDY OF NETWORKING COMMANDS

    Aim:

    To study the various networking Commands.

    IP Configuration Details:

    (i) ipconfig Command:

    Syntax:

    C:\Documant and setting\administrtor.RMDECE>ipconfig

    (ii) ipconfig/all Command:

    Syntax:

    C:\Documant and setting\administrtor.RMDECE>ipconfig/all

  • 7/24/2019 Computer Networks Lab Manual

    9/61

    9

    Testing Connectivity:

    (i) Self Ping Command:

    Syntax:

    C:\Documant and setting\administrtor.RMDECE>ping

    Example:

    C:\Documant and setting\administrtor.RMDECE>ping 50.50.50.57

    (ii) Ping to Destination

    Syntax:

    C:\Documant and setting\administrtor.RMDECE>ping

    Example:C:\Documant and setting\administrtor.RMDECE>ping 50.50.50.1

  • 7/24/2019 Computer Networks Lab Manual

    10/61

    10

    (iv) Improper ping Command

    Syntax:

    C:\Documant and setting\administrtor.RMDECE>ping

    Example: 1

    C:\Documant and setting\administrtor.RMDECE>ping 192.168.10.10

    Example: 2

    C:\Documant and setting\administrtor.RMDECE>ping 50.50.50.100

    Result:

    Thus the networking commands were studied and tested.

  • 7/24/2019 Computer Networks Lab Manual

    11/61

    11

    Ex No: 3

    CABLE CONSTRUCTION

    Aim:

    To construct the cable for different configuration.

    Theory:

    There are different types of configuration

    1. Straight Through 2. Cross Over 3. Roll Over

    1. Straight Through Cable:

    A cable that maintains the pin connection all the way through the communication path is straight

    through cable. The wire connected to pin 1 is the transmit connection on either end of the communication

    cable.

    Use straight-through cables for the following cabling:

    Switch to router

    Switch to PC or server Hub to PC or server

  • 7/24/2019 Computer Networks Lab Manual

    12/61

    12

    2. Cross Over Cable:

    In cross over cable, some of the wires on one side of the cable are crossed to different pin on the

    other side of the cable. Pin 1 on one end is connected to the pin 3 on the other end. Pin 2 on one end is

    connected to pin 6 on other end.

    Use crossover cables for the following cabling:

    Switch to switch

    Switch to hub

    Hub to hub

    Router to router

    PC to PC

    Router to PC

  • 7/24/2019 Computer Networks Lab Manual

    13/61

    13

    3. Roll Over Cable:

    The cable used between a terminal and a console port is a rollover cable

    The rollover cable, also known as a console cable, has a different pin out than the straight-

    through or crossover RJ-45 cables.

    This cable is typically flat to distinguish it from the others.

    As the name specifies the pinouts on one end are literally rolled over on the other end.

    Result:

    Thus the networking cables were studied and tested.

  • 7/24/2019 Computer Networks Lab Manual

    14/61

    14

    Ex No:4

    PC TO PC COMMUNICATION USING SERIAL/PARALLEL ADAPTER

    Aim:

    To transfer the file between the two computers serially using Serial/Parallel adapter

    connection.

    Theory:

    In serial communication, one bit follows another and so we need only one communication channel

    rather than transmit data having two communication channels. The main advantage of serial

    communication is that it reduces the cost of transmission over parallel communication by a factor h.

    PROCEDURE:

    Step 1 :Select Start All programsVi-Rt simulator

    Transmitter:

    Step 2: Open PC to PCFile transfer and select Transmitter

    Step 3: Add IPaddress of receiver system and click connect.

    Step 4: once connected select a file to be transmitted and send file.

    Receiver:

    Step 5: Choose startall programsViRtSim

    Step 6: Choose PC to PC file transfer and select receiver

    Step 7: Save the file once received from its transmitter.

    D0 D1 D2 D3 D4 D5 D6 D7 S1 S2 S3 S4 S5

    D0 D1 D2 D3 D4 D5D6D7 S1 S2 S3 S4 S5

    Parallel port

    Parallel port

    Serial portSerial port

  • 7/24/2019 Computer Networks Lab Manual

    15/61

    15

    Transmitter Windows:

    Step 1: Connect Transmitter:

    Step 2: Select file to be sent:

  • 7/24/2019 Computer Networks Lab Manual

    16/61

    16

    Receiver Window:

    Step 1: Connect receiver:

    Step 2: Save received File:

  • 7/24/2019 Computer Networks Lab Manual

    17/61

    17

    Step 3: Check saved file in specified destination:

    Result:

    Thus the file was transmitted from one PC to another PC using serial parallel adapter.

  • 7/24/2019 Computer Networks Lab Manual

    18/61

    18

    Ex No:5

    PC TO PC COMMUNICATION USING SWITCH

    Aim:

    To view, transfer and operate on files that can be shared between two systems in a network

    connected through switch.

    Theory:

    A network switch is a small hardware device that connects multiple computers together with a

    LAN. Network switches generally have more intelligence than a hub. Switches are capable of interpreting

    and inspecting data packets as they are received, determining the source and destination code and thus

    forwarding them appropriately. By delivering messages only to the connected device indeed a network

    switch conserves bandwidth and offers generally better performance than a hub.

    Procedure:

    Step 1: Initially find out the IP address of the respective systems which communicate through the switch

    using the ipconfig commandStep 2: Test the connectivity of the systems to be communicating through the switch using ping command

    Step 3: Enable the sharing rights of the folders/files which are to be shared between the systems

    communicating through the switch

    Step 4: Run the command < IP address > of the system to be shared in order to access the sharable

    folders and files.

    Connection Between Two Systems Through Switch

    System 1 System 2

    Switch

    Console cable

    Strai ht throu h cable

  • 7/24/2019 Computer Networks Lab Manual

    19/61

    19

    Step 1: self ping system 1:

    Step 2: self ping system 2:

  • 7/24/2019 Computer Networks Lab Manual

    20/61

    20

    Step 3: testing connectivity between system 1 and system 2:

    Step 4: Enabling sharing:

  • 7/24/2019 Computer Networks Lab Manual

    21/61

    21

    Shared folders:

  • 7/24/2019 Computer Networks Lab Manual

    22/61

    22

    Step 5: Run the command < IP address> of the other system:

    Step 6: Access the sharable folders of the other system:

    Result:

    Thus PC to PC communication using switch was performed.

  • 7/24/2019 Computer Networks Lab Manual

    23/61

    23

    Ex No: 6

    SECURED DATA TRANSFER USING SERIAL/PARALLEL ADAPTER

    Aim:

    To transfer the Encrypted Data between the two computers serially using Serial/Parallel

    adapter connection and decrypt the same at the receiver using ViRtSim software.

    Theory:

    Network security involves four aspects: privacy, message authentication, message integrity and

    non-repudiation. Privacy means that the sender and the receiver expect confidentiality. The transmitted

    message should make sense only to the intended receiver. Authentication means that the receiver is sure of

    the senders identity and that an imposter has not sent the message. Integrity means that the data must

    arrive at the receiver exactly as it was sent. Non-repudiation means that a receiver must be able to prove

    that a received message came from a specific sender.

    Privacy is achieved by encrypting the message at the sender and decrypting the received

    message at the receiver. The data to be encrypted at the sender site is called plaintext/clear text. Theencrypted data is called cipher text.

    Procedure:

    Transmitter:

    Step 1: Choose startall programsViRtSim

    Step 2: Choose serial and parallel communication RS232 data securitydata encryption

    Step 3: Connect the transmitter and enter the data to be sent.

    Step 4: Send the data after entering the password

    Receiver:

    Step 1: Choose startall programsViRtSim

    Step 2: Choose serial and parallel communication RS232 data securitydata decryption

    Step 3: Connect the receiver

    Step 4: Decrypt the received data and enter the password

    Step 5: Check the original message.

  • 7/24/2019 Computer Networks Lab Manual

    24/61

    24

    Step 1: Connect transmitter:

    Step 2: Enter data to be encrypted:

  • 7/24/2019 Computer Networks Lab Manual

    25/61

    25

    Step 3: Encrypt the data:

    Receiver:

    Step 1: Connect the receiver:

  • 7/24/2019 Computer Networks Lab Manual

    26/61

    26

    Step 2: Received Data:

    Step 3: Decrypt the data:

  • 7/24/2019 Computer Networks Lab Manual

    27/61

    27

    Step 4: Original data received:

    Step 5: Wrong password entered:

  • 7/24/2019 Computer Networks Lab Manual

    28/61

    28

    Step 5: Wrong clear text decrypted:

    Result:

    Thus the encrypted data was transmitted serially and decrypted at the receiver.

  • 7/24/2019 Computer Networks Lab Manual

    29/61

    29

    Ex No:7

    SIMULATION OF TOKEN RING PROTOCOL

    Aim:

    To simulate the token ring protocol using ViRtSim software and study its characteristics.

    Theory:

    Token ring resolves the uncertainty of occurrence of collisions or delays produced by multiple

    stations attempting to capture the link at the same time. Each station may transmit only during its turn and

    may send only one frame during its turn. This mechanism is called Token passing. Whenever the network

    is free it transmits a 3 byte token which is a simple placeholder frame that passes from NIC to NIC in

    sequence until it encounters a station with data to send. The station holds the token and sends the data

    which is checked by each station on the ring. Each station checks the destination address, regenerates the

    frame if a match is not found. The intended receiver receives the data and sends an acknowledgement

    frame to the sender. The sender releases the token to the ring after receiving the acknowledgement frame.

    Transmitting data

    A

    B D

    C

    Data1

    Token Held

    Denied

    Denied

    Data 1 received

    Token passing

    A

    B D

    C

    Token

  • 7/24/2019 Computer Networks Lab Manual

    30/61

    30

    Procedure:

    Step 1: Select programViRtSimSimulationToken Ring

    Step 2: Enter the program, save and run it

    Algorithm:

    Step 1: declare a frame variable and assign it the data frame to be transmitted.

    Step 2: declare a token variable.

    Step 3: call the bus function to initialize the ring topology based network.

    Step 4: call the construct logical ring function to create a network with four devices.

    Step 5: start to pass the token in the ring.

    Step 6: check if node B wants to transmit data. If node B wants to transmit data repeat the process of

    capturing the token until captured.

    Step 7: once token is captured node B transmits data. The intended receiver receives data and sends an

    acknowledge. Once acknowledge reaches node B, it releases the token on to the ring.Step 8: Stop passing token.

    Program:

    include

    void main()

    {

    Frame X;

    Token t;

    X = Data 1;

    RING_TOPOLOGY();

    CONSTRUCT_LOGICAL RING();

    START TOKEN_PASSING(t);

    WANT TO_TRANSMIT(A);

    repeat

    r = TOKEN_CAPTURE(A);

    until(r);

    TRANSMIT_DATA(A,C,X);

    STOP TOKEN_PASSING();

    }

  • 7/24/2019 Computer Networks Lab Manual

    31/61

    31

    Step 1: Enter The Program, Save, Run:

    Step 2: Station A receives Token:

  • 7/24/2019 Computer Networks Lab Manual

    32/61

    32

    Step 3: Station C receives Data and Sends Acknowledge:

    Result:

    Thus the token ring protocol was simulated using ViRtSim software and its characteristics were

    studied.

  • 7/24/2019 Computer Networks Lab Manual

    33/61

    33

    Ex. No: 8

    SIMULATION OF TOKEN BUS PROTOCOL

    Aim:

    To simulate the token bus protocol using ViRtSim software and study its characteristics.

    Theory:

    The token bus protocol uses token passing access control and a physical or logical bus topology.

    In token passing systems a small data frame(token) is passed in an orderly fashion from one device to

    another. A token is a special message that temporarily gives media control to the device holding the token.

    Passing the token around distributes access control among the networks devices. Each device knows from

    which device it receives the token and to which device the token should be passed. Each device

    periodically gets control of the token, performs its duties and retransmits the token for the next device to

    use. Protocols limit how long each device can control the token.

    Procedure:

    Step 1: Select programViRtSimSimulationToken Bus

    Step 2: Enter the program, save and run it

    B

    Token held

    A

    C

    D

    Data Transmit

    Data 1

    Denied

    Denied

    B

    A

    C

    D

    Token

    Token Passing

  • 7/24/2019 Computer Networks Lab Manual

    34/61

    34

    Algorithm:

    Step 1: declare a frame variable and assign it the data frame to be transmitted.

    Step 2: declare a token variable.

    Step 3: call the bus function to initialize the ring topology based network.

    Step 4: call the construct logical ring function to create a network with four devices.

    Step 5: start to pass the token in the ring.

    Step 6: check if node B wants to transmit data. If node B wants to transmit data repeat the process of

    capturing the token until captured.

    Step 7: once token is captured node B transmits data. The intended receiver receives data and sends an

    acknowledge. Once acknowledge reaches node B, it releases the token on to the ring.

    Step 8: Stop passing token.

    Program:

    include

    void main()

    {

    Frame X;

    Token t;

    X = Data 1;

    BUS_TOPOLOGY();;

    CONSTRUCT_LOGICAL RING();

    START TOKEN_PASSING(t);

    WANT TO_TRANSMIT(B);

    repeat

    r = TOKEN_CAPTURE(B);

    until(r);

    TRANSMIT_DATA(B,C,X);

    STOP TOKEN_PASSING();

    }

  • 7/24/2019 Computer Networks Lab Manual

    35/61

    35

    Step 1: Enter The Program, Save, Run:

    Step 2: Station B sends Token:

  • 7/24/2019 Computer Networks Lab Manual

    36/61

    36

    Step 3: Station C receives Data and Sends Acknowledge:

    Result:

    Thus the token bus protocol was simulated using ViRtSim software and its characteristics was

    studied.

  • 7/24/2019 Computer Networks Lab Manual

    37/61

    37

    Ex. No: 9

    SIMULATION OF CSMA/CD

    Aim:

    To simulate the CSMA/CD protocol using ViRtSim software and study its characteristics.

    Theory:

    Carrier sense multiple access is a network access method used on shared network topologies such

    as Ethernet to control access to the network. Devices attached to the network cable listen(carrier sense)

    before transmitting. If the channel is in use, devices wait before transmitting. Multiple access indicates that

    many device can connect to and share the same network. All devices have equal access to use the network

    when it is clear.

    Collision detection defines what happens when two devices sense a clear channel, then attempt to

    transmit at the same time. A collision occurs and both devices stop transmission, wait for a random amount

    of time and then retransmit. This is the technique used to access the 802.3 Ethernet network channel. This

    method handles collision as they occur, but if the bus is constantly busy, collision can occur so often thatthe performance drops drastically.

    Collision in a network

    After specified interval

    A B

    C

    Data to B

    A B

    C

    Data to B

    Data tocollision

  • 7/24/2019 Computer Networks Lab Manual

    38/61

    38

    Algorithm:

    Step 1: declare two frame variables and assign them the data frames to be transmitted.

    Step 2: initialize the CSMA/CD function.

    Step 3: send data from node A to node B and sense multiple access.

    Step 4: send data from node B to node C and sense multiple access.

    Step 5: check if collision occurs.

    Step 6: if collision occurs wait for 1000ms and then retransmit the two data from the nodes one after the

    other.

    Step 8: Stop the execution.

    Procedure:

    Step 1: Select programViRtSimSimulationCSMACSMA/CD

    Step 2: Enter the program, save and run it

    Program:include

    void main()

    {

    Frame X,Y;

    X="data1";

    Y="data2";

    CSMACD_INIT();

    CSMACD_START();

    CSMA_SEND(B,A,X);

    CSMA_SEND(A,C,Y);

    R=COLLISION_OCCUR();

    if(R)

    {

    WAIT(1000);

    RETRANSMIT(B,A);

    RETRANSMIT(A,C);

    }

    }

    A B

    C

    Data to C

  • 7/24/2019 Computer Networks Lab Manual

    39/61

    39

    Step 1: Two Stations Transmit data simultaneously:

    Step 2: Occurrence of Collision:

  • 7/24/2019 Computer Networks Lab Manual

    40/61

    40

    Step 3: Retransmit from Station B to Station A:

    Step 4: Retransmit from Station A to Station C:

    Result:

    Thus the CSMA/CD protocol was simulated using ViRtSim software and its characteristics was

    studied.

  • 7/24/2019 Computer Networks Lab Manual

    41/61

    41

    Ex. No: 10

    SIMULATION OF CSMA/CA

    Aim:

    To simulate the CSMA/CA protocol using ViRtSim software and study its characteristics.

    Theory:

    Carrier sense multiple access is a network access method used on shared network topologies such

    as Ethernet to control access to the network. Devices attached to the network cable listen(carrier sense)

    before transmitting. If the channel is in use, devices wait before transmitting. Multiple access indicates that

    many device can connect to and share the same network. All devices have equal access to use the network

    when it is clear.

    Collision Avoidance defines what happens when two devices sense a clear channel, then attempt

    to transmit at the same time. A collision occurs and both devices stop transmission, wait for a random

    amount of time and then retransmit. This is the technique used to access the 802.3 Ethernet network

    channel. This method handles collision as they occur, but if the bus is constantly busy, collision can occurso often that the performance drops drastically.

    Request to send (RTS) sent to A

    Clear to send (CTS) sent to A

    A B

    C

    CT

    A B

    C

    RT

  • 7/24/2019 Computer Networks Lab Manual

    42/61

    42

    Data transmitted to B

    Acknowledge (ACK) sent to A

    Algorithm:

    Step 1: declare a frame variable and assign them the data frame to be transmitted.

    Step 2: initialize the CSMA/CA function

    Step3: Nodes keep listening to the channel

    Step 4: send request to send frame from node A to node B

    Step 5: send clear to send frame from node B to node A

    Step 6: send data from node A to node B and sense multiple access.

    Step 7: send acknowledge frame from node B to node A

    Step 8: Stop the execution.

    Program:

    include

    void main()

    {

    Frame X;

    X="data1";

    CSMACA_INIT();

    CSMACA_START();

    NODE_LISTEN();

    REQUESTTO_SEND(A,B);

    CLEARTO_SEND(B,A);

    DATATO_SEND(A,B,X);

    ACKNOWLEDGE(B,A);

    }

    A B

    C

    ACK

    A B

    C

    Data

  • 7/24/2019 Computer Networks Lab Manual

    43/61

    43

    Procedure:

    Step 1: Select programViRtSimSimulationCSMACSMA/CA

    Step 2: Enter the program, save and run it

    Step 1: Node A sends RTS frame to node B:

    Step 2: Node B sends CTS frame to node A:

  • 7/24/2019 Computer Networks Lab Manual

    44/61

    44

    Step 3: Node A sends data frame to node B:

    Step 3: Node B sends ACK frame to node A:

    Result:

    Thus the CSMA/CA protocol was simulated using ViRtSim software and its characteristics was

    studied.

  • 7/24/2019 Computer Networks Lab Manual

    45/61

    45

    Ex. No: 11

    SIMULATION OF RING TOPOLOGY USING LAN TRAINER KIT

    Aim:

    To simulate the ring topology using LAN trainer kit and study its characteristics.

    Theory:

    In ring topology, each device has a dedicated point to point line configuration with the two devices

    on either side of it. A signal is passed along the ring in one direction from device to device until it reaches

    its destination. Each device in the ring incorporates a repeater. When a device receives a signal intended for

    another device its repeater regenerates the bit and passes them along unidirectional traffic.

    VI LAN TRAINER KIT RING TOPOLOGY

    Procedure:

    Step 1: Switch on the LAN trainer kit and give connections as shown in the block diagram. The NIC 1 is

    placed in programming mode.

    Step 2: select ViRtSim in the PC and then the utilities.

    Step 3: select ARM downloader and click read device ID.

    Step 4: reset the NIC 1 and then the device ID will be read successfully.

    Step 5: to load the ARM processor, select the respective hex bit file and click load flash.

    Step 6: to load the FPGA processor, go to Start all programs Xilinx Accessories and click on

    IMPACT

    Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file and load the

    FPGA chipStep 8: when program is successfully loaded switch the kit to execution mode and reset.

    Step 9: Select on the ViRtSim window PC to PCPing. Enter the host information and test the

    connectivity.

    Step 10: OSI LAN TRAINERTopologyRing

    Step 11: Connect the PC with the kit and send the data

    Step 12: once data reaches the destination stop the execution.

    NIC1 NIC2 NIC3

    Node A

    Node

    Node C

    Node

  • 7/24/2019 Computer Networks Lab Manual

    46/61

    46

    Result:

    Thus ring topology was implemented and simulated using VI-LAN trainer kit and ViRtSim

    software.

  • 7/24/2019 Computer Networks Lab Manual

    47/61

    47

    Ex. No: 12

    SIMULATION OF BUS TOPOLOGY USING LAN TRAINER KIT

    Aim:

    To simulate the bus topology using LAN trainer kit and study its characteristics.

    Theory:

    The bus topology connects each station on the network into something called the

    segment trunk. A bus is usually referred to a cable that connects end to end and this is used to transmit the

    signals from one end to the other end. At every end a terminator is placed so that it understands in which

    direction the data is travelling and also terminator is used to absorb the signals. If the terminator does not

    absorb the signal then the same signal is reflected back to the bus confusing the whole data flow.

    VI LAN TRAINER KIT BUS TOPOLOGY

    Procedure:

    Step 1: Switch on the LAN trainer kit and give connections as shown in the block diagram. The NIC 1 is

    placed in programming mode.

    Step 2: select ViRtSim in the PC and then the utilities.

    Step 3: select ARM downloader and click read device ID.

    Step 4: reset the NIC 1 and then the device ID will be read successfully.

    Step 5: to load the ARM processor, select the respective hex bit file and click load flash.

    Step 6: to load the FPGA processor, go to Start all programs Xilinx Accessories and click on

    IMPACT

    Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file and load theFPGA chip

    Step 8: when program is successfully loaded switch the kit to execution mode and reset.

    Step 9: Select on the ViRtSim window PC to PCPing. Enter the host information and test the

    connectivity.

    Step 10: OSI LAN TRAINERTopologybus

    Step 11: Connect the PC with the kit and send the data

    Step 12: once data reaches the destination stop the execution.

    NIC1

    NIC2 NIC3

    Node A

    Node DNode CNode B

    Rx

    Tx

  • 7/24/2019 Computer Networks Lab Manual

    48/61

    48

    Result:

    Thus bus topology was implemented and simulated using VI-LAN trainer kit and ViRtSim

    software.

  • 7/24/2019 Computer Networks Lab Manual

    49/61

    49

    Ex. No: 13

    SIMULATION OF STAR TOPOLOGY USING LAN TRAINER KIT

    Aim:

    To simulate the star topology using LAN trainer kit and study its characteristics.

    Theory:

    In a star topology each device has a dedicated point to point link only to a central controller,

    usually called hub. The devices are not directly linked to each other. Unlike a mesh topology a star

    topology does not allow direct traffic between devices. The controller acts as an exchange, it sends the data

    to the controller which then relays the data to the other connected device. Its advantage includes robustness.

    If one link fails only that link is affected and all other link remain active.

    VI LAN TRAINER KIT STAR TOPOLOGY

    Procedure:

    Step 1: Switch on the LAN trainer kit and give connections as shown in the block diagram. The NIC 1 is

    placed in programming mode.

    Step 2: select ViRtSim in the PC and then the utilities.

    Step 3: select ARM downloader and click read device ID.

    Step 4: reset the NIC 1 and then the device ID will be read successfully.

    Step 5: to load the ARM processor, select the respective hex bit file and click load flash.

    Step 6: to load the FPGA processor, go to Start all programs Xilinx Accessories and click on

    IMPACT

    Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file and load the

    FPGA chip

    Step 8: when program is successfully loaded switch the kit to execution mode and reset.

    Step 9: Select on the ViRtSim window PC to PCPing. Enter the host information and test the

    connectivity.

    NIC1 NIC2 NIC3

    Node A

    Node DNode CNode B

  • 7/24/2019 Computer Networks Lab Manual

    50/61

    50

    Step 10: OSI LAN TRAINERTopologyStar

    Step 11: Connect the PC with the kit and send the data

    Step 12: once data reaches the destination stop the execution.

    Result:

    Thus star topology was implemented and simulated using VI-LAN trainer kit and ViRtSim software.

  • 7/24/2019 Computer Networks Lab Manual

    51/61

    51

    Ex. No: 14

    IMPLEMENTATION OF STOP AND WAIT PROTOCOL

    Aim:

    To implement and test the stop and wait protocol using LAN trainer kit and ViRtSim.

    Theory:

    Stop and wait protocol is an efficient way of dealing errors during transmission. The stop and wait

    protocol stops the transmission of packets when the loss of data or any other error causes a negative

    acknowledgement to reach the transmitting computer (ie) the transmitting computer waits for a kind of

    acknowledgement from the receiving computer. If the receiving computer acknowledges the sent data, the

    transmitting computer sends the next data. If the receiver sends a negative acknowledgement then the

    transmitter retransmits the data. This way the transmission is reliable.

    Procedure:

    Step 1: Connect the master/server to the computer NIC port.

    Step 2: Select ViRtSim in the PC and then the utilities.

    Step 3: Select ARM downloader and click read device ID.

    Stop and Wait

    Node

    A

    Node

    B

    Node Node

    Node Node

    1

    AC

    Node Node2

    Node NodeNAC

    Node Node2

    Node NodeAC

    Node Node3

    Node NodeAC

  • 7/24/2019 Computer Networks Lab Manual

    52/61

    52

    Step 4: Reset the NIC 1 and then the device ID will be read successfully.

    Step 5: To load the ARM processor, select the respective hex bit file and click load flash.

    Step 6: To load the FPGA processor, go to Start all programs Xilinx Accessories and click on

    IMPACT

    Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file and load the

    FPGA chip

    Step 8: When program is successfully loaded switch the kit to execution mode and reset.

    Step 9: Select on the ViRtSim window PC to PCPing. Enter the host information and test the

    connectivity.

    Step 10: OSI LAN TRAINERProtocolStop and wait

    Step 11: Connect the PC with the kit and send the data

    Step 12: While transmitting, enter the error by deleting the error bit - .

    Step 13: A NAK frame will be transmitted to the sender and transmission will be stopped.

    Step 14: The error is then removed by reentering the error bit -. The transmission is resumed.

    Step 15: Once data reaches the destination stop the execution.

    Result:

    Thus stop and wait protocol was implemented and simulated using VI-LAN trainer kit and

    ViRtSim software.

  • 7/24/2019 Computer Networks Lab Manual

    53/61

    53

    Ex. No: 15

    IMPLEMENTATION OF GO BACK - N PROTOCOL

    Aim:

    To implement and test the Go back - N protocol using LAN trainer kit and ViRtSim.

    Theory:

    In Go back N protocol if one frame is damaged or lost, all frames sent since the lost frame

    acknowledged are retransmitted. The receiver sends an acknowledgement frame for a group of data frames.

    Only one acknowledgement is enough for a group of transmitted data. In case of lost data frames the

    transmitter sends a negative acknowledgement with data frame that is damaged or lost. Once sender

    receives a NAQ, it retransmits data. If there is a repetition the receiver discards one of the data.

    Procedure:

    Step 1: Connect the master/server to the computer NIC port.

    Step 2: Select ViRtSim in the PC and then the utilities.

    Step 3: Select ARM downloader and click read device ID.Step 4: Reset the NIC 1 and then the device ID will be read successfully.

    Step 5: To load the ARM processor, select the respective hex bit file and click load flash.

    Step 6: To load the FPGA processor, go to Start all programs Xilinx Accessories and click on

    IMPACT

    Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file and load the

    FPGA chip

    Step 8: When program is successfully loaded switch the kit to execution mode and reset.

    Step 9: Select on the ViRtSim window PC to PCPing. Enter the host information and test the

    connectivity.

    Step 10: OSI LAN TRAINERProtocolGo back-N

    Step 11: Connect the PC with the kit and send the data

    Step 12: While transmitting, enter the error by pressing the error button on the LAN kit as many times as

    the number of frames in the data.

    Step 13: A NAK frame will be transmitted to the sender and transmission will be stopped.

    Step 14: The transmission is resumed when the data is again sent.

    Step 15: Once data reaches the destination stop the execution.

  • 7/24/2019 Computer Networks Lab Manual

    54/61

    54

    Result:

    Thus Go back-N protocol was implemented and simulated using VI-LAN trainer kit and ViRtSim

    software.

  • 7/24/2019 Computer Networks Lab Manual

    55/61

    55

    Ex. No: 16

    IMPLEMENTATION OF DISTANCE VECTOR ROUTING

    Aim:

    To implement and test the distance vector routing using ViRtSim.

    Theory:

    In distance vector routing each router shares its knowledge about the entire network with

    information from its neighbors in a step by step procedure. Once this is complete it will have a complete

    idea about the network. The table consists of network ID, cost and next hop. The cost refers to the number

    of hop count(least) to reach a particular destination. Routers using distance-vector algorithms send all or

    part of their routing table entries to adjacent routers on a periodic basis. This happens even if there are no

    changes in the network. By receiving a routing update, a router can verify all the known routes and make

    changes to its routing table. This process is also known as routing by rumor. The understanding that a

    router has of the network is based upon the perspective of the adjacent router of the network topology

    Procedure:

    Step 1: open ViRtSim and select simulation

    Distance Vector RoutingStep 2: design the required network by including the routers, links and corresponding weights on the links.

    Step 3: select the sender and destination node and click the Find Path.

    Step 4: Click the Calculate button which displays all the route details and shows the shortest route.

    Step 1: Design The Required Network:

  • 7/24/2019 Computer Networks Lab Manual

    56/61

  • 7/24/2019 Computer Networks Lab Manual

    57/61

    57

    Ex. No: 17

    IMPLEMENTATION OF LINK STATE ROUTING

    Aim:

    To implement and test the link state routing using ViRtSim.

    Theory:

    In link state routing every router shows its knowledge about its neighbor to the entire network and

    ultimately all routers will have a routing table within the link state database. Link-state routing protocols

    respond quickly to network changes sending trigger updates only when a network change has occurred.

    Link-state routing protocols send periodic updates, known as link-state refreshes, at longer time intervals,

    such as every 30 minutes. When a route or link changes, the device that detected the change creates a link-

    state advertisement (LSA) concerning that link. The LSA is then transmitted to all neighboring devices.

    Each routing device takes a copy of the LSA, updates its link-state database, and forwards the LSA to all

    neighboring devices. This flooding of LSAs is required to ensure that all routing devices create databases

    that accurately reflect the network topology before updating their routing tables.Procedure:

    Step 1: open ViRtSim and select simulation Link State Routing

    Step 2: design the required network by including the routers and links.

    Step 3: select the sender and destination node and click the Find Path.

    Step 4: Click the Calculate button which displays all the route details and shows the shortest route.

    Step 1: Design The Required Network:

  • 7/24/2019 Computer Networks Lab Manual

    58/61

    58

    Step 2: Available Paths:

    Step 3: Shortest Path:

    Result:

    Thus the link state routing algorithm was implemented and simulated using ViRtSim software.

  • 7/24/2019 Computer Networks Lab Manual

    59/61

    59

    Ex. No: 18

    CLIENT-SERVER COMMUNICATION USING SWITCH

    Aim:

    To transfer a .exe file between two computers through switch.

    Procedure:

    Step 1: Select StartVisual studio 6.0 VC++

    Step 2: Open a new project and new C++ source file

    Step 3: Enter the program, save and link wsock32.lib file in the project settings

    Step 4: Compile and execute the project in the server and then in the client

    Step 5: Check the received file in the specified destination in the server system.

    Program:

    Server:

    #include

    #include#include

    #include

    #include

    SOCKET Listen();

    void main()

    {

    WORD version;

    WSADATA wsa;

    SOCKET CommSock;

    char fil[512];

    version=MAKEWORD(1,1);

    WSAStartup(version,&wsa);

    CommSock = Listen();

    FILE *fout=fopen("d:\\2.rar","wb");

    int count = 0;

    while(count=recv(CommSock,fil,sizeof(fil),0))

    {

    if(strcmp(fil,"FINAL")==0)

    {

    fclose(fout);

    exit(0);

    }

    fwrite(fil,1,count,fout);

    }

  • 7/24/2019 Computer Networks Lab Manual

    60/61

    60

    }

    SOCKET Listen()

    {

    SOCKADDR_IN ServAddr;

    SOCKET ServSock = socket(AF_INET,SOCK_STREAM,0),clisock;

    ServAddr.sin_family = AF_INET;

    ServAddr.sin_port = htons(3000);

    ServAddr.sin_addr.s_addr = INADDR_ANY;

    bind(ServSock,(LPSOCKADDR)& ServAddr,sizeof(struct sockaddr));

    listen(ServSock,4);

    SOCKADDR_IN cliaddr;

    int sin_size = sizeof(struct sockaddr_in);clisock=accept(ServSock,(LPSOCKADDR) &cliaddr, &(sin_size));

    return(clisock);

    }

    Client:

    #include

    #include

    #include

    #include

    SOCKET Connect(char*);

    void main()

    {

    WORD version;

    WSADATA wsa;

    version = MAKEWORD(1,1);

    WSAStartup (version,&wsa);

    SOCKET CommSock;

    CommSock = Connect("11.1.1.2");

    int fd=open("d:\\ccc.txt.exe",O_RDONLY);

    long int size=0;

    size=lseek(fd,0L,SEEK_END);

    printf("%d",size);

    char fil[512];

    close(fd);

  • 7/24/2019 Computer Networks Lab Manual

    61/61

    61

    FILE *fr=fopen("d:\\ccc.txt","rb");

    long int temp=0;

    long count=size/512;

    while(temp