2

Is it possible to measure network traffic (per month, per WAN, per direction) with pfSense/freeBSD?

There are following programs listed https://doc.pfsense.org/index.php/How_can_I_monitor_bandwidth_usage but neither seems to work normally for me. For example, ntopng shows only current flow while BandwidthD can monitor only one interface.

Shame to say, but I still don't know how many bytes I spent with each provider.

I have pfsense installed on my router computer. pfsense is based of freebsd.

1

Install the "vnstat2" package under System/Packages. Then go to Status/Vnstat2. The summary tab will show you information like:

                      rx      /      tx      /     total    /   estimated
 em1:
       Jun '15     64.34 GiB  /   10.39 GiB  /   74.73 GiB  /   98.00 GiB
     yesterday      5.30 GiB  /  373.42 MiB  /    5.66 GiB
         today      2.90 GiB  /  197.29 MiB  /    3.09 GiB  /    3.52 GiB

You can also use "vnstat -i em1 -m" to get monthly stats for a particular interface.

(vnstat is also available for Linux, which is where I learned of it)

0

SNMP (Simple Network Management Protocol) is one typical way to measure network traffic. This page documents some of the aspects of using SNMP in conjunction with pfSense.

I'm actually using the bsnmpget component of FreeBSD's bsnmpd SNMP implementation in this example, but most any SNMP suite will permit you to do things like:

$ # query the number of interfaces present:
$ bsnmpget ifNumber.0
ifNumber.0 = 6
$ for iface in $(jot $(bsnmpget -o quiet ifNumber.0))
do
     bsnmpget ifName[$iface]
     bsnmpget ifInOctets[$iface]
     bsnmpget ifOutOctets[$iface]
     printf -- '--\n'
done
ifName[1] = em0
ifInOctets[1] = 1430450040
ifOutOctets[1] = 2237124338
--
ifName[2] = lo0
ifInOctets[2] = 46500610
ifOutOctets[2] = 46500610
--
ifName[3] = public
ifInOctets[3] = 1407864504
ifOutOctets[3] = 2237124186
--
ifName[4] = vlan1
ifInOctets[4] = 6933941
ifOutOctets[4] = 0
--
ifName[5] = vlan3
ifInOctets[5] = 5776832
ifOutOctets[5] = 152
--
ifName[6] = vm-public
ifInOctets[6] = 714355313
ifOutOctets[6] = 0
--

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.