R.M.D. ENGINEERING COLLEGE (An Autonomous Institution) R.S.M. Nagar, Kavaraipettai -601 206 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 22CS401 COMPUTER NETWORKS (Lab Integrated) LAB MANUAL ACADEMIC YEAR: 2025-26 4 th SEMESTER B.E. COMPUTER SCIENCE AND ENGINEERING ANNA UNIVERSITY - CHENNAI R.M.D. ENGINEERING COLLEGE (An Autonomous Institution) R.S.M. Nagar, Kavaraipettai -601 206 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 22CS401 COMPUTER NETWORKS (Lab Integrated) LAB MANUAL R2024 2025-2026 EVEN SEMESTER Prepared by Dr.R.Sasikumar Professor / CSE & Mrs.G.Manisha Asst. Prof / CSE Approved by Dr.P.Ezhumalai Professor & Head / CSE Approved by Dr.N.ANBUCHEZHIAN Principal R.M.D. ENGINEERING COLLEGE (An Autonomous Institution) RSM Nagar, Kavaraipettai – 601 206 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DEPARTMENT VISION To produce intellectual software professionals by empowering them to compete globally towards professional excellence DEPARTMENT MISSION To impart modern teaching methodologies to provide quality technical education to the students To establish a work environment to practice new software tools and languages To identify industrial requirements and produce employable engineers To engage students and staff members in research to meet the requirements of software industry PROGRAMME EDUCATIONAL OBJECTIVES PEO 1 To enable graduates to pursue higher education and research, or have a successful career in industries associated with Computer Science and Engineering, or as entrepreneurs. PEO 2 To ensure that graduates will have the ability and attitude to adapt to emerging technological changes. PEO 3 To enable graduates to value social responsibility and possess strong leadership and interpersonal abilities. PROGRAMME SPECIFIC OUTCOMES (PSOs) PSO 1 To analyze, design and develop computing solutions by applying foundational concepts of Computer Science and Engineering. PSO 2 To apply software engineering principles and practices for developing quality software for scientific and business applications. PSO 3 To adapt to emerging Information and Communication Technologies (ICT) to innovate ideas and solutions to existing/novel problems. PROGRAM OUTCOMES (POS) PO1: Engineering Knowledge: Apply knowledge of mathematics, natural science, computing, engineering fundamentals and an engineering specialization as specified in WK1 to WK4 respectively to develop to the solution of complex engineering problems. PO2: Problem Analysis: Identify, formulate, review research literature and analyze complex engineering problems reaching substantiated conclusions with consideration for sustainable development. (WK1 to WK4) PO3: Design/Development of Solutions: Design creative solutions for complex engineering problems and design/develop systems/components/processes to meet identified needs with consideration for the public health and safety, whole-life cost, net zero carbon, culture, society and environment as required. (WK5) PO4: Conduct Investigations of Complex Problems: Conduct investigations of complex engineering problems using research-based knowledge including design of experiments, modelling, analysis & interpretation of data to provide valid conclusions. (WK8). PO5: Engineering Tool Usage: Create, select and apply appropriate techniques, resources and modern engineering & IT tools, including prediction and modelling recognizing their limitations to solve complex engineering problems. (WK2 and WK6) PO6: The Engineer and The World: Analyze and evaluate societal and environmental aspects while solving complex engineering problems for its impact on sustainability with reference to economy, health, safety, legal framework, culture and environment. (WK1, WK5, and WK7). PO7: Ethics: Apply ethical principles and commit to professional ethics, human values, diversity and inclusion; adhere to national & international laws. (WK9) PO8: Individual and Collaborative Team work: Function effectively as an individual, and as a member or leader in diverse/multi-disciplinary teams. PO9: Communication: Communicate effectively and inclusively within the engineering community and society at large, such as being able to comprehend and write effective reports and design documentation, make effective presentations considering cultural, language, and learning differences PO10: Project Management and Finance: Apply knowledge and understanding of engineering management principles and economic decision-making and apply these to one’s own work, as a member and leader in a team, and to manage projects and in multidisciplinary environments. PO11: Life-Long Learning: Recognize the need for, and have the preparation and ability for i) independent and life-long learning ii) adaptability to new and emerging technologies and iii) critical thinking in the broadest context of technological change. (WK8) R.M.D. ENGINEERING COLLEGE (An Autonomous Institution) R.S.M. Nagar, Kavaraipettai -601 206 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING INDEX Sl. No. Name of the Exercise 1. Practice different network commands available in Windows and Linux Operating Systems and troubleshoot the network. 2. Network configuration commands using Linux. 3. Error detection and correction mechanisms. 4. Flow control mechanisms. 5. Multi-client chatting in TCP and UDP using Socket programming ( C / Java) 6. Implementation of HTTP, Web Caching, FTP using socket programming. 7. Develop a DNS client server to resolve the given host name or IP address. 8. Simulation of unicast routing protocols. 9. Observing Packets across the network and Performance Analysis of various Routing protocols. 10. Simulation of Transport layer Protocols and analysis of congestion control techniques in the network. Content beyond the Syllabus 11 Simulation of Link State Routing using Dijkstra's Algorithm EX.NO:1 Learn to use commands like tcpdump, netstat, ifconfig, nslookup and traceroute. Capture ping and traceroute PDUs using a network protocol analyzer and examine. AIM: To Learn to use commands like tcpdump, netstat, ifconfig, nslookup and traceroute ping. PRE LAB DISCUSSION: Tcpdump: The tcpdump utility allows you to capture packets that flow within your network to assist in network troubleshooting. The following are several examples of using tcpdump with different options. Traffic is captured based on a specified filter. Netstat Netstat is a common command line TCP/IP networking available in most versions of Windows, Linux, UNIX and other operating systems. Netstat provides information and statistics about protocols in use and current TCP/IP network connections. ipconfig ipconfig is a console application designed to run from the Windows command prompt. This utility allows you to get the IP address information of a Windows computer. From the command prompt, type ipconfig to run the utility with default options. The output of the default command contains the IP address, network mask, and gateway for all physical and virtual network adapter. nslookup The nslookup (which stands for name server lookup ) command is a network utility program used to obtain information about internet servers. It finds name server information for domains by querying the Domain Name System. Trace route: Traceroute is a network diagnostic tool used to track the pathway taken by a packet on an IP network from source to destination. Traceroute also records the time taken for each hop the packet makes during its route to the destination Commands: Tcpdump: Display traffic between 2 hosts: To display all traffic between two hosts (represented by variables host1 and host2): # tcpdump host host1 and host2 Display traffic from a source or destination host only: To display traffic from only a source (src) or destination (dst) host: # tcpdump src host # tcpdump dst host Display traffic for a specific protocol Provide the protocol as an argument to display only traffic for a specific protocol, for example tcp, udp, icmp, arp # tcpdump protocol For example to display traffic only for the tcp traffic : # tcpdump tcp Filtering based on source or destination port To filter based on a source or destination port: # tcpdump src port ftp # tcpdump dst port http 2. Netstat Netstat is a common command line TCP/IP networking available in most versions of Windows, Linux, UNIX and other operating systems. Netstat provides information and statistics about protocols in use and current TCP/IP network connections. The Windows help screen (analogous to a Linux or UNIX for netstat reads as follows: displays protocol statistics and current TCP/IP network connections. #netstat 3. ipconfig In Windows, ipconfig is a console application designed to run from the Windows command prompt. This utility allows you to get the IP address information of a Windows computer. Using ipconfig From the command prompt, type ipconfig to run the utility with default options. The output of the default command contains the IP address, network mask, and gateway for all physical and virtual network adapter. #ipconfig 4. nslookup The nslookup (which stands for name server lookup ) command is a network utility program used to obtain information about internet servers. It finds name server information for domains by querying the Domain Name System. The nslookup command is a powerful tool for diagnosing DNS problems. You know you're experiencing a DNS problem when you can access a resource by specifying its IP address but not its DNS name. #nslookup 5. Trace route: Traceroute uses Internet Control Message Protocol (ICMP) echo packets with variable time to live (TTL) values. The response time of each hop is calculated. To guarantee accuracy, each hop is queried multiple times (usually three times) to better measure the response of that particular hop. Traceroute is a network diagnostic tool used to track the pathway taken by a packet on an IP network from source to destination. Traceroute also records the time taken for each hop the packet makes during its route to the destination. Traceroute uses Internet Control Message Protocol (ICMP) echo packets with variable time to live (TTL) values. The response time of each hop is calculated. To guarantee accuracy, each hop is queried multiple times (usually three times) to better measure the response of that particular hop. Traceroute sends packets with TTL values that gradually increase from packet to packet, starting with TTL value of one. Routers decrement TTL values of packets by one when routing and discard packets whose TTLvalue has reached zero, returning the ICMP error message ICMP Time Exceeded. For the first set of packets, the first router receives the packet, decrements the TTL value and drops the packet because it then has TTL value zero. The router sends an ICMP Time Exceeded message back to the source. The next set of packets are given a TTL value of two, so the first router forwards the packets, but the second router drops them and replies with ICMP Time Exceeded. Proceeding in this way, traceroute uses the returned ICMP Time Exceeded messages to build a list of routers that packets traverse, until the destination is reached and returns an ICMP Echo Reply message. With the tracert command shown above, we're asking tracert to show us the path from the local computer all the way to the network device with the hostname www.google.com #tracert google.com 6. Ping: The ping command sends an echo request to a host available on the network. Using this command, you can check if your remote host is responding well or not. Tracking and isolating hardware and software problems. Determining the status of the network and various foreign hosts. The ping command is usually used as a simple way to verify that a computer can communicate over the networkwith another computer or network device. The ping command operates by sending Internet Control Message Protocol (ICMP) Echo Request messages to the destination computer and waiting for a response # ping172.16.6.2 RESULT: Thus the various networks commands like tcpdump, netstat, ifconfig, nslookup and tracerouteping are executed successfully. EX.NO:2 Learn to use Network configuration commands using Linux. AIM: To Learn to use Network configuration commands using Linux. 1. ifconfig Command ifconfig (interface configurator) command is used to initialize an interface, assign IP Address to interface and enable or disable interface on demand. With this command, you can view IP Address and Hardware / MAC address assign to interface and also MTU (Maximum transmission unit) size. # ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:28:FD:4C inet addr:192.168.50.2 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe28:fd4c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6093 errors:0 dropped:0 overruns:0 frame:0 carrier:0 KiB) TX packets:4824 errors:0 dropped:0 overruns:0 collisions:0 txqueuelen:1000 RX bytes:6125302 (5.8 MiB) TX bytes:536966 (524.3 Interrupt:18 Base address:0x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:480 (480.0 b) TX bytes:480 (480.0 b) 2. Ping Command Ping ( Packet INternet Groper ) command is the best way to test connectivity between two nodes . Whether it is Local Area Network ( LAN ) or Wide AreaNetwork ( WAN ). Ping uses ICMP ( Internet Control Message Protocol ) to communicate to other devices. You can ping hostname or ip address using the below commands. 3. Traceroute Command traceroute is a network troubleshooting utility that shows the number of hops taken to reach a destination also determines packets traveling path. Below we are tracing the route to the global DNS server IP Address and able to reach destination also shows the path of that packet is traveling. # traceroute 4.2.2.2 traceroute to 4.2.2.2 (4.2.2.2), 30 hops max, 60 byte packets 1 192.168.50.1 (192.168.50.1) 0.217 ms 0.624 ms 0.133 ms 2 227.18.106.27.mysipl.com (27.106.18.227) 2.343 ms 1.910 ms 1.799 ms 3 221-231-119-111.mysipl.com (111.119.231.221) 4.334 ms 4.001 ms 5.619 ms 4 10.0.0.5 (10.0.0.5) 5.386 ms 6.490 ms 6.224 ms 5 gi0-0-0.dgw1.bom2.pacific.net.in (203.123.129.25) 7.798 ms 7.614 ms 7.378 ms 6 115.113.165.49.static-mumbai.vsnl.net.in (115.113.165.49) 10.852 ms 5.389 ms 4.322 ms 7 ix-0-100.tcore1.MLV-Mumbai.as6453.net (180.87.38.5) 5.836 ms 5.590 ms 5.503 ms 8 if-9-5.tcore1.WYN-Marseille.as6453.net (80.231.217.17) 216.909 ms 198.864 ms 201.737 ms 9 if-2-2.tcore2.WYN-Marseille.as6453.net (80.231.217.2) 203.305 ms 203.141 ms 202.888 ms 10 if-5-2.tcore1.WV6-Madrid.as6453.net (80.231.200.6) 200.552 ms 202.463 ms 202.222 ms # ping 4.2.2.2 PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data. 64 bytes from 4.2.2.2: icmp_seq=1 ttl=44 time=203 ms 64 bytes from 4.2.2.2: icmp_seq=2 ttl=44 time=201 ms 64 bytes from 4.2.2.2: icmp_seq=3 ttl=44 time=201 ms OR # ping www.tecmint.com PING tecmint.com (50.116.66.136) 56(84) bytes of data. 64 bytes from 50.116.66.136: icmp_seq=1 ttl=47 time=284 ms 64 bytes from 50.116.66.136: icmp_seq=2 ttl=47 time=287 ms 64 bytes from 50.116.66.136: icmp_seq=3 ttl=47 time=285 ms # netstat -r Kernel IP routing table 11 if-8-2.tcore2.SV8-Highbridge.as6453.net (80.231.91.26) 205.446 ms 215.885 ms 202.867 ms 12 if-2-2.tcore1.SV8-Highbridge.as6453.net (80.231.139.2) 202.675 ms 201.540 ms 203.972 ms 13 if-6-2.tcore1.NJY-Newark.as6453.net (80.231.138.18) 203.732 ms 203.496 ms 202.951 ms 14 if-2-2.tcore2.NJY-Newark.as6453.net (66.198.70.2) 203.858 ms 203.373 ms 203.208 ms 15 66.198.111.26 (66.198.111.26) 201.093 ms 63.243.128.25 (63.243.128.25) 206.597 ms 66.198.111.26 (66.198.111.26) 204.178 ms 16 ae9.edge1.NewYork.Level3.net (4.68.62.185) 205.960 ms 205.740 ms 205.487 ms 17 vlan51.ebr1.NewYork2.Level3.net (4.69.138.222) 203.867 ms vlan52.ebr2.NewYork2.Level3.net (4.69.138.254) 202.850 ms vlan51.ebr1.NewYork2.Level3.net (4.69.138.222) 202.351 ms 18 ae-6-6.ebr2.NewYork1.Level3.net (4.69.141.21) 201.771 ms 201.185 ms 201.120 ms 19 ae-81-81.csw3.NewYork1.Level3.net (4.69.134.74) 202.407 ms 201.479 ms ae-92-92.csw4.NewYork1.Level3.net (4.69.148.46) 208.145 ms 20 ae-2-70.edge2.NewYork1.Level3.net (4.69.155.80) 200.572 ms ae-4-90.edge2.NewYork1.Level3.net (4.69.155.208) 200.402 ms ae-1-60.edge2.NewYork1.Level3.net (4.69.155.16) 203.573 ms 21 b.resolvers.Level3.net (4.2.2.2) 199.725 ms 199.190 ms 202.488 ms 4. Netstat Command Netstat ( Network Statistic ) command displays connection info, routing table information, etc. To display routing table information use option as -r. Destination Window irtt Gateway Iface Genmask Flags MSS 192.168.50.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 default 192.168.50.1 0.0.0.0 UG 0 0 0 eth0 # route Kernel IP routing table # dig www.tecmint.com ; <<>> DiG 9.8.2rc1-RedHat-9.8.2- 0.10.rc1.el6 <<>> www.tecmint.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER< # nslookup www.tecmint.com Server: 4.2.2.2 Address: 4.2 2.2#53 Non-authoritative answer: www.tecmint.com canonical name = tecmint.com. Name: tecmint.com Address: 50.116.66.136 5. Dig Command Dig ( domain information groper ) query DNS related information like A Record, CNAME , MX Record, etc. This command is mainly used to troubleshoot DNS-related queries. 6. Nslookup Command nslookup command is also used to find out DNS-related queries. The following examples show A Record ( IP Address ) of tecmint.com 7. Route Command route command also shows and manipulates the ip routing table. To see the default routing table in Linux , type the following command. Destination Ref Use Iface Gateway Genmask Flags Metric 192.168.50.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 1002 0 0 eth0 default 192.168.50.1 0.0.0.0 UG 0 0 0 eth0 # host www.google.com www.google.com has address 173.194.38.180 www.google.com has address 173.194.38.176 www.google.com has address 173.194.38.177 www.google.com has address 173.194.38.178 www.google.com has address 173.194.38.179 www.google.com has IPv6 address 2404:6800:4003:802::1014 # ethtool eth0 Settings for eth0: Current message level: 0x00000007 (7) Link detected: yes 8. Host Command host command to find a name to IP or IP to name in IPv4 or IPv6 and also query DNS records. 9. Arp Command ARP (Address Resolution Protocol) is useful to view/add the contents of the kernel’s ARP tables . To see the default table use the command as. # arp -e Address Mask HWtype HWaddress Flags Iface 192.168.50.1 ether 00:50:56:c0:00:08 C eth0 10. Ethtool Command ethtool is a replacement for mii-tool . It is to view, setting speed and duplex of your Network Interface Card ( NIC ). You can set duplex permanently in /etc/sysconfig/network-scripts/ifcfg-eth0 with ETHTOOL_OPTS variable. 11. Iwconfig Command iwconfig command in Linux is used to configure a wireless network interface . You can see and set the basic Wi-Fi details like SSID channel and encryption. You can refer man page of iwconfig to know more. # hostname tecmint.com 12. Hostname Command The hostname is to identify in a network. Execute the hostname command to see the hostname of your box. You can set hostname permanently in /etc/sysconfig/network Need to reboot box once set a proper hostname. RESULT: Thus the various networks configuration commands are executed successfully. # iwconfig [interface] EX.NO 3 Simulation of Error Correction Code(CRC) AIM : To Simulation of Error Correction Code using Java. Theory: Cyclic redundancy check (CRC) Unlike checksum scheme, which is based on addition, CRC is based on binary division. In CRC, a sequence of redundant bits, called cyclic redundancy check bits, are appended to the end of data unit so that the resulting data unit becomes exactly divisible by a second, predetermined binary number. At the destination, the incoming data unit is divided by the same number. If at this step there is no remainder, the data unit is assumed to be correct and is therefore accepted. A remainder indicates that the data unit has been damaged in transit and therefore must be rejected. Example : Procedure: 1. Open the editor and type the program for error detection 2. Get the input in the form of bits. 3. Append the redundancy bits. 4. Divide the appended data using a divisor polynomial. 5. The resulting data should be transmitted to the receiver. 6. At the receiver the received data is entered. 7. The same process is repeated at the receiver. 8. If the remainder is zero there is no error otherwise there is some error in the received bits 9. Run the program. Program: import java.io.*; class CRC { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter Generator:"); String gen = br.readLine(); System.out.println("Enter Data:"); String data = br.readLine(); String code = data; while(code.length() < (data.length() + gen.length() - 1)) code = code + "0"; code = data + div(code,gen); System.out.println("The transmitted Code Word is: " + code); System.out.println("Please enter the received Code Word: "); String rec = br.readLine(); if(Integer.parseInt(div(rec,gen)) == 0) System.out.println("The received code word contains no errors."); else System.out.println("The received code word contains errors."); } static String div(String num1,String num2) { int pointer = num2.length(); String result = num1.substring(0, pointer); String remainder = ""; for(int i = 0; i < num2.length(); i++) { if(result.charAt(i) == num2.charAt(i)) remainder += "0"; else remainder += "1"; } while(pointer < num1.length()) { if(remainder.charAt(0) == '0') { remainder = remainder.substring(1, remainder.length()); remainder = remainder + String.valueOf(num1.charAt(pointer)); pointer++; } result = remainder; remainder = ""; for(int i = 0; i < num2.length(); i++) { if(result.charAt(i) == num2.charAt(i)) remainder += "0"; else remainder += "1"; } } return remainder.substring(1,remainder.length()); } } Result: Thus the error detection and error correction is implemented successfully