Is there a way to keep an account of which processes generate how much network traffic?

Ben Woods woodsb02 at gmail.com
Mon May 30 09:07:48 UTC 2016


On Monday, 30 May 2016, Yuri <yuri at rawbw.com
<javascript:_e(%7B%7D,'cvml','yuri at rawbw.com');>> wrote:

> There is vnstat that does this by interface.
>
> But is there a way to do this by the application? This is because nearly
> every packet that is sent through the system is sent on behalf of some
> process running on the system.
>
> It would be nice to be able to see which applications (in general sense)
> generate most traffic.
>
> I am fully aware that the link between pid and an "application" is vague
> because some processes are run through some cryptic command lines. I am
> just interested if anything exists in this area at all.
>
>
> Yuri
>

Hi Yuri,

There is an application called nethogs which does this on Linux, but the
website says it makes heavy use of Linuxisms so won't work on BSD. I had a
quick look at the code and couldn't immediately recognise the Linuxisms in
question, but haven't done a thorough look.

On FreeBSD, I tend to filter traffic by src and destination ip/port to
determine how much traffic an application is using.

Easiest solution I can think of: Use net-mgmt/darkstat.
https://unix4lyfe.org/darkstat/

Slightly more complicated solution, but with potentially more power for
filtering the data: Netflow/NfDump/NfSen
https://forums.freebsd.org/threads/49724/

Good luck!

Regards,
Ben


-- 

--
From: Benjamin Woods
woodsb02 at gmail.com


More information about the freebsd-net mailing list