0
votes

I'm trying to calculate packet loss rate from youtube when a video is running.

I sniff packets one by one by Scapy, on eth0 and filter TCP packets with IP header.

To calculate packet loss rate, I should have a number of received packets and a number of sent packets (or excepted packets).

I can easily calculate the number of received packets, but I have a problem with sent packets from youtube.

3

3 Answers

1
votes

I recommend you to try this:

Prepare simulated traffic with low, medium and high traffic. Sicen you will generate traffic you will know in advance total packets that will be sent.

1) First Capture all the traffic with tcpdump.

2) Second Capture all the traffic with scapy (avoid save packets to disk with python).

You will see the following:

  • Low traffic 25% packet loss with scapy.
  • Medium traffic 67% packet loss with scapy.
  • High traffic 89%! packet loss with scape.

Source of data: Computer Security – ESORICS 2011: 16th European Symposium on Research computer security.

I tried my self and I got same results. Without libpcap enabled scapy packet loss was 96%.

Remeber tcpdump is almost the perfect case to compare to.

0
votes

It is a bit more complicated than that, you need to look at retransmissions (packets not acknowledged within their timeout limit).

You cannot see packets from the other side that were lost before they reached you. What you could do is look at the TCP sequence number and see if there are any gaps where you receive packets out of order.

This could be an indication of packet loss but is no guarantee. You may have to do some experimenting with the time limit of how much gap between two packets to allow before counting it as a retransmission and not just out of order arrival for other reasons.

I recommend reading as much as you can about the TCP protocol to understand the details: https://en.wikipedia.org/wiki/Transmission_Control_Protocol

0
votes

After more google search I found an article from the Cisco that explained how to approximate packet loss rate base on the bandwidth.

This is the link, that helps me I hope that can help you too.

Bandwidth, Packets Per Second, and Other Network Performance Metrics

Thanks.