Re: Monitoring packet loss

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Thu, 08 Aug 2024 01:02:33 UTC

> On Aug 7, 2024, at 10:06 PM, Alan Somers <asomers@freebsd.org> wrote:
> 
> I'd like to track the rate of packet loss for outbound packets from
> some production servers.  Obviously, that's impossible.  

Can `netstat -di` fulfill ?

The column `Oerrs` and `Drop` ( this is the out dropped packets ) may be what you want.

The drivers also expose some internal stats via sysctl. But different drivers vary.

For example cxgbe(4)
```
# sysctl dev.cxl.0.stats.tx_drop

```

Best regards,
Zhenlei

> But I think
> that the rate of TCP retransmissions should be a close proxy for
> packet loss.  Currently I can only observe TCP retransmissions by
> using wireshark, a slow and laborious process.  But it seems to me
> that the network stack should already have that information.  Would it
> be possible to add a sysctl to expose the total number of
> retransmissions since boot?  This information would be very useful.
> It could reveal for example problems with a model of NIC, or
> congestion on one network segment but not another, or a regression in
> the OS.
> 
> -Alan
>