0% found this document useful (0 votes)
6 views

Lab3 2201CS11

Uploaded by

uk.uktalks
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lab3 2201CS11

Uploaded by

uk.uktalks
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Lab 04: Assignment: Ping Utility Analysis

Objective:

In this assignment, you will analyze the ping utility, a fundamental network diagnostic tool. You will
explore its functionality, usage, and output, and demonstrate your understanding through a series of
tasks.

Tasks:

1. Ping Basics

- Explain the purpose of the ping utility and its basic syntax.

Ans : A ping (Packet Internet or Inter-Network Groper) is a basic Internet program that allows a user
to test and verify if a particular destination IP address exists and can accept requests in computer
network administration. It is also used diagnostically to ensure that the host computer the user is
trying to reach is operating.

Syntax : ping <website>

- Provide examples of how to use ping to test connectivity to a website and a local host.

Ans :
ping <website>

ping codeforces
for localhost : ping 127.0.0.1

2. Ping Output Analysis

- Run the command ping (link unavailable) and capture the output.
- Analyze the output, explaining each line and its significance (e.g., packet loss, round-trip time,
etc.).

 Here 32 bytes of data packet is being received and sent. (to 104.26.6.164
(codeforces.com)
 Round trip time for first packet to go to the server and back is 49ms, then 46ms, then 57
ms, and 55 ms
 As we can see here 4 packets were sent and 4 were received so 0 packets were lost and
hence 0% loss.
 TTL : time to live for every packet tells us how many hops is the packet allowed to make (
the number of routers in between)

- Repeat the process for a local host (e.g., ping 127.0.0.1).

Analysis :

 Here 32 bytes of data packet is being received and sent. (to 127.0.0.1(localhost)
 Round trip time for all the packages is <1ms (almost instantaneous because its localhost
running on the same machine)
 As we can see here 4 packets were sent and 4 were received so 0 packets were lost and
hence 0% loss.
 TTL : time to live for every packet tells us how many hops is the packet allowed to make (
the number of routers in between)

3. Ping Options

- Research and explain the following ping options:


- -c (count)
syntax : ping -c <count> <destination>

Use : specifies the number of ping requests to send.


ping -c 4 codeforces.com , will only send 4 packets

- -s (size)

Syntax : ping -s <size> <destination>

Use : sets the size of the ICMP (internet control message protocol) packet's payload in bytes.

- -t (ttl)

Syntax : ping -t <ttl> <destination>

Use: sets the Time To Live (TTL) value for the outgoing packets

- -W (deadline)

Syntax : ping -W <deadline> <destination>

Use : sets a deadline (in seconds) for the ping command to run

- Provide examples of how to use each option.

Examples :

-c : ping -c 4 codeforces.com , will only send 4 packets

-s : ping -s 100 codeforces.com, will send packets of size 100 bytes

-t : ping -t 10 codeforces.com, will send packets with ttl 10

-W : ping -W 10 codeforces.com, will send packets with with a deadline of 10 second

4. Troubleshooting with Ping

- Describe a scenario where ping would be used for network troubleshooting (e.g., connectivity
issues, slow network speeds).

- Explain how to use ping to diagnose the issue, including which options to use and why.

Scenario: A user is experiencing slow internet speeds and intermittent connectivity issues while
trying to access a company's web application.

Let’s assume the website to be iitp.ac.in

To diagnose this issue using ping:


1) Start with a basic ping to the web application's domain:

ping iitp.ac.in

This will help determine if there's basic connectivity and reveal any packet loss.

2) Use the -c option to send a specific number of pings:

ping -c 100 iitp.ac.in

This sends 100 pings, providing a larger sample size to detect intermittent issues.

3) Employ the -s option to test with larger packet sizes:

ping -s 1000 iitp.ac.in

Larger packets can help identify Maximum Transmission Unit or fragmentation issues.

4) Utilize the -i option to set a shorter interval between pings:

ping -i 0.2 iitp.ac.in

This sends pings more frequently, potentially catching brief outages.

5) Combine options for comprehensive testing:

ping -c 1000 -i 0.2 -s 1000 iitp.ac.in

This sends 1000 large packets at short intervals, providing detailed data on connectivity.

By analysing the results, you can:

-> Identify packet loss (indicating connection issues)

-> Assess latency (high times suggest network congestion)

-> Detect variations in response times (pointing to unstable connections)

-> Compare results to known good connections to isolate the problem

This approach helps determine if the issue is with the local network, ISP, or the remote server,
guiding further troubleshooting steps.
5. Develop a ping type utility using Scapy. It should have the following points.

- 1. Basic Functionality

- Ensure the provided code works correctly.

- Test with different destination IPs and counts.

2. Additional Features

- Implement the following features:

- Option to specify TTL (Time-To-Live)

- Option to specify packet size

- Option to specify timeout

- Use Scapy's built-in functions to implement these features.

3. Error Handling

- Add error handling for cases like:

- Invalid destination IP

- Invalid count or TTL values

- Timeout errors

- Use try-except blocks to catch and handle exceptions.

4. Output Formatting

- Improve the output formatting to include:

- Packet loss percentage

- Average RTT (Round-Trip Time)

- Maximum and minimum RTT values

- Use Python's built-in formatting options to create a clean output.

Submission:
Please submit a written report (PDF or Word document) containing your answers to the tasks above.
Include screenshots or output captures where relevant.

For programming you need to create a github page (instruction to be given later)

You might also like