Department of Computer Science COMSATS UNIVERSITY ISLAMABAD ATTOCK CAMPUS 1 Data Communication and Computer Networks Lab Manual 2 Data Communication and Computer Networks Lab Manual Submission Form DCCN Lab Manual Course Name Data Communication and Computer Networks Teacher Name Dr. Fahad Sr . 1 Name Tooba Liaquat 2 Irsa Shehzadi 1 Fatima Jabeen Reg. No SP20-BCS009 SP20-BCS017 SP20-BCS002 Sp20-bcs-017@cuiatk.edu.pk Sp20-bcs-002@cuiatk.edu.pk Teacher’s Signature Student’s Signature *Teacher Email ID Sp20-bcs-009@cuiatk.edu.pk Remarks: 3 Data Communication and Computer Networks Lab Manual Acknowledgements In the Name of Allah, the Most Beneficent, the Most Merciful. Initially, we would like to Thank ALLAH Almighty who provides all the resources of every kind to us, so that we make their proper use for benefit of mankind. May he keep providing us with all the resources, and the guidance to keep helping the humanity. We would like to express our sincere Thankful and Grateful to our teacher Mr. Waseem Khan for providing us with all sorts of basic ideas and techniques essential for carrying out this project work from the very beginning to the end and enabled us to present this dissertation in this form. We are very much grateful to the COMSATS University Islamabad, Attock Campus for providing us an enthusiastic support and opportunity. PREFACE 4 Data Communication and Computer Networks Lab Manual This lab manual has been prepared to facilitate the students of computer science in studying and analyzing various functions of a computer network. The students will have plan the IP address scheme, configure and test the several network devices. Different tools are used to monitor network traffic and analyses packets. The lab sessions are designed to improve the abilities of the students by giving hands on experience. After completing the laboratory exercises, the students will be familiar with the practical issues of the different concepts explained in the course, as well as with the real equipment used nowadays in computer networks. PREPARED BY Lab manual is prepared by Ms. Tooba Liaquat, Ms. Irsa Shehzadi and Ms. Fatima Jabeen under the supervision of Dr. Fahad. Lab 1 How to install Packet Tracer and sending packet from one PC to other: 5 Data Communication and Computer Networks Lab Manual From end devices select a PC drag to screen and drop there, named PC0 by default By using same End devices drag another PC name with PC1 click on PC0 and this menu will 6 Data Communication and Computer Networks Lab Manual Figure 1 Establish a connection between both PCs by using a cross table that is selected by default in Desktop select IP Configuration for IP address 7 Data Communication and Computer Networks Lab Manual enter IP address which is here 192.168.1.1 and subnet mask will automatically be generated by clicking on that space 8 Data Communication and Computer Networks Lab Manual Select command prompt, ping device PC1. Enter ping command and provide it the Ip address of PC1 to ping it and then it shows the detail. 9 Data Communication and Computer Networks Lab Manual Select message packet and give it to PC0 and PC1. This message shows the successful connection and sending of message from PC0 to PC1. 10 Data Communication and Computer Networks Lab Manual Lab 2 CONNECT TWO NETWORKS AND ANALYZE TRAFFIC: Task 01: Checking traffic in same network 1). Create two switched-Networks (two switches connected to each other and each having PCs attached to them) in Packet Tracer. All PCs in both switches belong to the same network ID. Data in one switched network can move inside that network and to other switched-network also. 1). Observe the intelligence of switches. Observe that packets sent to other networks when sent first time are broadcasted but next time uni-casted. 11 Data Communication and Computer Networks Lab Manual 2)Observe Broadcast and Collision domains in the above Packet Tracer simulation. 12 Data Communication and Computer Networks Lab Manual 3)Repeat ‘show mac’ command to verify the contents of MAC address tables of switches to build your understanding. 13 Data Communication and Computer Networks Lab Manual Lab 3 Creating TWO switched networks (LANs) and connecting them together. LANS have different Network IDs. Figure 1 Every PC of network A is assigned with IP address from PC1 192.168.100.1 to PC6 192.168.100.3 and MAC addresses and every PC of network B is assigned with IP address from 192.168.200.1 to 192.168.200.3 and MAC addresses. Both switches are labeled with port numbers. Two switches, switch0 and switch1 connected with port Fa0/4. Switch0 relates to PC1 through Fa0/1, PC2 through Fa0/2 and PC3 through Fa0/3. Switch1 relates to PC4 through Fa0/1, PC5 through Fa0/2 and PC6 through Fa0/3. 14 Data Communication and Computer Networks Lab Manual Figure 2 PC 192.168.100.1 wants to send data to PC 192.168.200.3 - The packet is dropped at the sender because the default gateway of PC 192.168.100.1 is not set. When a PC belonging to Network A wants to communicate with another PC which is part of Network B then we must mention in the sending PC, the IP address of Default Gateway. By specifying default gateway IP address, we mean that our requests for PCs in other networks will first go to Default Gateway which will search the network in its list of networks and after finding NetID, packet will be sent to the destination PC. Figure 3 Let’s set default gateway IP of PC 192.168.100.1 as 192.168.100.4 In this case, although IP of default gateway has been mentioned but the default gateway machine does not physically exist between NetID 192.168.100.0 and NetID 192.168.200.0. As show in the figure on the next page. 15 Data Communication and Computer Networks Lab Manual Figure 4 After setting the default gateway, PC 192.168.100.1 again sends packet to PC 192.168.200.3. PC 192.168.100.2 and PC 192.168.100.3 drop it, while Switch1 rebroadcasts it to all its up and running ports. Repeating Lab 2 task 2 by adding a Router in between the switched network . 16 Data Communication and Computer Networks Lab Manual Assign default gateway IP addresses to both port of router which are linked with both networks A to fa0/0 (192.168.100.4) and B to fa0/1 (192.168.200.4). Also assign this default gateway IP address to all PCs of network A 192.168.100.4 And assign this default gateway IP address to all PCs of network B 192.168.200.4 17 Data Communication and Computer Networks Lab Manual Lab 4 How we set date and time in configuration modes: We just add hostname as: Fatima Ali on configuration mode. Set date and time 18 Data Communication and Computer Networks Lab Manual Banner with “Welcome it’s Fatima Ali” Set enables and secret password 19 Data Communication and Computer Networks Lab Manual Configuration line command( line console 0) 20 Data Communication and Computer Networks Lab Manual Lab 5 WIRE SHARK(PACKET SNIFFING): After starting Wireshark, do the following: Select Capture | Interfaces Select the interface on which packets need to be captured. This will usually be the interface where the Packet/s column is constantly changing, which would indicate the presence of live traffic). If you have multiple network interface cards (i.e. LAN card and Wi-Fi adapter) you may need to check with your IT administrator to determine the right interface. I double click on Wi-Fi because I am using Wi-Fi currently. Recreate the problem. The capture dialog should show the number of packets increasing. Try to avoid running any other internet applications while capturing, closing other browsers, Instant messengers etc. Once the problem which is to be analysed has been reproduced, click on Stop. It may take a few seconds for Wireshark to display the packets captured. Save the packet trace in the default format. Click on the File menu option and select Save As. By default, Wireshark will save the packet trace in Libecap format. This is a filename with a. pcap extension. 21 Data Communication and Computer Networks Lab Manual Select any of packet of your own choice to see its detail. I selected UDP protocol and here is the detail of packet. In ethernet section it gives the detail about source and destination of end devices. In internet protocol section it gives detail about network layer. The user data gram protocols are in transort layer it gives the detail about transmission of packet either in TCP or UDP protocol. The data section contain the detail about network layer and provide the detail about IP address. 22 Data Communication and Computer Networks Lab Manual Lab 6 23 Data Communication and Computer Networks Lab Manual STATIC AND DYNAMIC CODE BINDING: connect pc with switch 24 Data Communication and Computer Networks Lab Manual 25 Data Communication and Computer Networks Lab Manual 26 Data Communication and Computer Networks Lab Manual 27 Data Communication and Computer Networks Lab Manual 28 Data Communication and Computer Networks Lab Manual Lab 7 IMAGE CHANGE: We connect 2 different networks with router. Assign IP addresses to each PC and default gateways. 29 Data Communication and Computer Networks Lab Manual Also assign the gateway to the port of router. 30 Data Communication and Computer Networks Lab Manual Add a server to the 2nd network. Here is already existed image file. 31 Data Communication and Computer Networks Lab Manual Created a file with name Fatima.html. 32 Data Communication and Computer Networks Lab Manual Do the following code in the file and add a picture from your PC. 33 Data Communication and Computer Networks Lab Manual Here is new added picture. 34 Data Communication and Computer Networks Lab Manual 35 Data Communication and Computer Networks Lab Manual 36 Data Communication and Computer Networks Lab Manual Lab 8 Implementation of FTP Protocol Figure: Create a following network by combining 2 different networks with routers Assign IP addresses and default gateway to each PC and server in the networks. 37 Data Communication and Computer Networks Lab Manual Assign default gate way to both ports of router. 38 Data Communication and Computer Networks Lab Manual On the server open the services section, in the services section go to FTP section, and assign username and password and allow permissions such as read, write, delete, rename, list and then add. 39 Data Communication and Computer Networks Lab Manual Go to any PC, open command prompt, use command ftp 192.168.1.4 . Give username and password and login. Now use different commands: Dir for all directories files information. ? for help and all commands. 40 Data Communication and Computer Networks Lab Manual Use get command for downloading file. Create a file on any PC in the text editor and save it with .txt extension. Use put command to upload a file using syntax put filename.extension. Use can see the file is uploaded in directory with name DCCN.txt. 41 Data Communication and Computer Networks Lab Manual Rename file using the command rename oldfilename newfilename. You can see the file DCCN.txt is now rename as OOP.txt. Use pwd command to print working directory. Currently I am working in ftp directory. Use cd command to change the current directory using syntax cd dirname I changed my directory from ftp to http. 42 Data Communication and Computer Networks Lab Manual Use help command to get all commands and any help regarding commands. Use passive command to change the mode of protocol. It is a command to the FTP server requesting a high order port for data transfer. A passive transfer is one in which the FTP data over these high order ports while control is maintained in the lower ports. 43 Data Communication and Computer Networks Lab Manual Now login in any PC of 2nd network and use dir command to check the file is available to other users also that we have uploaded in the network 1. Now the user xyz want to delete file but it can’t because we only provide it read write and list permission. Now the user abc want to delete file and it can because we provide it all permissions. 44 Data Communication and Computer Networks Lab Manual Lab 9 Implementation of DNS and HTTP Protocol Figure: Create a following network by combining 2 different networks with routers. 45 Data Communication and Computer Networks Lab Manual Assign each PC the IP address, default gateway, DNS server IP address to both networks. 46 Data Communication and Computer Networks Lab Manual Assign each Server the IP address and default gateway. 47 Data Communication and Computer Networks Lab Manual IN both servers google and facebook, go to the services HTTP, edit index file with the title name FaceBook. 48 Data Communication and Computer Networks Lab Manual Go to the DNS server, in the services section, go to the DNS section turn on DNS service and add both servers google and Facebook by adding name and Ip address. 49 Data Communication and Computer Networks Lab Manual Now go to any PC in the browser search by name as follows www.facebook.com and go. 50 Data Communication and Computer Networks Lab Manual Lab 10 Implementation of Gmail using Email Protocol Create a topology using 2 different network Ips. Assign IP address to each PC and servers. Also assign default gateway to both port of routers and also to each PC and servers. 51 Data Communication and Computer Networks Lab Manual Assign IP address and default gateway and DNS server address to each PC. On the DNS server using DNS protocol add IP address and name of Gmail. 52 Data Communication and Computer Networks Lab Manual On the Gmail server using Email service add two different users along with their passwords also assign domain name. 53 Data Communication and Computer Networks Lab Manual Go to any PC, in the email section configure mail, by assigning email addresses and username password. Also assign incoming and outgoing mail server. 54 Data Communication and Computer Networks Lab Manual Now compose a mail by sending a mail from azka to Tooba. 55 Data Communication and Computer Networks Lab Manual