Suppose you have a core switch that connect to several access switches (leaf and spine topology).
If your access switches have each 48 1Gbs ports, you can potentially aggregate 48Gbs of traffic to be passed to the core switch, so you would need a connection between the core switch and each access switches of at least 48Gbs.
Most often, this would be wasteful, because in practice you will never encounter a situation where all ports receive traffic at their maximum rate at the same time.
So we could have an access switch with 48 ports at 1Gbs and an uplink to the core switch at 10Gbs
We then have an over-subscription of 4.8:1
If we use a lag with 2 x 10Gbs ports, we can reduce it to:
48 x 1 Gbs / 2 x 10 Gbs = 2.4:1
When we use it and when not to use?
As you can see it is almost always used when you have several switch layers.
You don't use it:
- when you have only one switch layer (very small networks)
- when you have very specific requirements and wants the full bandwidth available on all ports at any time (and enough money to do so)
How do we calculate these Value?
As in the example above, the over-subscription ratio is the ratio between the upstream bandwidth and the downstream capacity.
As for how to decide which final ratio to attain when designing / upgrading a network, it can be tricky. This is why, from its vast experience and analysis of real networks, Cisco make some recommendation, such as the one you quoted, or the one quoted by @RonMaupin in a comment:
the access to distribution oversubscription ratio is recommended to be
no more than 20:1 (for every 20 access 1 Gbps ports on your access
switch, you need 1 Gbps in the uplink to the distribution switch), and
the distribution to core ratio is recommended to be no more than 4:1
But the correct values for a given network highly depend on the traffic pattern.
For existing network, a close monitoring of the bandwidth used on each port should give enough insight. You can also use netflow / sflow to analyze further what use the bandwidth.
When designing a new network you need to assess the expected traffic.
If this is a configurable parameter, what are the commands which use
to configure?(Cisco or Juniper)
You can see now that it is not something we configure, but it is a design choice.
The ports speed is not always the limiting factor. Most often the switch hardware is not capable of handling the full bandwidth on all its ports simultaneously; this is indeed a kind of internal over-subscription (once again mostly driven by real usage patterns and costs).