I'm currently in the process of learning about QoS, specifically policing and shaping. I've been using network lessons to learn about policing and shaping on a router. Rene (the course creator) says that "Routers are only able to send bits at the physical clock rate".
From my understanding you can change the clock rate on a serial interface, so what's the point of configuring shaping when you can change the clock rate. E.g. you bought a 64 kbps CIR but you've been given a 128 kbps link, you set the clock speed to 512000 bits per second on both routers and it should operate at 64 kbps, no shaping since the router knows the max speed is 64 kbps.
How does shaping work with ethernet interfaces? E.g. if you have a 10 mbps CIR but you've given a 100 mbps link do you need to use shaping in order to shape the traffic down to 10 mbps or could you just use the speed command on the interface and set it to 10 mpbs so the router sees the max bandwidth as 10 mpbs (even though it could be a fast or gig ethernet port)
Any help on this will be greatly appreciated.
Hello @BVC ,
the shaping is implemented on routers in the following way:
In Tc time interval the router is allowed to send Bc bits.
They are sent all at once at the beginning of the time interval at line speed then the router is silent for the rest of the time.
when a new Tc time interval starts the router is allowed to send traffic again.
This action is actually traffic shaping.
changing the clock rate is not the same as shaping.
On LAN interfaces the line speed is 10 Mbps, 100 Mbps or 1Gbps or more.
note: I have simplified by not considering the Be excess burst that are additional bits that can accomodate an initial burst of traffic after long time of silence.
In shaping the traffic in excess is stored in a SW based shaping queue and waits to be sent at next Tc interval.
The algorythm used to meter traffic is called a token bucket.
Hope to help
For Ethernet, you need to shape, if you do not want to utilize all physical port's bandwidth. (Of course, unlike serial links, which have settable clock rates, Ethernet's "speeds" are fixed [depending on the Ethernet standard being used].)
So why shape Ethernet? I.e. if you have, physically, 100 Mbps Ethernet, why shape at 10 Mbps?
Well, firstly, although different Ethernet standards support various "speeds" (e.g. 10, 100, gig, etc.), you might want a "speed" not provided by one of the Ethernet standards. For example, what if you want a "speed" of 25 or 40 Mbps? (Why would you want 25? Well because, for your needs, 10 Mbps isn't enough, and [MetroE/WAN] service provider's cost for 100 Mbps, when you only really need 25, is too costly.)
The second reason to shape, because service providers, generally, some how, enforce your bandwidth allocation. Let's say they provide you 25 Mbps on a 100 Mbps physical link. How do they enforce that? Well, there are usually three options. First, they police (i.e. drop) any "over speed" traffic, second they shape your "over speed" traffic, or third, they charge a premium for going "over speed" (sort of like exceeding a "minutes" allocation on a cell phone contract).
To avoid and/or manage your "over speed" traffic, you'll want to shape it before you hand it off to your service provider. By shaping your traffic, you can "directly" and "immediately" see your bandwidth utilization, and you have the option, using QoS, to manage congestion, if any.
If your situation was such, where you only needed 10 Mbps, then you can, indeed, avoid the need of shaping for 10 Mbps if the link is physically running using the 10 Mbps Ethernet standard. However, if you have a 100 Mbps link, and you shape at 10 Mbps, your options for increasing your bandwidth, quickly (!), are often much, much simplified.
Hi Joseph, thank you very much for your reply. The last bit about if the link is physically running 10 Mbps ethernet standard there is no need to shape. Does this apply if you change the speed for the internet, e.g. you have a fast ethernet port that supports up to 100 Mbps, could you just go into the interface and set the speed to 10 Mbps (lets say you get a CIR of 10 Mbps), this means you wouldn't have to shape down to 10 Mbps since the interface will see the port at operating at 10 Mbps.
Hello @BVC ,
>> you have a fast ethernet port that supports up to 100 Mbps, could you just go into the interface and set the speed to 10 Mbps (lets say you get a CIR of 10 Mbps),
This can be done if the other side of the connection the ISP router port is able to go at 10 Mbps otherwise you will end up with a not working link.
But the idea is valid in general
On the other side if keeping the interface at 100 Mbps and using shaping it is easier to upgrade the bandwidth if you later buy more bandwidth from the provider. The change of the shaper rate can be down without having the link to go down an up.
Hope to help
As Giuseppe describes, whether you can reset your link to 10 Mbps depends on whether port (and SP) on the other side will allow/support it. Then, there's the question of whether it's a good idea to do so.
As Giuseppe also notes, using a shaper makes it easy to reset the "speed" (also, of course, for "speeds" not supported directly by Ethernet, like 12 Mbps). That said, a "true" port speed may work "better" than a shaper for a "true" Ethernet speed. (Also yes, when physical port speed is also the CIR, you don't need to shape.)