How to Fix Packet Loss

What causes it - and what to do about it

Packet loss occurs when your network connection loses information while it's in transit. It can make your network connection seem slower than it should be and reduces the reliability of network communication with both local and remote devices. Stopping packet loss should be at the top of the list for anyone looking to improve a troublesome network.

What Is Packet Loss?

While running water is often used as an analogy for network traffic, information is not transmitted across the network as a continuous stream. Rather, it's sent as a series of discrete units, called packets. These units are like individual pages in a book. Together, they have some meaning, but only when connected with the other pages in the right order do they create a coherent whole. When your network connection loses packets, the full book cannot be constructed. Packets can also arrive incomplete, damaged, or otherwise flawed, causing them to be useless. The fix for this is typically resending the lost packet.

Most networks have some very low level of packet loss from time to time. The vicissitudes of network connections are such that a packet dropped every once in a while is somewhat inevitable. That said, on a properly functioning network, packet loss happens rarely enough that it doesn't affect the network connection's effectiveness.

If you're seeing higher levels of packet loss across your network, you'll need to take steps to fix that. To return to our water analogy, significant packet loss is like a badly leaking pipe. It needs to be fixed before any other improvements can be made.

What Causes Packet Loss on Your Network

Packet loss doesn't happen for just one reason. Diagnosing the cause of packet loss on your network will tell you what you need to fix.

  • Network bandwidth and congestion: A primary cause of packet loss is insufficient network bandwidth for the desired connection. This happens when too many devices are attempting to communicate on the same network.
  • Insufficient hardware: Any hardware on your network that routes packets can cause packet loss. Routers, switches, firewalls, and other hardware devices are the most vulnerable. If they cannot "keep up" with the traffic you're routing across them, they will drop packets. Think of it as a waiter with their arms full: if you ask them to pick up another plate, they will probably drop one or more other plates.
  • Damaged cables: Packet loss can occur on Layer 1, the physical network layer. If your ethernet cables are damaged, improperly wired, or too slow to handle the network's traffic, they will "leak" packets.
  • Software bugs: No software is flawless. The firmware in your network hardware or your computer software can have bugs that cause packet loss. In this case, there's little for the consumer to do. You might attempt to fix the problem yourself, but often the only way to fix the issue is through a firmware patch from the vendor supplying the hardware. Be sure to report suspected bugs as you find them to encourage vendors to fix the problem.

    Detecting Packet Loss

    There are a number of software applications that can detect packet loss across a network. They work by "sniffing" packets in some way, either by analyzing their trip time or looking into the packets. The simplest way to discover if packet loss exists is by pinging devices on your network.

    1. On Windows, open a command prompt window and use the ping command to target your router. For example, if your router's local IP address is 127.0.0.1, the following command would ping the router:

      ping 127.0.0.1 -t

      On macOS or Linux, open a Terminal window and use the following command:

      ping 127.0.0.1

      The only difference is the missing -t at the end of the command.

    2. After the ping command processes a sufficient number of packets (at least 10), press Ctrl+C to stop the command.

    3. Look to see if there was any packet loss. If this specific connection between pinging device and the target is functioning correctly, you should see 0% packet loss.

      --- 127.0.0.1 ping statistics ---
      27 packets transmitted, 27 packets received, 0.0% packet loss
      round-trip min/avg/max/stddev = 1.820/8.351/72.343/14.186 ms
    4. That's it.

    There are also more advanced tools available for detecting packet loss.

    1. The tcpdump command on macOS and Linux is dramatically more powerful than ping. It's a little overwhelming to get used to, but the following command will capture packets and then calculate the amount of packet loss:

      tcpdump -i any
    2. This will run tcpdump over any network connection. It can also be run with -i eth0 to only capture the primary network interface, or with -c 10 to only capture ten packets.

    3. After the command runs, look at the bottom line to see if any packets were lost.

      17 packets captured
      85 packets received by filter
      0 packets dropped by kernel
    4. Ideally, you should see 0 packets were lost.

    On Windows, you can either use tcpdump through the Bash shell on Windows 10 or run Wireshark.

    The process of detecting packets is fairly low tech. Once you've established a way to check communications across the network, you need to follow a practice of isolation and elimination to determine the source and cause of the packet loss. This will require pinging a majority of devices on the network in most cases, or running scripts that accomplish the same. Knowledge of the network's topology will be hugely helpful here.

    Determining the Cause of Packet Loss

    To determine the root cause of packet loss, you should start at the easiest problem to detect and work your way backward.

    First, check the ethernet connection between devices. Check for obvious signs of physical damage and miswiring. Are those cables functioning properly? Does switching out cables solve the problem? Check routers and switches in a similar way.

    Second, determine if there's sufficient bandwidth to handle the required devices on your network. Is any one piece of hardware handling significantly more connections than it should? This is often a process of find and replace until the problem resolves. You can also use a "known good" switch and router, swapping it with the potentially problematic devices on the network to see if the packet loss disappears when a specific device is removed.

    How to Fix Packet Loss on Your Network

    Once you've determined the cause of packet loss, there are two fixes that can be applied.

    The first involves replacing the problematic hardware. If your investigation leads to a hardware device working incorrectly, replace it.

    If the packet loss is being caused by software bugs, you'll need to try and fix the bug yourself, try and work around the bug, or report the bug to the vendor and hope they fix it. For in-house software, it can be easier to find a fix. For third-party software, it depends. If you're a major customer, you might be able to muscle a fix out. If not, you might be stuck waiting while you try to use a workaround.

    Final Thoughts

    Packet loss often presents as things running slowly on the network. Of course, something so vague can be caused by a variety of root causes. If you're diagnosing an underperforming network, packet loss should be at the top of your list. Once packet loss is eliminated as a possibility, you can move on to more complex problems.