95
Computer Network Lab Computer Network Lab TE (COMPUTER ENGINEERING) Semester - V Laboratory Manual Department of Computer Engineering R. C. Patel Institute of Technology, Shirpur Page 1

Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Computer Network Lab

TE (COMPUTER ENGINEERING) Semester - V

Laboratory Manual

Department of Computer EngineeringR. C. Patel Institute of Technology, Shirpur

R. C. Patel Institute of Technology, Shirpur Page 1

Page 2: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

VISION&MISSIONInstitute

Vision: To achieve excellence in engineering education with

strong ethical values.Mission:To impart high quality Technical Education through:

Innovative and Interactive learning process and high quality instructional programs.

Fostering a scientific temper among students by means of a liaison with the Academia, Industries and Government.

Preparing students from diverse backgrounds to have attitude for research and spirit of Professionalism.

Inculcating in students a respect for fellow human beings and responsibility towards the society.

Computer Engineering DepartmentVision:

To provide prominent computer engineering education with socio-moral values.

Mission: To groom students to become professionally and

ethically sound computer engineers to meet the growing needs of industry and society.

R. C. Patel Institute of Technology, Shirpur Page 2

Page 3: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

The Shirpur Education Society’s

R. C. Patel Institute of Technology, Shirpur

CERTIFICATEThis is to certify that Mr. / Miss. ________________________________of Third Year Computer Engineering, Roll No. ______has performed practical work satisfactorily in the subject Computer Network Lab, in the Department of Computer Engineering during the academic year 20__ 20__.

Date: / / 20 Subject InchargePlace: Shirpur

Principal Head of Department

R. C. Patel Institute of Technology, Shirpur Page 3

Page 4: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

CONTENTS

Expt. No Experiment Title Page No

1 Implementation of Character count/Bit-Stuffing/Byte stuffing framing methods. 6

2 Implementation of Dijkastra’s Shortest Path Network routing algorithm. 11

3 Implementation of TCP checksum. 15

4 Socket programming for TCP. 18

5 Socket programming for UDP. 29

6 Encryption/Decryption using XOR symmetric-key cryptography algorithm. 37

7 Encryption /Decryption using RSA asymmetric-key cryptography algorithm. 40

8 Implementation of RLE data compression algorithm. 44

9 Introduction to Cisco Packet Tracer. 47

10 Implementation of Ethernet LAN simulation 57

11 Simulate the Point to Point wired networks. 65

12 Designing and implementing Class A, B, and C Networks. 70

R. C. Patel Institute of Technology, Shirpur Page 4

Page 5: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 01

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 5

Page 6: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.1TITLE: Implementation of Character count/Bit-Stuffing/Byte stuffing framing methods.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Turbo C++ 4.0 or later

THEORY:

The Data Link Layer is the second layer in the OSI model, above the Physical Layer, ensures that the error free data is transferred between the adjacent nodes in the network. It breaks the datagrams passed down by above layers and convert them into frames ready for transfer. This is called Framing. It provides two main functionalities.

Reliable data transfer service between two peer network layers Flow Control mechanism which regulates the flow of frames such that

data congestion is not there at slow receivers due to fast senders. What is framing?Since the physical layer merely accepts and transmits a stream of bits without any regard to meaning or structure, it is up to the data link layer to create and recognize frame boundaries. This can be accomplished by attaching special bit patterns to the beginning and end of the frame. If these bit patterns can accidentally occur in data, special care must be taken to make sure these patterns are not incorrectly interpreted as frame delimiters. The four framing methods that are widely used are

Character count Starting and ending characters, with character stuffing

R. C. Patel Institute of Technology, Shirpur Page 6

Page 7: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Starting and ending flags, with bit stuffing Physical layer coding violations

Character CountThis method uses a field in the header to specify the number of characters in the frame. When the data link layer at the destination sees the character count, it knows how many characters follow, and hence where the end of the frame is. The disadvantage is that if the count is garbled by a transmission error, the destination will lose synchronization and will be unable to locate the start of the next frame. So, this method is rarely used.

Figure 1: Character Count

Character stuffingIn the second method, each frame starts with the ASCII character sequence DLE STX and ends with the sequence DLE ETX.(where DLE is Data Link Escape, STX is Start of TeXt and ETX is End of TeXt.) This method overcomes the drawbacks of the character count method. If the destination ever loses synchronization, it only has to look for DLE STX and DLE ETX characters. If however, binary data is being transmitted then there exists a possibility of the characters DLE STX and DLE ETX occurring in the data. Since this can interfere with the framing, a technique called character stuffing is used. The sender's data link layer inserts an ASCII DLE character just before the DLE character in the data. The receiver's data link layer removes this DLE before this data is given to the network layer. However character stuffing is closely

R. C. Patel Institute of Technology, Shirpur Page 7

Page 8: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

associated with 8-bit characters and this is a major hurdle in transmitting arbitrary sized characters.

Figure 2: Character stuffing

Bit stuffingThe third method allows data frames to contain an arbitrary number of bits and allows character codes with an arbitrary number of bits per character. At the start and end of each frame is a flag byte consisting of the special bit pattern 01111110. Whenever the sender's data link layer encounters five consecutive 1s in the data, it automatically stuffs a zero bit into the outgoing bit stream. This technique is called bit stuffing. When the receiver sees five consecutive 1s in the incoming data stream, followed by a zero bit, it automatically destuffs the 0 bit. The boundary between two frames can be determined by locating the flag pattern.

Figure 3: Bit Stuffing

R. C. Patel Institute of Technology, Shirpur Page 8

Page 9: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

STANDARD INPUT AND OUTPUT:

CONCLUSION / RESULT:In this Experiment, we have Implemented of Character count framing method.

R. C. Patel Institute of Technology, Shirpur Page 9

Page 10: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 02

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 10

Page 11: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.2

TITLE: Implementation of Dijkastra’s Shortest Path Network routing algorithm.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Turbo C++ 4.0 or later

THEORY:

It is a static routing algorithm. It is used to build a graph of the subnet, with each node of graph representing a router and each arc of the graph representing a communication line. To choose a route between a given pair of routers, the algorithm just finds the shortest path between them on the graph. Different ways of measuring the path length is the number of Hops, Geographical distance in kmts, Mean Queuing delay, Transmission delay, Functions of distance, Bandwidth, Average traffic, communication cost etc., Several algorithms for computing the shortest path between two nodes of a graph are known. This one is due to Dijkstra (1959). Each node is labeled (in parentheses) with its distance from the source node along the best known path. Initially, no paths are known, so all nodes are labeled with infinity. As the algorithm proceeds and paths are found, the labels may change, reflecting better paths. A label may be either tentative or permanent. Initially, all labels are tentative. When it is discovered that a label represents the shortest possible path from the source to that node, it is made permanent and never changed thereafter.

R. C. Patel Institute of Technology, Shirpur Page 11

Page 12: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 1: The first five steps used in computing the shortest path from A to D. The arrows indicate the working node

To illustrate how the labeling algorithm works, look at the weighted, undirected graph of Fig. (a), where the weights represent, for example, distance. We want to find the shortest path from A to D. We start out by marking node A as permanent, indicated by a filled-in circle. Then we examine, in turn, each of the nodes adjacent to A (the working node), relabeling each one with the distance to A. Whenever a node is relabeled, we also label it with the node from which the probe was made so that we can reconstruct the final path later. Having examined each of the nodes adjacent to A, we examine all the tentatively labeled nodes in the whole graph and

R. C. Patel Institute of Technology, Shirpur Page 12

Page 13: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

make the one with the smallest label permanent, as shown in Fig. (b). This one becomes the new working node.

We now start at B and examine all nodes adjacent to it. If the sum of the label on B and the distance from B to the node being considered is less than the label on that node, we have a shorter path, so the node is relabeled. After all the nodes adjacent to the working node have been inspected and the tentative labels changed if possible, the entire graph is searched for the tentatively-labeled node with the smallest value. This node is made permanent and becomes the working node for the next round. Figure shows the first five steps of the algorithm.

To see why the algorithm works, look at Fig. (c). At that point we have just made E permanent. Suppose that there were a shorter path than ABE, say AXYZE. There are two possibilities: either node Z has already been made permanent, or it has not been. If it has, then E has already been probed (on the round following the one when Z was made permanent), so the AXYZE path has not escaped our attention and thus cannot be a shorter path.

Now consider the case where Z is still tentatively labeled. Either the label at Z is greater than or equal to that at E, in which case AXYZE cannot be a shorter path than ABE, or it is less than that of E, in which case Z and not E will become permanent first, allowing E to be probed from Z. Finally, Destination ‘D’ is relabeled as D(10,H). The path is (D-H-F-E-B-A) as follows: D(10,H)=H(8,F),=F(6,E) ,=E(4,B),=B(2,A), =A

STANDARD INPUT AND OUTPUT:

R. C. Patel Institute of Technology, Shirpur Page 13

Page 14: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

CONCLUSION / RESULT:In this Experiment, we have Implemented Dijkastra’s Shortest Path Network routing algorithm.

R. C. Patel Institute of Technology, Shirpur Page 14

Page 15: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 03

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 15

Page 16: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.3TITLE: Implementation of TCP checksum.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Turbo C++ 4.0 or later

THEORY:

The TCP/IP checksum is used to detect corruption of data over a TCP or IPv4 connection. If a bit is flipped, a byte mangled, or some other badness happens to a packet, then it is highly likely that the receiver of that broken packet will notice the problem due to a checksum mismatch. This provides end-to-end assurance that the data stream is correct.IPv4 uses the checksum to detect corruption of packet headers. i.e. the source, destination, and other meta-data. The TCP protocol includes an extra checksum that protects the packet "payload" as well as the header. This is in addition to the header-checksum of IP. IPv6 does not use a checksum. This is due to the modern assumption that low-level transport protocols typically carry some form of error correction, together with the fact that higher-level protocols (like TCP) do as well. This makes IPv6 packet headers "leaner" than they might otherwise be (provided the size of the flow-label isn't altered).The algorithm for the TCP and IPv4 checksums is identical. The data is processed a word (16 bits, two bytes) at a time. (An odd number of bytes just has a trailing zero byte added to make the total number even.) The words are added using ones-complement arithmetic, with the location holding the checksum set to be zeros. Once this long chain of additions is complete, the result is negated in ones-complement by taking the binary not, and the

R. C. Patel Institute of Technology, Shirpur Page 16

Page 17: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

result is stored in the right spot. If this operation is repeated then the result of the checksum should be the binary all-ones.The algorithm above has many interesting properties. The first is that since it is based on addition, it is both commutative and associative. This means that we can use some other calculation that effectively adds in some other order. By re-arranging the additions we might be able to increase performance.

Here are the steps to computing the TCP checksum:

1. As with IP, you must split the datagram into 16-bit parts and add them up. However, unlike with IP checksums, TCP checksums are calculated over the entire segment, both the header and the data. Thus, you must divide the entire segment into 16-bit pieces and add up all of them.

2. TCP (like UDP) uses a 12-byte "pseudo-header" in the checksum as well. This header contains 4 items: The source IP address, the destination IP address, the protocol number, and the 16-bit length of the entire TCP segment (in bytes). Again, all of these are treated as 16-bit words, which are added on top of the addition done in the first step. So when you're done adding all of the TCP segment, add on the source IP address and the destination IP address (both of which will be broken into 2 pieces because they are 32 bits), the protocol number (which will ALWAYS be 6 for TCP, because TCP is protocol number 6; For our 16-bit additions, the protocol number is 0006 hex), and the entire length of the TCP segment, in bytes. That's a lot of addition.

3. If you've made it this far, congratulations, you're almost done. From here on, do the same as with IP: Strip off anything to the left of the last 4 digits (this still assumes you're calculating all this in hexadecimal), and add it to those last 4 digits.

4. Subtract the result from FFFF hex, and the result is your TCP checksum.

CONCLUSION / RESULT:In this Experiment, we have calculated TCP checksum.

R. C. Patel Institute of Technology, Shirpur Page 17

Page 18: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 04

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 18

Page 19: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.4TITLE: Socket programming for TCP.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 16.4 or later2 GCC packages 7.1.0

THEORY:

A TCP socket is defined as an endpoint for communication. TCP Clients and Servers:-The general order of library calls for a TCP client is as follows:socket()connect()send() and/or recv()close()The general order of library calls for a TCP server is as follows: socket() bind() listen() accept() send() and/or recv()

R. C. Patel Institute of Technology, Shirpur Page 19

Page 20: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Socket Address Structures:-

IPv4 Socket Address StructureAn IPv4 socket address structure, commonly called an "Internet socket address structure," is named sockaddr_in and is defined by including the <netinet/in.h> header. The Internet (IPv4) socket address structure: sockaddr_in.

struct in_addr { in_addr_t s_addr; /* 32-bit IPv4 address */ /* network byte ordered */};

struct sockaddr_in { uint8_t sin_len; /* length of structure (16) */ sa_family_t sin_family; /* AF_INET */ in_port_t sin_port; /* 16-bit TCP or UDP port number */ /* network byte ordered */ struct in_addr sin_addr; /* 32-bit IPv4 address */ /* network byte ordered */ Char sin_zero[8]; /* unused */};The length member, sin_len, was added with 4.3BSD-Reno, when support for the OSI protocols was added .Before this release, the first member was sin_family, which was historically an unsigned short. Not all vendors support a length field for socket address structures and the POSIX specification does not require this member. The data type that we show, uint8_t, is typical, and POSIX-compliant systems provide data types of this form.Data types required by the POSIX specification

R. C. Patel Institute of Technology, Shirpur Page 20

Page 21: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Table 1: Data types required by the POSIX specification

Generic Socket Address StructureA socket address structures is always passed by reference when passed as an argument to any socket functions. But any socket function that takes one of these pointers as an argument must deal with socket address structures from any of the supported protocol families.

struct sockaddr { uint8_t sa_len; sa_family_t sa_family; /* address family: AF_xxx value */ char sa_data[14]; /* protocol-specific address */};

The socket functions are then defined as taking a pointer to the generic socket address structure, as shown here in the ANSI C function prototype for the bind function: int bind(int, struct sockaddr *, socklen_t);This requires that any calls to these functions must cast the pointer to the protocol-specific socket address structure to be a pointer to a generic socket address structure. For example,

struct sockaddr_in serv; /* IPv4 socket address structure */ /* fill in serv{} */ bind(sockfd, (struct sockaddr *) &serv, sizeof(serv));If we omit the cast "(struct sockaddr *)," the C compiler generates a warning of the form "warning: passing arg 2 of 'bind' from incompatible pointer type,"

R. C. Patel Institute of Technology, Shirpur Page 21

Page 22: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

assuming the system's headers have an ANSI C prototype for the bind function.

Byte Ordering FunctionsConsider a 16-bit integer that is made up of 2 bytes. There are two ways to store the two bytes in memory: with the low-order byte at the starting address, known as little-endian byte order, or with the high-order byte at the starting address, known as big-endian byte order.Little-endian byte order and big-endian byte order for a 16-bit integer.#include <netinet/in.h>uint16_t htons(uint16_t host16bitvalue) ;uint32_t htonl(uint32_t host32bitvalue) ;uint16_t ntohs(uint16_t net16bitvalue) ;uint32_t ntohl(uint32_t net32bitvalue) ;

Figure 1: Byte orderByte Manipulation FunctionsThere are two groups of functions that operate on multibyte fields, without interpreting the data, and without assuming that the data is a null-terminated C string. We need these types of functions when dealing with socket address structures because we need to manipulate fields such as IP

R. C. Patel Institute of Technology, Shirpur Page 22

Page 23: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

addresses, which can contain bytes of 0, but are not C character strings. The functions beginning with str (for string), defined by including the <string.h> header, deal with null-terminated C character strings.The first group of functions, whose names begin with b (for byte), are from 4.2BSD and are still provided by almost any system that supports the socket functions. The second group of functions, whose names begin with mem (for memory), are from the ANSI C standard and are provided with any system that supports an ANSI C library. We first show the Berkeley-derived functions, although the only one we use in this text is bzero. (We use it because it has only two arguments and is easier to remember than the three-argument memset function, as explained on p. 8.) You may encounter the other two functions, bcopy and bcmp, in existing applications.#include <strings.h>void bzero(void *dest, size_t nbytes);void bcopy(const void *src, void *dest, size_t nbytes);int bcmp(const void *ptr1, const void *ptr2, size_t nbytes);Returns: 0 if equal, nonzero if unequal#include <string.h>void *memset(void *dest, int c, size_t len);void *memcpy(void *dest, const void *src, size_t nbytes);int memcmp(const void *ptr1, const void *ptr2, size_t nbytes);Returns: 0 if equal, <0 or >0 if unequal inet_aton, inet_addr, and inet_ntoa FunctionsWe will describe two groups of address conversion functions in this section and the next. They convert Internet addresses between ASCII strings (what humans prefer to use) and network byte ordered binary values (values that are stored in socket address structures).inet_aton, inet_ntoa, and inet_addr convert an IPv4 address from a dotted-decimal string (e.g., "206.168.112.96") to its 32-bit network byte ordered binary value. You will probably encounter these functions in lots of existing code.

R. C. Patel Institute of Technology, Shirpur Page 23

Page 24: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

The newer functions, inet_pton and inet_ntop, handle both IPv4 and IPv6 addresses. We describe these two functions in the next section and use them throughout the text.#include <arpa/inet.h>int inet_aton(const char *strptr, struct in_addr *addrptr);Returns: 1 if string was valid, 0 on errorin_addr_t inet_addr(const char *strptr);Returns: 32-bit binary network byte ordered IPv4 address; INADDR_NONE if errorchar *inet_ntoa(struct in_addr inaddr);Returns: pointer to dotted-decimal stringThe first of these, inet_aton, converts the C character string pointed to by strptr into its 32-bit binary network byte ordered value, which is stored through the pointer addrptr. If successful, 1 is returned; otherwise, 0 is returned.Socket() FunctionTo perform network I/O, the first thing a process must do is call the socket function, specifying the type of communication protocol desired (TCP using IPv4, UDP using IPv6, Unix domain stream protocol, etc.).#include <sys/socket.h>int socket (int family, int type, int protocol);

R. C. Patel Institute of Technology, Shirpur Page 24

Page 25: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 2: TCP Client Server Communication

family specifies the protocol family and is one of the constants. This argument is often referred to as domain instead of family. The socket type is one of the constants. The protocol argument to the socket function should be set to the specific protocol or 0 to select the system's default for the given combination of family and type.

Protocol family constants for socket function.

R. C. Patel Institute of Technology, Shirpur Page 25

Page 26: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Table 2: Protocol family constants for socket function

Type of socket for socket function.

Table 3: Types of socket for socket function.

Protocol of sockets for AF_INET or AF_INET6.

Table 4: Protocol of sockets for AF_INET or AF_INET6

.

connect () FunctionThe connect function is used by a TCP client to establish a connection with a TCP server.#include <sys/socket.h>int connect(int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);

R. C. Patel Institute of Technology, Shirpur Page 26

Page 27: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Returns: 0 if OK, -1 on errorsockfd is a socket descriptor returned by the socket function. The second and third arguments are a pointer to a socket address structure and its size,

bind() FunctionThe bind function assigns a local protocol address to a socket. With the Internet protocols, the protocol address is the combination of either a 32-bit IPv4 address or a 128-bit IPv6 address, along with a 16-bit TCP or UDP port number.#include <sys/socket.h>int bind (int sockfd, const struct sockaddr *myaddr, socklen_t addrlen);Returns: 0 if OK,-1 on error

listen() FunctionThe listen function is called only by a TCP server and it performs two actions:When a socket is created by the socket function, it is assumed to be an active socket, that is, a client socket that will issue a connect. The listen function converts an unconnected socket into a passive socket, indicating that the kernel should accept incoming connection requests directed to this socket. In terms of the TCP state transition diagram .the call to listen moves the socket from the CLOSED state to the LISTEN state.The second argument to this function specifies the maximum number of connections the kernel should queue for this socket.#include <sys/socket.h>#int listen (int sockfd, int backlog);Returns: 0 if OK, -1 on errorThis function is normally called after both the socket and bind functions and must be called before calling the accept function

accept() Function

R. C. Patel Institute of Technology, Shirpur Page 27

Page 28: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

accept is called by a TCP server to return the next completed connection from the front of the completed connection queue .If the completed connection queue is empty, the process is put to sleep (assuming the default of a blocking socket).#include <sys/socket.h>int accept (int sockfd, struct sockaddr *cliaddr, socklen_t *addrlen);Returns: non-negative descriptor if OK, -1 on errorThe cliaddr and addrlen arguments are used to return the protocol address of the connected peer process (the client). addrlen is a value-result argument .Before the call, we set the integer value referenced by *addrlen to the size of the socket address structure pointed to by cliaddr; on return, this integer value contains the actual number of bytes stored by the kernel in the socket address structure.

Close() FunctionThe normal Unix close function is also used to close a socket and terminate a TCP connection.#include <unistd.h>int close (int sockfd);Returns: 0 if OK, -1 on errorThe default action of close with a TCP socket is to mark the socket as closed and return to the process immediately. The socket descriptor is no longer usable by the process: It cannot be used as an argument to read or write. But, TCP will try to send any data that is already queued to be sent to the other end, and after this occurs, the normal TCP connection termination sequence takes place.

STANDARD INPUT AND OUTPUT:

Enter a number: 3The number is odd.

R. C. Patel Institute of Technology, Shirpur Page 28

Page 29: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

CONCLUSION / RESULT:In this Experiment, we have Implemented of Socket programming for TCP.

R. C. Patel Institute of Technology, Shirpur Page 29

Page 30: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 05

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.5TITLE: Socket programming for UDP.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD Minimum 900MB free

R. C. Patel Institute of Technology, Shirpur Page 30

Page 31: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Space4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 16.4 or later2 GCC packages 7.1.0

THEORY:

User Datagram Protocol (UDP)

UDP is a simple transport-layer protocol. The application writes a message to a UDP socket, which is then encapsulated in a UDP datagram, which is further encapsulated in an IP datagram, which is sent to the destination. There is no guarantee that a UDP will reach the destination that the order of the datagrams will be preserved across the network or that datagrams arrive only once. The problem of UDP is its lack of reliability: if a datagram reaches its final destination but the checksum detects an error, or if the datagram is dropped in the network, it is not automatically retransmitted.

Each UDP datagram is characterized by a length. The length of a datagram is passed to the receiving application along with the data. No connection is established between the client and the server and, for this reason, we say that UDP provides a connection-less service.

Socket addresses

IPv4 socket address structure is named sockaddr_in and is defined by including the <netinet/in.h> header.The POSIX definition is the following: struct in_addr{ in_addr_t s_addr; /*32 bit IPv4 network byte ordered address*/ }; struct sockaddr_in { uint8_t sin_len; /* length of structure (16)*/ sa_family_t sin_family; /* AF_INET*/

R. C. Patel Institute of Technology, Shirpur Page 31

Page 32: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

in_port_t sin_port; /* 16 bit TCP or UDP port number */ struct in_addr sin_addr; /* 32 bit IPv4 address*/ char sin_zero[8]; /* not used but always set to zero */ };The uint8_t datatype is unsigned 8-bit integer.Socket Address Structures:-

IPv4 Socket Address StructureAn IPv4 socket address structure, commonly called an "Internet socket address structure," is named sockaddr_in and is defined by including the <netinet/in.h> header. The Internet (IPv4) socket address structure: sockaddr_in.struct in_addr { in_addr_t s_addr; /* 32-bit IPv4 address */ /* network byte ordered */ };struct sockaddr_in { uint8_t sin_len; /* length of structure (16) */ sa_family_t sin_family; /* AF_INET */ in_port_t sin_port; /* 16-bit TCP or UDP port number */ /* network byte ordered */ struct in_addr sin_addr; /* 32-bit IPv4 address */ /* network byte ordered */ char sin_zero[8]; /* unused */};The length member, sin_len, was added with 4.3BSD-Reno, when support for the OSI protocols was added .Before this release, the first member was sin_family, which was historically an unsigned short. Not all vendors support a length field for socket address structures and the POSIX specification does not require this member. The data type that we show, uint8_t, is typical, and POSIX-compliant systems provide data types of this form.

R. C. Patel Institute of Technology, Shirpur Page 32

Page 33: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Generic Socket Address Structure

A socket address structures is always passed by reference when passed as an argument to any socket functions. But any socket function that takes one of these pointers as an argument must deal with socket address structures from any of the supported protocol families.struct sockaddr { uint8_t sa_len; sa_family_t sa_family; /* address family: AF_xxx value */ char sa_data[14]; /* protocol-specific address */};The htons(), htonl(), ntohs(), and ntohl() FunctionsThe following functions are used for the conversion:#include <netinet/in.h>uint16_t htons(uint16_t host16bitvalue);uint32_t htonl(uint32_t host32bitvalue);uint16_t ntohs(uint16_t net16bitvalue);uint32_t ntohl(uint32_t net32bitvalue);The socket() Function

The first step is to call the socket function, specifying the type of communication protocol (TCP based on IPv4, TCP based on IPv6, UDP).

The function is defined as follows:#include <sys/socket.h>int socket (int family, int type, int protocol);where family specifies the protocol family (AF_INET for the IPv4 protocols), type is aconstant described the type of socket (SOCK_STREAM for stream sockets andSOCK_DGRAM for datagram sockets.The function returns a non-negative integer number, similar to a file descriptor,

R. C. Patel Institute of Technology, Shirpur Page 33

Page 34: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

that we define socket descriptor or -1 on error.The connect() Function

The connect() function is used by a TCP client to establish a connection with a TCP server/The function is defined as follows:#include <sys/socket.h>int connect (int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);where sockfd is the socket descriptor returned by the socket function. The function returns 0 if the it succeeds in establishing a connection (i.e., successful TCP three-way handshake, -1 otherwise.

The client does not have to call bind() in Section before calling this function: the kernel will choose both an ephemeral port and the source IP if necessary.

The bind() Function

The bind() assigns a local protocol address to a socket. With the Internet protocols, the address is the combination of an IPv4 or IPv6 address (32-bit or 128-bit) address along with a 16 bit TCP port number.

The function is defined as follows: #include <sys/socket.h> int bind(int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);where sockfd is the socket descriptor, servaddr is a pointer to a protocol-specific address and addrlen is the size of the address structure.

bind() returns 0 if it succeeds, -1 on error.

The send() Function

Since a socket endpoint is represented as a file descriptor, we can use read and write to communicate with a socket as long as it is connected. However, if we want to specify options we need another set of functions.For example, send() is similar to write() but allows to specify some options. send()

is defined as follows:

R. C. Patel Institute of Technology, Shirpur Page 34

Page 35: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

#include <sys/socket.h>

ssize_t send(int sockfd, const void *buf, size_t nbytes, int flags);

where buf and nbytes have the same meaning as they have with write. The additional argument flags is used to specify how we want the data to be transmitted. We will not consider the possible options in this course. We will assume it equal to 0. The function returns the number of bytes if it succeeds, -1 on error.

The receive() Function

The recv() function is similar to read(), but allows to specify some options to control how the data are received. We will not consider the possible options in this course.

UDP Socket API

There are some fundamental differences between TCP and UDP sockets. UDP is a connection-less, unreliable, datagram protocol (TCP is instead connection oriented, reliable and stream based). There are some instances when it makes to use UDP instead of TCP. Some popular applications built around UDP are DNS, NFS, SNMP and for example, some Skype services and streaming media.

Figure 4 shows the the interaction between a UDP client and server. First of all, the client does not establish a connection with the server. Instead, the client just sends a datagram to the server using the sendto function which requires the address of the destination as a parameter. Similarly, the server does not accept a connection from a client. Instead, the server just calls the recvfrom function, which waits until data arrives from some client. recvfrom returns the IP address of the client, along with the datagram, so the server can send a response to the client.

As shown in the Figure, the steps of establishing a UDP socket communication on the client side are as follows:

Create a socket using the socket() function;Send and receive data by means of the recvfrom() and sendto() functions.The steps of establishing a UDP socket communication on the server side are as follows:Create a socket with the socket() function;

R. C. Patel Institute of Technology, Shirpur Page 35

Page 36: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Bind the socket to an address using the bind() function;Send and receive data by means of recvfrom() and sendto().

Figure 1: UDP Client Server Communication

The recvfrom() Function

This function is similar to the read() function, but three additional arguments are required. The recvfrom() function is defined as follows:#include <sys/socket.h>ssize_t recvfrom(int sockfd, void* buff, size_t nbytes, int flags, struct sockaddr* from,socklen_t *addrlen);The first three arguments sockfd, buff, and nbytes, are identical to the first three arguments of read and write. sockfd is the socket descriptor, buff is the pointer to read into, and nbytes is number of bytes to read. In our examples we will set all the values of the flags argument to 0. The recvfrom function

R. C. Patel Institute of Technology, Shirpur Page 36

Page 37: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

fills in the socket address structure pointed to by from with the protocol address of who sent the datagram. The number of bytes stored in the socket address structure is returned in the integer pointed by addrlen. The function returns the number of bytes read if it succeeds, -1 on error.

The sendto() Function

This function is similar to the send() function, but three additional arguments are required. The sendto() function is defined as follows:#include <sys/socket.h>ssize_t sendto(int sockfd, const void *buff, size_t nbytes, int flags, const struct sockaddr *to, socklen_t addrlen);The first three arguments sockfd, buff, and nbytes, are identical to the first three arguments of recv. sockfd is the socket descriptor, buff is the pointer to write from, and nbytes is number of bytes to write. In our examples we will set all the values of the flags argument to 0. The to argument is a socket address structure containing the protocol address (e.g., IP address and port number) of where the data is sent. addlen specified the size of this socket. The function returns the number of bytes written if it succeeds, -1 on error.

STANDARD INPUT AND OUTPUT:

Enter message : hellohello

CONCLUSION / RESULT:In this Experiment, we have Implemented Socket programming for UDP.

R. C. Patel Institute of Technology, Shirpur Page 37

Page 38: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 06

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 38

Page 39: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.6TITLE: Encryption/Decryption using XOR symmetric-key cryptography algorithm.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Turbo C++

THEORY:

Exclusive-OR encryption works by using the boolean algebra function exclusive-OR (XOR). XOR is a binary operator (meaning that it takes two arguments - similar to the addition sign, for example). By its name, exclusive-OR, it is easy to infer (correctly, no less) that it will return true if one, and only one, of the two operators is true. The truth table is as follows:

A B A XOR BT T FT F TF T TF F F

Table 1: X-OR Operation

A truth table works like a multiplication or addition table: the top row is one list of possible inputs, the side column is one list of possible inputs. The intersection of the rows and columns contains the result of the operation

R. C. Patel Institute of Technology, Shirpur Page 39

Page 40: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

when done performed with the inputs from each row and column. The idea behind exclusive-OR encryption is that it is impossible to reverse the operation without knowing the initial value of one of the two arguments. For example, if you XOR two variables of unknown values, you cannot tell from the output what the values of those variables are. For example, if you take the operation A XOR B, and it returns TRUE, you cannot know whether A is FALSE and B is TRUE, or whether B is FALSE and A is TRUE. Furthermore, even if it returns FALSE, you cannot be certain if both were TRUE or if both were FALSE.

ALGORITHM: 1. Convert both the key and the source to a character array (ASCII)2. Each char of the source will be X OR’ed with each char of the key 3. The result will be added by the length of the key.4. If the key is shorter than the source, it will be rotated5. Convert the resulting value into an octet binary value6. These binary strings will be joined and splitted up into nibbles7. The 4 bit junks are converted back into a decimal value8. Then we multiply each item in the decimal result array by 4 and add

m=m0,m1,m2,m39. Close to be finished.

STANDARD INPUT AND OUTPUT:

R. C. Patel Institute of Technology, Shirpur Page 40

Page 41: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

CONCLUSION / RESULT:In this Experiment, we have Implemented Encryption/Decryption using XOR symmetric-key cryptography algorithm.

Laboratory ReportExperiment No - 07

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

R. C. Patel Institute of Technology, Shirpur Page 41

Page 42: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 42

Page 43: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.7TITLE: Encryption /Decryption using RSA asymmetric-key cryptography algorithm.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Turbo C++

THEORY:

The most common public key algorithm is RSA, named for its inventors Rivest, Shamir, and Adleman (RSA). It uses two numbers, e and d, as the public and private keys.

Figure 1: Encryption Decryption with RSA

R. C. Patel Institute of Technology, Shirpur Page 43

Page 44: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

The two keys, e and d, have a special relationship to each other, a discussion of the relationship is beyond the scope of this book. We just show how to calculate the key without proof.Selecting Keys:-

Bob use the following steps to select the private and public keys:1. Bob chooses two very large prime numbers p and q. Remember that a prime number is one that can be divided evenly only by 1 and itself.2. Bob multiplies the above two primes to find n, the modulus for encryption and decryption. In other words, n ::: p X q.3. Bob calculates another number <Φ> ::: (p -1) X (q - 1).4. Bob chooses a random integer e. He then calculates d so that \d x e::: 1 mod <Φ>.5. Bob announces e and n to the public; he keeps <Φ> and d secret.

ALGORITHM:

Encryption:-

Anyone who needs to send a message to Bob can use n and e. For example, if Alice needs to send a message to Bob, she can change the message, usually a short one, to an integer. This is the plaintext. She then calculates the cipher text, using e and n. C=Pe(mod n)Alice sends C, the cipher text, to Bob.

Decryption:-

Bob keeps <Φ> and d private. When he receives the cipher text, he uses his private key d to decrypt the message:P= Ce (mod n)

Select the prime integers q=11, q=3. n=pq=33; φ(n)=(p-1)(q-1)=20 Choose e=3 Check gcd(3,20)=1 Compute d=7 (3)d ≡ 1 (mod 20)

R. C. Patel Institute of Technology, Shirpur Page 44

Page 45: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Therefore the public key is (n, e) = (33, 3) and the private key is (n, d) = (33, 7).

Now say we wanted to encrypt the message M=7

C=M emodn C=M emodnC=73mod33 C=73mod33C=343mod33 C=343mod33C=13 C=13So now the cyphertext C has been found. The decryption of C is performed as follows.

M′=CdmodnM′=CdmodnM′=137mod33M′=137mod33M′=62,748,517mod33M′=62,748,517mod33M′=7

STANDARD INPUT AND OUTPUT:

CONCLUSION / RESULT:In this Experiment, we have Implemented Encryption /Decryption using RSA asymmetric-key cryptography algorithm.

R. C. Patel Institute of Technology, Shirpur Page 45

Page 46: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 08

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 46

Page 47: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.8TITLE: Implementation of RLE data compression algorithm.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Turbo C++

THEORY:

Run-length encoding (RLE) is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run. This is most useful on data that contains many such runs: for example, relatively simple graphic images such as icons, line drawings, and animations. It is not useful with files that don't have many runs as it could potentially double the file size.Example:- For example, consider a screen containing plain black text on a solid white background. There will be many long runs of white pixels in the blank space, and many short runs of black pixels within the text. Let us take a hypothetical single scan line, with B representing a black pixel and W representing white:WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW If we apply the run-length encoding (RLE) data compression algorithm to the above hypothetical scan line, we get the following:Interpret this as twelve W's, one B, twelve W's, three B's, etc.

R. C. Patel Institute of Technology, Shirpur Page 47

Page 48: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

12W1B12W3B24W1B14W The run-length code represents the original 67 characters in only 18. Of course, the actual format used for the storage of images is generally binary rather than ASCII characters like this, but the principle remains the same. Even binary data files can be compressed with this method; file format specifications often dictate repeated bytes in files as padding space. However, newer compression methods such as DEFLATE often use LZ77-based algorithms, a generalization of run-length encoding that can take advantage of runs of strings of characters (such as BWWBWWBWWBWW).

ALGORITHM:

1. Pick the first character from source string.2. Append the picked character to the destination string.3. Count the number of subsequent occurrence of the picked character and

append the count to destination string.4. Pick the next character and repeat steps b) c) and d) if end of string is

not reached.5.Applications:-6. Run-length encoding performs lossless data compression and is well

suited to palette-based iconic images. It does not work well at all on continuous-tone images such as photographs, although JPEG uses it quite effectively on the coefficients that remain after transforming and quantizing image blocks.

7. Common formats for run-length encoded data include Truevision TGA, PackBits, PCX and ILBM.

8. Run-length encoding is used in fax machines (combined with other techniques into Modified Huffman coding). It is relatively efficient because most faxed documents are mostly white space, with occasional interruptions of black.

9. Data that have long sequential runs of bytes (such as lower-quality sound samples) can be RLE compressed after applying a predictive filter such as delta encoding.

STANDARD INPUT AND OUTPUT:

R. C. Patel Institute of Technology, Shirpur Page 48

Page 49: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

CONCLUSION / RESULT:In this Experiment, we have Implemented RLE data compression algorithm.

R. C. Patel Institute of Technology, Shirpur Page 49

Page 50: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 09

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

R. C. Patel Institute of Technology, Shirpur Page 50

Page 51: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Subject Incharge

Experiment No. 9TITLE: Introduction to Cisco Packet Tracer.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Cisco Packet Tracer 6.2 or latter

THEORY:

Cisco Packet Tracer is a powerful network simulation program that allows students to experiment with network behavior and ask “what if” questions. As an integral part of the Networking Academy comprehensive learning experience, Packet Tracer provides simulation, visualization, authoring, assessment, and collaboration capabilities to facilitate the teaching and learning of complex technology concepts.Packet Tracer supplements physical equipment in the classroom by allowing students to create a network with an almost unlimited number of devices, encouraging practice, discovery, and troubleshooting. The simulation-based learning environment helps students develop 21st century skills such as decision making, creative and critical thinking, and problem solving. Packet

R. C. Patel Institute of Technology, Shirpur Page 51

Page 52: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Tracer complements the Networking Academy curricula, allowing instructors to easily teach and demonstrate complex technical concepts and networking systems design. Instructors can customize individual or multiuser activities, providing hands-on lessons for students that offer value and relevance in their classrooms. Students can build, configure, and troubleshoot networks using virtual equipment and simulated connections, alone or in collaboration with other students. Packet Tracer offers an effective, interactive environment for learning networking concepts and protocols. Most importantly, Packet Tracer helps students and instructors create their own virtual “network worlds” for exploration, experimentation, and explanation of networking concepts and technologies.

Key Features

Packet Tracer Workspaces: Cisco Packet Tracer has two workspaces— logical and physical. The logical workspace allows users to build logical network topologies by placing, connecting, and clustering virtual network devices. The physical workspace provides a graphical physical dimension of the logical network, giving a sense of scale and placement in how network devices such as routers, switches, and hosts would look in a real environment.The physical view also provides geographic representations of networks, including multiple cities, buildings, and wiring closets. Packet Tracer Modes: Cisco Packet Tracer provides two operating modes to visualize the behavior of a network—real-time mode and simulation modeIn real-time mode the network behaves as real devices do, with immediate real-time response for all network activities. The real-time mode gives students a viable alternative to real equipment and allows them to gain configuration practice before working with real equipment.In simulation mode the user can see and control time intervals, the inner workings of data transfer, and the propagation of data across a network. This helps students understand the fundamental concepts behind network operations. A solid understanding of network fundamentals can help accelerate learning about related concepts.

Additional Features

• Lab grading function• International language support

R. C. Patel Institute of Technology, Shirpur Page 52

Page 53: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

• Compatible with the following platforms: Windows, Windows XP; Vista (Vista Basic, Vista Premium); Windows 7; and Linux (Ubuntu, Fedora)• Available to registered Networking Academy instructors, students, and alumni

Protocols: Cisco Packet Tracer supports the following protocols:

Layer Cisco Packet tracer supported Protocol

Application • FTP , SMTP, POP3, HTTP, TFTP, Telnet, SSH, DNS, DHCP, NTP, SNMP, AAA, ISR VOIP, SCCP config and calls ISR command support, Call Manager Express

Transport • TCP and UDP, TCP Nagle Algorithm & IP Fragmentation, RTP Network

Network • BGP, IPv4, ICMP, ARP, IPv6, ICMPv6, IPSec, RIPv1/ v2/ng, Multi-Area OSPF, EIGRP, Static Routing, Route Redistribution, Multilayer Switching, L3 QoS, NAT,CBAL , Zone-based policy firewall and Intrusion Protection System on the ISR GRE VPN, IPSec VPN

Network Access/Interface

Ethernet (802.3), 802.11, HDLC, Frame Relay, PPP, PPPoE, STP, RSTP, VTP, DTP, CDP, 802.1q, PAgP, L2 QoS, SLARP, Simple WEP, WPA, EAP

Table 1: Cisco Packet tracer supported ProtocolI. Lab Objectives1. Cisco Packet Tracer 5.1 Overview2. Creating Devices3. Adding Modules4. Making Connections5. Creating Networks

II. Lab Content

1. Cisco Packet Tracer 6.1 Overview

R. C. Patel Institute of Technology, Shirpur Page 53

Page 54: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 1: Cisco packet Tracer

1 Menu Bar This bar provides the File, Edit, Options, View, Tools, Extensions, and Help menus. You will find basic commands such as Open, Save, Print, and Preferences in these menus. You will also be able to access the Activity Wizard from the Extensions menu.

2 Main Tool Bar This bar provides shortcut icons to the File and Edit menu commands. This bar also provides buttons for Zoom, the drawing Palette, and the Device Template Manager. 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).

3 Common Tools This bar provides access to these commonly used workspace tools: Select, Move Layout, Place Note, Delete, Inspect, Add Simple PDU,

R. C. Patel Institute of Technology, Shirpur Page 54

Page 55: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Bar and Add Complex PDU. See "Workspace Basics" for more information.

4 Logical/Physical

Workspace and

Navigation Bar

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 navigate through levels of a cluster, create a new Cluster, Move Object, Set Tiled Background, and Viewport. In Physical Workspace, this bar allows you to navigate through physical locations, create a New City, create a New Building, create a New Closet, Move Object, apply Grid to the background, Set Background, and go to the Working Closet.

5 Workspace This area is where you will create your network, watch simulations, and view many kinds of information and statistics.

6 Realtime/Simul

ation Bar

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

7 Network

Component Box

This box is where you choose devices and connections to put into the workspace. It contains the Device-Type Selection Box and the Device-Specific Selection Box.

8 Device-Type

Selection Box

This box contains the type of devices and connections available in Packet Tracer 5.1. The Device-Specific Selection Box will change depending on which type of device you choose.

9 Device-Specific

Selection Box

This box is where you choose specifically which devices you want to put in your network and which connections to make.

R. C. Patel Institute of Technology, Shirpur Page 55

Page 56: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

10

User Created

Packet

Window*

This window manages the packets you put in the network during simulation scenarios. See the "Simulation Mode" section for more details.

Table 2: Menus in Cisco Packet TracerSelecting Routers

Figure 2: Selection of routers

Creating Devicesa. Choose a device type from the Device- Type Selection boxb. Click on the desired device model from the Device-Specific Selection boxc. Click on a location in the workspace to put your device in that locationd. If you want to cancel your selection, press the Cancel icon for that devicee. Alternatively, you can click and drag a device from the Device-Specific Selection box onto the workspacef. You can also click and drag a device directly from the Device-Type Selection box and a default device model will be chosen for you.

Adding Modulesa. Click on a device to bring up its configuration window.b. By default, you will be in the Physical Device View subpanel of the device.c. You can browse (by clicking) through the list of modules and read their description in the information box at the bottom.d. When you have found the module you want to add, simply drag it from the list into a compatible bay on the device picture.e. You can remove a module by dragging it from the device back into the list.

R. C. Patel Institute of Technology, Shirpur Page 56

Page 57: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Making Connectionsa. To make a connection between two devices, first click the Connections icon from the Device-Type Selection box to bring up the list of available connections.b. Then click the appropriate cable type.c. The mouse pointer will change into a "connection" cursor.d. Click on the first device and choose an appropriate interface to which to connect.e. Then click on the second device and do the same.f. A connection cable will appear between the two devices, along with link lights showing the link status on each end (for interfaces that have link lights).

Figure 3: Making Connection

R. C. Patel Institute of Technology, Shirpur Page 57

Page 58: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 4: Making Connection

Creating Networksa. Start creating a network by first selecting the End Devices. Add a Generic PC and a Generic Server to the workspace.b. Under Connections, select the Copper Straight-through cable (solid black line) and connect the devices with it. The red lights on the link indicate that the connection is not working. Now, use the Delete tool to remove the Copper Straight-through cable, and use a Copper Cross-over cable (dashed line) instead. The lights should turn green at this point, and if the mouse pointer is held over either the PC or the Server, the link status will be Up.c. Click on the PC. While paying attention to the link lights, turn the power on, off, and on again. The link lights turn red when the device is off. This means that the link is down or is not working. The link lights turn green when the device is turned back on.d. Try all three ways to learn about the devices. First, mouse over the devices to see basic configuration information about them. Second, click on each device with the Select tool to show the device configuration window, which provides several ways to configure the device. Third, use the Inspect tool to view tables the network device will build.

R. C. Patel Institute of Technology, Shirpur Page 58

Page 59: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 5: Making Connection

e. Open the PC configuration window and change the settings using the Config tab. Change the display name to Client and set the DNS server to 192.168.0.105. Under Interface, click Fast Ethernet and set the IP address as 192.168.0.110. Packet Tracer automatically calculates other parameters. Make sure that the Port Status box is checked. f. Go to the Desktop Tab and click on IP Configuration. Notice that the IP address, subnet mask and DNS server can be changed here as well.g. Open the Server configuration window and go to the Config tab. Change the display name to Web Server. Click FastEthernet and set the IP address as 192.168.0.105. Make sure that the Port Status is also on. Click DNS and set the domain name as www.firstlab.com. Set the IP address as 192.168.0.105 and click Add. h. Reposition the network devices by dragging them to a new location. Add a network description by using the “i” button on the upper right corner.i. Load a background grid using the Set Tiled Background button.j. Save your work using the File > Save As option and create a meaningful filename.

CONCLUSION / RESULT:

In this Experiment, we learnt Information of Cisco Packet Tracer.

R. C. Patel Institute of Technology, Shirpur Page 59

Page 60: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No -10

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 60

Page 61: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.10TITLE: Implementation of Ethernet LAN simulation.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Cisco Packet Tracer 6.2 or latter

THEORY:

Ethernet is a family of computer networking technologies for local area networks (LANs). Ethernet was commercially introduced in 1980 and standardized in 1983 as IEEE 802.3. Ethernet has largely replaced competing wired LAN technologies such as token ring, FDDI, and ARCNET.

The Ethernet standards comprise several wiring and signaling variants of the OSI physical layer in use with Ethernet. The original 10BASE5 Ethernet used coaxial cable as a shared medium. Later the coaxial cables were replaced with twisted pair and fiber optic links in conjunction with hubs or switches. Data rates were periodically increased from the original 10 megabits per second to 100 gigabits per second.

Systems communicating over Ethernet divide a stream of data into shorter pieces called frames. Each frame contains source and destination addresses and error-checking data so that damaged data can be detected and re-transmitted. As per the OSI model, Ethernet provides services up to and including the data link layer.

Since its commercial release, Ethernet has retained a good degree of

R. C. Patel Institute of Technology, Shirpur Page 61

Page 62: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

compatibility. Features such as the 48-bit MAC address and Ethernet frame format have influenced other networking protocols.

Figure 1: Standard Ethernet

10Base5: Thick Ethernet

The first implementation is called 10BaseS, thick Ethernet, or Thicknet. The nickname derives from the size of the cable, which is roughly the size of a garden hose and too stiff to bend with your hands. 10Base5 was the first Ethernet specification to use a bus topology with an external transceiver (transmitter/receiver) connected via a tap to a thick coaxial cable.

10Base2: Thin Ethernet

The second implementation is called 10Base2, thin Ethernet, or Cheapernet. IOBase2 also uses a bus topology, but the cable is much thinner and more flexible. The cable can be bent to pass very close to the stations. In this case, the transceiver is normally part of the network interface card (NIC), which is installed inside the station.

10Base-T or twisted-pair Ethernet

10Base-T uses a physical star topology. The stations are connected to a hub via two pairs of twisted cable. Note that two pairs of twisted cable create two paths (one for sending and one for receiving) between the station and the hub.

R. C. Patel Institute of Technology, Shirpur Page 62

Page 63: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Steps for simulating an Ethernet LAN:

1. Select any one of the switch (2950-24).2. Select end device and form star topology.3. Connect switch to all end devices with proper cable (usually copper-

straight through cable).4. After establishing the connection assign IP address to each device.5. Add simple PDU.6. Simulate this topology using simulation mode.

SIMULATION MODE:

Press autocapture/play button. We can see the simulation that how PDU is transmitted from one device to other through switch.

Figure 1: Simulation

R. C. Patel Institute of Technology, Shirpur Page 63

Page 64: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 2: IP Configuration

R. C. Patel Institute of Technology, Shirpur Page 64

Page 65: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 3: IP Configuration

Figure 4: Making Connection

R. C. Patel Institute of Technology, Shirpur Page 65

Page 66: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 5: Making Connection

Figure 6: Data Transfer

R. C. Patel Institute of Technology, Shirpur Page 66

Page 67: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 7: Packet Details

CONCLUSION / RESULT:In this Experiment, we have simulated Ethernet LAN.

R. C. Patel Institute of Technology, Shirpur Page 67

Page 68: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 11

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.11R. C. Patel Institute of Technology, Shirpur Page 68

Page 69: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

TITLE: Simulate the Point to Point wired networks.PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 512 MB Minimum3 HDD

Minimum 900MB free Space

4 Standard I/O devices

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows XP or later2 Cisco Packet Tracer 6.2 or latter

THEORY:

Simulate a Point To Point Network

1. Open a web browser and navigate to http://network.nwtc.edu/cgabryszek

2. Under the Labs section, right click on C1Lab03-Switch.pkt and save it to disk. Save it to the desktop.

3. Double click on the C1Lab03-Switch.pkt file on the desktop. This should start Cisco Packet Tracer and open the file. If necessary, maximize the program window.

Point-to-Point: A point-to-point connection provides a dedicated link between two devices. The entire capacity of the link is reserved for transmission between those two devices. Most point-to-point connections use an actual length of wire or cable to connect the two ends, but other options, such as microwave or satellite links, are also possible. When you change television channels by infrared remote control, you are establishing a point-to-point connection between the remote control and the television's control system.Steps for simulating point to point connection:

R. C. Patel Institute of Technology, Shirpur Page 69

Page 70: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

1. Select two devices from any of the given end devices.2. Connect both the devices with proper cable (usually copper-cross

over).3. Add simple PDU.4. Simulate this point-to-point connection using simulation mode.

SIMULATION MODE:Press autocapture/play button. We can see the simulation that how PDU is transmitted from one device to other.

Figure 1: Simulation mode

R. C. Patel Institute of Technology, Shirpur Page 70

Page 71: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 2: IP Configuration

Figure 3: Making Connection

R. C. Patel Institute of Technology, Shirpur Page 71

Page 72: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 4: Packet Transfer

CONCLUSION / RESULT:In this Experiment, we have simulated Point to Point wired networks.

R. C. Patel Institute of Technology, Shirpur Page 72

Page 73: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Laboratory ReportExperiment No - 12

Batch -

Date of Experiment: __________ Date of Submission: __________

Title: ______________________________________________________

Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur Page 73

Page 74: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Experiment No.12TITLE: Designing and implementing Class A, B, and C Networks

PREREQUISITE: Data CommunicationHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor -2 RAM -3 HDD -4 Standard I/O devices -

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System -2 Cisco Packet Tracer -

THEORY:

IP Address Classes:- • IP addressing supports five different address classes: A, B, C, D and E. Only classes A, B and C are available for commercial use. Class A addresses

1. Class A addresses are designed for large organizations with a large number of hosts or routers.

2. In this the first octet of the address identifies the network and the next three octets are used to identify the host.

3. The first bit of first octet is always 0 and the remaining 7 bits are used to identify the network address.

4. The next three octets i.e. 24 bits are used to identify the host.

5. The class support addresses from 0.0.0.0 to 0.255.255.255

6. The first block of network address starts with 1.0.0.0 and the last block of network address starts with 127.0.0.0.

R. C. Patel Institute of Technology, Shirpur Page 74

Page 75: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

7. As there are 7 bits in network address, 27 = 128 blocks of network address are possible. Out of these two network blocks are reserved. Hence total 126 address blocks are used.

8. Each network blocks can have 224--- 2 hosts i.e. 16,777,214 host address. Two addresses are less as one address is reserved for the broadcast address and one address is reserved for the network.

9. A block in class A is too large for almost any organization. This means most of the addresses in class A are wasted and are not used.

Class B address 1. The class B addresses are designed for medium sized organizations

with tens of thousands of attached hosts or routers.

2. In this, the first two octets of the address identify the network and the next two octets identify the host within the network.

3. The first two bits (high order bits) of first octet are always 1, 0. Thus the remaining 14 bits identify the network

4. The third and fourth octet i.e. 6 bits are used to identify the host.

5. The first network block of this class covers the addresses from 128.0.0.0 to 128.0.255.255 (net id 128.0). The last network block of this class covers addresses from 191.255.255.255 (net id 191.255)

6. The maximum number of network blocks in class B is 214 = 16384.

7. Each network block in class B can have 216--- 2 = 65,534 hosts.

8. A block in class B is also very large and most of the address in class B is also wasted.

Class C address

1. The class C addresses is designed for small organizations with a small number of attached hosts or routers.

2. In class C, the first three octets of address are used for network and the last octet is used to identify the host.

3. The first three bits of first octet are always set to 1, 1, 0.

4. The remaining 24 - 3 = 21 bits are used for network identification and only 8 bits are used for host. 5. In class C, 221 = 2,097,152 network blocks are possible.

R. C. Patel Institute of Technology, Shirpur Page 75

Page 76: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

5. Thus, each block in class C address can have 28 - 2 = 254 hosts.

6. The first block of network covers addresses from 192.0.0.0 to 192.0.0.255. The last block of network covers the addresses form 223.255.255.0 to 223.255.255.255

7. The class C addresses are too less for many organizations as it supports only 254 hosts in a network.

Following are the classes of IP

Table 1: Classes of IP

Class D address

1. Class D addresses are used for multicast groups (multicasting)

2. The concept of division of octets into network id and host id does not apply to class D.

3. The first four bits of first octet in class D are always set to 1,1,1,0. 4. The address range is 224.0.0.0 to 239.255.255.255

Class E address

1. The Class E address is reserved for future use and is experimental.

2. The concept of network id and host id does not apply on class E also.

3. The first four bits of first octet are always set to 1,1,1,1.

4. The address range for class E is 240.0.0.0 to 255.255.255.255.

R. C. Patel Institute of Technology, Shirpur Page 76

Page 77: Android Programming Lab - WordPress.com · Web viewNo Software Configuration 1 Operating System Windows XP or later 2 Cisco Packet Tracer 6.2 or latter THEORY: Cisco Packet Tracer

Computer Network Lab

Figure 1: IP addresses for classes

Figure 2: Summary of the various features of IP address classes

CONCLUSION / RESULT:In this Experiment, we have Designed and implemented Class A, B, and C Networks.

R. C. Patel Institute of Technology, Shirpur Page 77