Networking optimize

Limit bandwidth on a Cisco Catalyst switch port

A TechRepublic reader recently e-mailed me to ask about limiting the bandwidth on a Cisco Catalyst switch port. In fact, there are a number of uses for this configuration. Let's take a closer look.

A TechRepublic reader recently e-mailed me to ask about limiting the bandwidth on a Cisco Catalyst switch port. In fact, there are a number of uses for this configuration. Let's take a closer look.

Why should you limit bandwidth?

There are a number of reasons for limiting bandwidth on a Cisco switch Ethernet port. (Of course, the port speed of the switch port always poses an ultimate limitation.)

For example, let's say you work for an Internet service provider in a colocation facility, and you sell access to the Internet in 1-Mb increments. The switch port in question is 100-Mb full duplex. In this case, you would limit the end device connected to that switch port to whatever 1-Mb increment the customer has paid for.

This is just one example of how this configuration could be useful, but there are many other possibilities. Let's look at the commands used to create this bandwidth limit on a Cisco switch.

How do I configure a bandwidth limit?

In the Cisco IOS on a Catalyst switch (not on a router), there's an Interface Mode command called shape round-robin queue bandwidth. More specifically, the command is srr-queue bandwidth.

This command has been around since IOS 12.2(25). For these examples, I'm using a Cisco Catalyst 2960 switch.

Entering the command appended with a question mark will display the command options. Here's an example:

Switch(config)# interface FastEthernet 0/1

Switch(config-if)# srr-queue bandwidth ?

  limit              Configure bandwidth-limit for this interface

  shape             Configure shaping on transmit queues

  share              Configure shared bandwidth

As you can see, the command options are limit, shape, and share. While we'll focus on the limit option this time, keep in mind that you can also use the srr-queue bandwidth command to shape and share bandwidth.

For example, let's say you have a 100-Mb Ethernet port on a Catalyst switch. You're selling the bandwidth on the port, and a customer has bought 10 Mb of bandwidth. Obviously, you want to limit the outbound bandwidth on the port to 10 Mb instead of the full 100 Mb.

To do so, go to Interface Configuration Mode on the switch port, and apply the srr-queue bandwidth limit command. Here's an example:

Switch(config)# interface FastEthernet 0/1
Switch(config-if)# srr-queue bandwidth limit 90

The 90 sets the outbound bandwidth limit on the port to 90 percent of the port speed. Since this is a 100-Mb port, this should limit the outbound traffic from the port to 10 Mb.

Variations on bandwidth limiting

As with just about everything in the Cisco IOS, there are multiple ways to accomplish the same thing. One way would be to manipulate the port speed. But if you want to hard-code the port speed on the Ethernet port to 10 Mb, you could also limit the customer to only 10 Mb of bandwidth using the speed 10 command. However, you probably won't get the same level of performance from the 10-Mb Ethernet port. What if you want a port speed that's less than 10 Mb? You could limit the port speed to 10 Mb and then use the srr-queue bandwidth limit 90 command to limit the outbound speed of the port to only 1 Mb.

What if you're working with a Cisco router instead of a switch? Cisco routers don't support the srr-queue command. While there are several different QoS options that might accomplish the same thing, a common method that I've used is the rate-limit command.

For example, on a Cisco router when in Interface Mode, you could limit outbound bandwidth to 1 Mb using the following command:

Router(config-if)# rate-limit output 10000000 2000 2000 conform-action continue exceed-action drop

Summary

Whether it's inbound or outbound, being able to control bandwidth on a Cisco switch or router port is a very valuable skill. No matter how difficult or simple the task, knowing the right command is usually the key to getting the task completed when working with the Cisco IOS. For more information on using the srr-queue bandwidth command, see Cisco's command reference or configuration guide.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

26 comments
vivs1987
vivs1987

Sir i want to limit the bandwith in kilobits how can i configure on fast ethernet port.... By bandwith command what happens is the speed doesnt changes.....please help us as we have to give lease line in kilobits and 2Mb ,4Mb,and in multiples of 2

medfordmel
medfordmel

According to the Cisco command reference (and according to my results), setting the srr-queue bandwidth limit to 90 limits throughput TO 90% - not BY 90%. "srr-queue bandwidth limit 90" sets interface idle time to 10%, while permitting traffic 90% of the time, so the result is an effective 90 Mbps on a 100 Mbps port. Note that although this command accepts any value between 10 and 90 inclusive, the interface idle time is adjusted only in increments of 6. Rather than rounding to the nearest multiple of 6, it appears to truncate. So, "srr-queue bandwidth limit 10" actually results in 6% throughput, but "srr-queue bandwidth limit 12" results in 12% throughput.

nebuster
nebuster

Does it really do the limitation coz i did the same in my cisco 2960 but it didnt seem to work or how am i suppose to see is its working or not .... coz after the comment the bandwidth seems same to me

hefe.bierbaum
hefe.bierbaum

I think the discussion is focused on outbound traffic. How do I limit the download / inbound bandwidth for my Cisco 3550?

mohammedismailahmed
mohammedismailahmed

this command is not work in my cisco router (2950) please reply me why its not work my mail id is mohammedismailahmed@yahoo.com please mail me Sir

siso23
siso23

this was exactly what I was looking for. Now, you mentioned that if I wanted to limit the speed to something less than 10Mb, the I would have to adjust the physical port speed ... why couldn't I just say: srr-queue bandwidth limit 2 for a 2MB connection?

CDS
CDS

In the example above it states that the 90 sets the outbound bandwidth limit on the port to 90 percent of the port speed. Therefore wouldn't the client bandwidth be 90 meg?

slappyGURU
slappyGURU

Would it not be limit 10, since you want 10 megs on a 100 meg port?

Photogenic Memory
Photogenic Memory

I've always wanted to know how admins configure this. Turning up a clients bandwidth or connections speed is extremely useful. However, I have an inquiry. It's obvious that there are instant benefits from have increased speed; however, what are the down sides? Would there be instances where turning it down would be a better option(for instance a hardware problem or reduction in noise on the line type stuff?)? Thanks for posting.

jeman022004
jeman022004

Anyone know if this is a capability using CATOS?

sharrahl
sharrahl

I disagree with this statement: The 90 sets the outbound bandwidth limit on the port to 90 percent of the port speed. Since this is a 100-Mb port, this should limit the outbound traffic from the port to 10 Mb 90 percent of the port speed (100MB) is not 10MB but 90MB.

bonsignoren
bonsignoren

Can this be applied to a switch-mod that is on-board a 2800 rtr (NM-16ESW)..?

sadea
sadea

This is a great command to have. Thanks for the info.

alan_stiver
alan_stiver

You state the following: "Switch(config-if)# srr-queue bandwidth limit 90 The 90 sets the outbound bandwidth limit on the port to 90 percent of the port speed. Since this is a 100-Mb port, this should limit the outbound traffic from the port to 10 Mb." Actually, according to the Cisco command reference, this would result in a traffic limit of 90Mbps, not 10Mbps. Good reminder of a useful command, however. Thanks.

bernie_johnson
bernie_johnson

Can this be done to say limit the badnwidth used by local lan users and limit their badnwidth utilization for surfing the net? Thanks, razorack--

Cincinnerdi
Cincinnerdi

You say, "However, you probably won't get the same level of performance from the 10-Mb Ethernet port." Is this because if you hard code the port speed to 10-Mb, duplex is disabled?

Jacthemanus
Jacthemanus

Because by default the minimum is 10%

CrimsonPaw
CrimsonPaw

Thank you for clarifying this because I was confused when I read that originally. So the command should actually be "srr-queue bandwidth limit 10" and that would limit it to 10% of the port speed. Good command to know though!

ismailsh
ismailsh

Yep, your right, I checked the cisco documentation as below:- Usage Guidelines If you configure this command to 80 percent, the port is idle 20 percent of the time. The line rate drops to 80 percent of the connected speed. These values are not exact because the hardware adjusts the line rate in increments of six. This example shows how to limit a port to 800 Mb/s: Switch(config)# interface gigabitethernet0/1 Switch(config-if)# srr-queue bandwidth limit 80

paul.nicolette
paul.nicolette

...as long as both ends of the link support it (Cisco routers/switches and most NICs do). Both ends should be "hard coded" to 10/full to avoid a duplex mismatch. As long as both are set correctly, I don't know why you wouldn't get the same level of performance or better (less packet processing, no "increments of six" approximations of desired bandwidth).

vaclav.kucera
vaclav.kucera

Hi, I have at port an option "bandwidth" which should limit the bandwidth of the port to given number of kb: C3560(config-if)#bandwidth ? Bandwidth in kilobits But I don't have the srr-queue option.

dagostinr
dagostinr

I don't seem to have this command. I am running version 12.2(25) but I don't see the wrr-queue or srr-queue.