Netstat bytes count doesn't match with Wireguard

Manikandan Thiagarajan tmani at prosimo.io
Tue Sep 14 20:53:22 UTC 2021


Hi,

I use the Wireguard Go C API to integrate with my packet tunnel network extension to forward traffic to the WG tunnel on Mac OS. I also use the wgGetConfig() API to get tunnel status information.

During my testing, I noticed some differences between what the netstat -ib reports and what Wireguard reports as rx and tx bytes. Usually the Wireguard numbers are higher than netstat numbers.

Is it normal to see so much difference? Can you be able to provide me some information or point me to a doc on how Wireguard calculates the tx/rx bytes?


Netstat -ib output:
Name  Mtu   Network       Address            Ipkts Ierrs     Ibytes    Opkts Oerrs     Obytes  Coll
utun2 1420  <Link#23>                          130     0      42713      180     0      15245     0
utun2 1420  100.101.113.5 100.101.113.54       130     -      42713      180     -      15245     -

Wireguard output:
last_handshake_time_sec=1631646164
last_handshake_time_nsec=79839000
tx_bytes=21328
rx_bytes=47980
persistent_keepalive_interval=0
allowed_ip=155.2.135.28/32
allowed_ip=192.168.128.4/32

Thanks,
Mani


More information about the WireGuard mailing list