Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to validate a certain thought with you guys. Assuming that:

  1. The device whose bandwidth I am measuring is an internal, Linux-based, router.
  2. If a NIC is configured to 100mbps, the network is at least 100mbps (that is, the NIC's speed setting it what is limiting the bandwidth, not the network, its latency, etc.)
  3. Elements such as CPU have no impact on bandwidth.

Would it be correct to:

  1. Run ifconfig every 10 seconds
  2. Calculate the bytes TX+RX per second based on the ifconfig's results
  3. Multiply the bytes number by 8 (let's say this is X)
  4. Get the NIC speed settings (10mbps, 100mbps, 1000mbps, this is Y)
  5. Calculate the bandwidth percent usage as: X / (Y*1024*1024)

Is this correct? How does duplicity impact this calculation?

share|improve this question

Theoretically this is correct. However, using ifconfig to retrieve the relevant figures is a very roundabout way to achieve this. You'd be much better off using SNMP. All interfaces have entries in the standard SNMP MIBs, which describe them and also their current connection speed, plus all sorts of relevant counters.

SNMP is available through standard packages in all linux distros I know off, and you can either use tools such as snmpwalk or snmpget (if you just want to retrieve the data) or MRTG or cacti (if you want to graph the data). Especially cacti will allow to apply formulae (formulas?) to your data, and it should be easy to get a percentage graph out of that.

share|improve this answer
Thank you for your response. Actually, I was more focusing on the calculation than the method of obtaining the data. How does duplicity impact the calculation? – Yon Jun 16 '11 at 7:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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