VLAN Based Traffic Shaping Cisco Switch

VLAN Based Traffic Shaping:

Today i will discuss how to configure VLAN based traffic shaping on cisco Catalyst ME3400 switch. Suppose you have 4 vlan [21,22,23,24] on a trunk port & you want to bandwidth shaping specific vlan 21 & 22. Here we declare 5Mbps BW for Vlan 21 & 2Mbps BW for Vlan 22. [boxads]

You can enable bandwidth shaping on an interface (or sub-interface) in three easy steps. Just remember: class, policy & interface.

Class:

At first you need to create a class map for those Vlan. Here we create vlan21 & vlan22 as a class map.

class-map match-all vlan21
 match vlan  21
class-map match-all vlan22
 match vlan  22

policy:

Now it’s time to define our policy map. In this case, we’re going to take any traffic that matched the vlan21 & vlan22 class (which, as you remember, is all traffic) and apply a shaping policy to it. Also we create subvlan & mainvlan policy map.

[adsense]

Here we create subvlan for traffic shaping & create mainvlan for aggregate two subvlan in a policy map.

Configuration example of subvlan:

  policy-map subvlan21
    class class-default
     police cir 5242880 bc 1000000
       conform-action transmit 
       exceed-action drop
  policy-map subvlan22
    class class-default
     police cir 2097152 bc 1000000
       conform-action transmit 
       exceed-action drop

Configuration example of mainvlan:

 policy-map mainvlan
  class vlan21
   service-policy subvlan21
  class vlan22
   service-policy subvlan22

Interface:

Finally, we need to apply the policy map to an interface using the service-policy configuration command. Here we apply it fa0/1 interface.

[bodyads]

Configuration example of applying mainvlan in an interface:

interface FastEthernet0/1
 description "your description here"
 port-type nni
 switchport trunk allowed vlan 21,22,23,24
 switchport mode trunk
 duplex full
 storm-control broadcast level 5.00
 no cdp enable
 no cdp tlv server-location 
 no cdp tlv app
 spanning-tree bpdufilter enable
 service-policy input mainvlan

Look like bellow format in Switch:

VLAN based traffic shaping configuration
VLAN based traffic shaping configuration

Command for remove all created policy-map:

SW1(config)#no policy-map subvlan21
SW1(config)#no policy-map subvlan22
SW1(config)#no policy-map mainvlan
SW1(config)#no class-map vlan21   
SW1(config)#no class-map vlan22

Shahed Israr

Shahed Israr

Shahed Israr is a Network Engineer specializing in GPON, FTTH, and telecom access network technologies. With hands-on experience in Huawei OLT and ONT configuration, U2000 NMS deployment, iMaster NCE-FAN Lite management systems, firmware upgrades, and advanced network troubleshooting, he helps Internet Service Providers (ISPs) and network professionals deploy, manage, and optimize fiber optic networks efficiently. Through GPON Solution, he shares practical technical guides, real-world solutions, and professional knowledge to support engineers working in modern GPON infrastructure.

More Posts - Website

Follow Me:Add me on XAdd me on FacebookAdd me on LinkedInAdd me on PinterestAdd me on YouTubeAdd me on Reddit

Comments

comments

2 thoughts on “VLAN Based Traffic Shaping Cisco Switch”

  1. Thanks for the great post
    I think this configuration will work only for the input traffic , as the match vlan will not work for the output policy right?

    How can I do that for output traffic?

    Thanks

    Reply

Leave a Comment

Time limit is exhausted. Please reload CAPTCHA.