We track network interface usage statistics using NetworkInterface.GetIPv4Statistics () in .NET 2.0. This does not indicate the correct statistics for the connections over which VPN traffic is tunneled. Instead - in the case of the Cisco VPN client - the use is simply explained by the new network interface, which just looks like an Ethernet connection.
Windows itself (at least Vista) automatically adds VPN statistics to the real physical interface, so looking at the Status dialog box for the original connection shows the correct number of bytes. However, the call results in .NET do not combine traffic together.
Is there a way to associate a VPN connection with the network connection through which it is tunneling? Otherwise, does anyone know which API is used in the status dialog to get the right statistics?
At the moment, we have to manually detect connections that look like their VPNs and add their use to any other connection, and this does not seem like a reliable solution.
source
share