Networking Maths

Quick reference for some common and simple equations used in networking, I’ll be adding more as I use/forget them.

Number of hosts or subnets: 2^n
Number of “usable” hosts or subnets: 2^n - 2

(n being the number of borrowed bits)

Number of links required for a full mesh network: n(n-1)/2 or (n^2 - n)/2

(n being the number of nodes in the topology)

Classful networks

Class	Leading Bits	Start		End		   Networks          Addresses
A	     0		0.0.0.0		127.255.255.255	   128 (2^7)         16,777,216 (2^24)
B	     10		128.0.0.0	191.255.255.255	   16,384 (2^14)     65,536 (2^16)
C	     110	192.0.0.0	223.255.255.255	   2,097,152 (2^21)  256 (2^8)
D (mc)	     1110	224.0.0.0	239.255.255.255	   n/a               n/a
E (reserved) 1111	240.0.0.0	255.255.255.255	   n/a               n/a


EIGRP Metric

I doubt this will be used often, but it may be useful when trying to tweak the metric of a particular route by changing the delay (or bandwidth).

The full metic:

[K1 * bandwidth + (K2 * bandwidth) / (256 - load) + K3 * delay] * [K5 / (reliability + K4)]

However,  the bandwidth and delay values aren’t taken directly from the show commands, rather:

bandwidth = (10^7 / InterfaceBandwidth) * 256

delay = (InterfaceDelay / 10) * 256 (this gives us the delay in tens of microseconds * 256)

(InterfaceBandwidth and InterfaceDelay refer to the vlaues given from sh interface)

Given the default K values of: K1 = 1, K2 = 0, K3 = 1, K4=  0, K5 = 0, the metric becomes much simpler: bandwidth + delay

Another interesting fact, taken from the Cisco EIGRP docs:

Cisco routers do not perform floating point math, so at each stage in the calculation, you need to round down to the nearest integer to properly calculate the metrics.


About this entry