So you want to calculate what the possible bandwidth is for a specific Network Interface on an hourly basis.

I have written a simple BASH script that will do all of the calculations for you, including assisting you with estimating error. You can get this script here

You can also download this script using git.

```
git clone git://github.com/cloudnull/bdwcalc.git
```

Once you have the script, you will have to make it executable:

```
chmod +x bdhcalc.sh
```

Now you simply run it :

```
./bdhcalc.sh
```

You can also specify the network interface and hours active from the command line, which avoids the interactivity:

```
./bdhcalc.sh 10 24
```

## Doing it the HARD Way

Ok So you don't trust my math, or you want to do all of this by hand... Well here is the walk through that will assist you in calculating the possible bandwidth for a specified network interface speed.

The Math Here is fairly simple, good old PEMDAS is all we need. If you do not know what PEMDAS is, you should Google it.

First we determin how many hours we are wanting to compute.

`24`

Hours Computed

To turn hours into computable data we need to multiple the figure by seconds in a minute and minutes in an hour.

`60`

x`60`

x`24`

=`86400`

Now we add in the network Interface speed

`10`

Network Interface Speed`86400`

x`10`

=`864000`

Now that we have our connection speed we have to translate it into Binary. To do this, divide this output by 8, this is because there are 8 bits in a byte and we are determining the link speed of a Network card in Megabytes.

To continue we have our Link speed for `24`

hours on a `10`

megabit adapter.

`864000`

Network Card’s Bits for the given time`8`

Bits in a Byte`864000`

/`8`

=`108000`

Your 10 Megabit Network Card is capable of 108000 MB in `24`

hours.

From this last computation we have the total Megabytes your `10`

Megabit Network interface is capable of in `24`

` hours. However, to translate this into a more legible format we can convert this quotient into Gigabytes. To do this we have to divide the quotient by `1024`

, as there are `1024`

Megabytes in a Gigabyte.

`108000`

Megabytes Per Month`1024`

Megabytes in a Gigabyte`108000`

/`1024`

=`105.4687`

:*(Rounded to 4 decimal Places)*

To this end we can determine that your Network card is capable of pushing `105.4687`

Gigabytes of bandwidth in a month. Though it should be noted that this is the capability, the real word overall usage will be less. Even if you did run at full speed for an entire `24`

hour period, the true value would still be a little lower and would never be the same. This is because the network link speed is determined by the settings for the NIC, but is controlled by the operating system. Essentially there are a tun of veriables that could effect the Link Speed.

Here are some basic examples : Reboot, Service Restart, High CPU load, High Memory Usage, Network slowdown, Network Trouble, or some kind of Network hiccup.

To account for these variables, I add a 7% margin of error to the equation, which gives me what I determine to be the Real World Bandwidth possible.

Following the previous example here is our usage in Gigabytes with the margin of error.

`105.4687`

x`.07`

=`7.3828`

:*(Rounded to 4 decimal Places)*`105.4687`

-`7.3828`

=`98.0859`

:*(Rounded to 4 decimal Places)*

So the real world Bandwidth in `24`

hours should be `98.0859`

Gigabytes.

*If you enjoyed this post or if this has helped you, please comment and make sure to subscribe to my rss feed.*