Tuesday, March 25, 2014

How to load balance switched traffic over a spanning tree network using Juniper switches

This is a pretty simple setup. With normal spanning tree one of the redundant links will be blocked. So in order to make use of the blocked port, you can load balance traffic using MSTP (Multiple Spanning Tree).  First the basic setup.

user@SW-A# show interfaces ge-0/0/42 
description to-SW-B-0/0/42;
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members all;
        }
    }
}


user@SW-A# show interfaces ge-0/0/47    
description to-SW-B-ge-0/0/47;
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members all;
        }
    }
}
user@SW-A# show vlans 
v100 {
    vlan-id 100;
}
v200 {
    vlan-id 200;
}

user@SW-A# show protocols mstp 
msti 1 {
    vlan 100-199;
}
msti 2 {
    vlan 200-299;
}

user@SW-A# run show spanning-tree interface 

Spanning tree interface parameters for instance 0

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32768.50c58dab9081     20000  FWD    DESG 
ge-0/0/47.0    128:560      128:560  32768.50c58dab9081     20000  FWD    DESG 

Spanning tree interface parameters for instance 1

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32769.50c58dab9081     20000  FWD    DESG 
ge-0/0/47.0    128:560      128:560  32769.50c58dab9081     20000  FWD    DESG 

Spanning tree interface parameters for instance 2

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32770.50c58dab9081     20000  FWD    DESG 
ge-0/0/47.0    128:560      128:560  32770.50c58dab9081     20000  FWD    DESG 

user@SW-B# show interfaces ge-0/0/42                              
description to-SW-A-0/0/42;
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members all;
        }
    }
}


user@SW-B# show interfaces ge-0/0/47    
description to-SW-A-ge-0/0/47;
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members all;
        }
    }
}


user@SW-B# show protocols mstp 
msti 1 {
    vlan 100-199;
}
msti 2 {
    vlan 200-299;
}

user@SW-B# run show spanning-tree interface 

Spanning tree interface parameters for instance 0

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32768.50c58dab9081     20000  FWD    ROOT 
ge-0/0/47.0    128:560      128:560  32768.50c58dab9081     20000  BLK    ALT  

Spanning tree interface parameters for instance 1

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32769.50c58dab9081     20000  FWD    ROOT   <<<<< NOTE
ge-0/0/47.0    128:560      128:560  32769.50c58dab9081     20000  BLK    ALT  

Spanning tree interface parameters for instance 2

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32770.50c58dab9081     20000  FWD    ROOT 
ge-0/0/47.0    128:560      128:560  32770.50c58dab9081     20000  BLK    ALT  

SW-A is root bridge because of lowest mac address.

As you can see on SW-B, port ge-0/0/47 is blocked for all tagged and untagged traffic. 

There are two ways to influence spanning tree to change the forwarding state.

First, to affect the forwarding state of a particular spanning tree instance, you can use priorities on the root switch. This is useful to load balance traffic for under utilized links.

user@SW-A# set protocols mstp msti 1 interface ge-0/0/42 priority 240

On the remote switch SW-B

user@SW-B# run show spanning-tree interface    

Spanning tree interface parameters for instance 0

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32768.50c58dab9081     20000  FWD    ROOT 
ge-0/0/47.0    128:560      128:560  32768.50c58dab9081     20000  BLK    ALT  

Spanning tree interface parameters for instance 1

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      240:555  32769.50c58dab9081     20000  BLK    ALT      <<<<<<<< Here we block traffic 
ge-0/0/47.0    128:560      128:560  32769.50c58dab9081     20000  FWD    ROOT  <<<< now traffic will be forwarded on this interface for vlans in the range 100-199

Spanning tree interface parameters for instance 2

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32770.50c58dab9081     20000  FWD    ROOT 
ge-0/0/47.0    128:560      128:560  32770.50c58dab9081     20000  BLK    ALT  


The second method is to affect the traffic by adjusting the cost locally

user@SW-B# set protocols mstp msti 2 interface ge-0/0/47 cost 10000 

user@SW-B# commit 
configuration check succeeds
commit complete


user@SW-B# run show spanning-tree interface    

Spanning tree interface parameters for instance 0

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32768.50c58dab9081     20000  FWD    ROOT 
ge-0/0/47.0    128:560      128:560  32768.50c58dab9081     20000  BLK    ALT  

Spanning tree interface parameters for instance 1

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      240:555  32769.50c58dab9081     20000  BLK    ALT  
ge-0/0/47.0    128:560      128:560  32769.50c58dab9081     20000  FWD    ROOT 

Spanning tree interface parameters for instance 2

Interface    Port ID    Designated      Designated         Port    State  Role
                         port ID        bridge ID          Cost
ge-0/0/42.0    128:555      128:555  32770.50c58dab9081     20000  BLK    ALT  
ge-0/0/47.0    128:560      128:560  32770.50c58dab9081     10000  FWD    ROOT  <<<<<<<< HERE


Now only untagged traffic will forward over the ge-0/0/42 interface.

No comments:

Post a Comment