Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Configuring CoS on EX Series Switches

Configure class of service (CoS) on your switch to manage traffic so that when the network experiences congestion and delay, critical applications are protected. Using CoS, you can divide traffic on your switch into classes and provide various levels of throughput and packet loss. This is especially important for traffic that is sensitive to jitter and delay, such as voice traffic.

This example shows how to configure CoS on a single EX Series switch in the network.

Requirements

This example uses the following hardware and software components:

  • EX Series switches

  • Junos OS Release 9.0 or later for EX Series switches

Overview and Topology

This example uses the topology shown in Figure 1.

Figure 1: Topology for Configuring CoS Topology for Configuring CoS

The topology for this configuration example consists of EX switches at the access layer.

The EX Series access switches are configured to support VLAN membership. On the access layer switch, interfaces ge-0/0/0 and ge-0/0/1 are assigned to the voice VLAN (voice-vlan) for two VoIP IP phones. Switch interface ge-0/0/2 is assigned to the camera VLAN (camera-vlan) for the surveillance camera. Switch interfaces ge-0/0/3, ge-0/0/4, ge-0/0/5, and ge-0/0/6 are assigned to the server VLAN (server-vlan) for the servers hosting various applications such as those provided by Citrix, Microsoft, Oracle, and SAP. The trunk ports, ge-0/0/20 and ge-0/0/21, are assigned to the server, voice, employee, and camera VLANs and used as uplink ports to connect the distribution layer switches.

Table 1 shows the VLAN configuration components.

Table 1: Configuration Components: VLANs

VLAN Name

VLAN ID

VLAN Subnet and Available IP Addresses

VLAN Description

voice-vlan

10

192.168.1.0/28192.168.1.1 through 192.168.1.14

192.168.1.15 is the subnet’s broadcast address.

Voice VLAN used for employee VoIP communication.

camera-vlan

20

192.168.1.16/28192.168.1.17 through 192.168.1.30

192.168.1.31 is the subnet’s broadcast address.

VLAN for the surveillance cameras.

server-vlan

30

192.168.1.32/28192.168.1.33 through 192.168.1.46

192.168.1.47 is the subnet’s broadcast address.

VLAN for the servers hosting enterprise applications.

PoE-capable ports on EX Series switches support Power over Ethernet (PoE) to provide both network connectivity and power for VoIP telephones connecting to the ports. Table 2 shows the switch interfaces that are assigned to the VLANs and the IP addresses for devices connected to the switch ports on a 48-port switch, all ports of which are PoE-capable.

Table 2: Configuration Components: Switch Interfaces Assigned to VLANs and Devices on a 48-Port All-PoE Switch

Interfaces

VLAN Membership

IP Addresses

Port Devices

ge-0/0/0, ge-0/0/1

voice-vlan

192.168.1.1/28 through 192.168.1.2/28

Two VoIP telephones.

ge-0/0/2

camera-vlan

192.168.1.17/28

Surveillance camera.

ge-0/0/3, ge-0/0/4, ge-0/0/5, ge-0/0/6

server-vlan

192.168.1.33/28 through 192.168.1.36/28

Four servers hosting applications such as those provided by Citrix, Microsoft, Oracle, and SAP.

Note:

This example shows how to configure CoS on a standalone EX Series switch. This example does not consider across-the-network applications of CoS in which you might implement different configurations on ingress and egress switches to provide differentiated treatment to different classes across a set of nodes in a network.

Note:

Although you will sometimes see schedulers configured for strict-high priority with a transmit-rate configured, that configuration is misleading because strict-high priority schedulers get unlimited bandwidth and the transmit-rate parameter has no effect on them. With this configuration, lower priority queues can suffer starvation if there is congestion. It is better that schedulers with strict-high priority have shaping-rate parameters configured, which is the correct way to limit their bandwidth.

Configuration

Procedure

CLI Quick Configuration

To quickly configure CoS, copy the following commands and paste them into the switch terminal window:

Step-by-Step Procedure

To configure and apply CoS:

  1. Configure one-to-one mappings between eight forwarding classes and eight queues:

  2. Define the firewall filter voip_class to classify the VoIP traffic:

  3. Define the term voip:

  4. Define the term network_control (for the voip_class filter):

  5. Define the term best_effort_traffic with no match conditions (for the voip_class filter):

  6. Apply the firewall filter voip_class as an input filter to the interfaces for the VoIP phones:

  7. Apply port shaping on the interface ge-0/0/0:

  8. Define the firewall filter video_class to classify the video traffic:

  9. Define the term video:

  10. Define the term network_control (for the video_class filter):

  11. Define the term best_effort_traffic with no match conditions (for the video_class filter):

  12. Apply the firewall filter video_class as an input filter to the interface for the surveillance camera:

  13. Define the firewall filter app_class to classify the application server traffic:

  14. Define the term app (for the app_class filter):

  15. Define the term mail (for the app_class filter):

  16. Define the term db (for the app_class filter):

  17. Define the term erp (for the app_class filter):

  18. Define the term network_control (for the app_class filter):

  19. Define the term best_effort_traffic (for the app_class filter):

  20. Apply the firewall filter app_class as an input filter to the interfaces for the servers hosting applications:

  21. Configure schedulers:

  22. Assign the forwarding classes to schedulers with the scheduler map ethernet-cos-map:

  23. Associate the scheduler map with the outgoing interfaces:

  24. Apply queue shaping for the best-effort queue:

Results

Display the results of the configuration:

Verification

To confirm that the configuration is working properly, perform these tasks:

Verifying That the Defined Forwarding Classes Exist and Are Mapped to Queues

Purpose

Verify that the forwarding classes app, best-effort, db, erp, mail, network-control, video, and voice have been defined and mapped to queues.

Action

Meaning

This output shows that the forwarding classes have been defined and mapped to appropriate queues.

Verifying That the Forwarding Classes Have Been Assigned to Schedulers

Purpose

Verify that the forwarding classes have been assigned to schedulers.

Action

Meaning

This output shows that the forwarding classes have been assigned to schedulers.

Verifying That the Scheduler Map Has Been Applied to the Interfaces

Purpose

Verify that the scheduler map has been applied to the interfaces.

Action

Meaning

This output includes details of the interfaces to which the scheduler map (ethernet-cos-map) has been applied (ge-0/0/20 and ge-0/0/21).

Verifying That Port Shaping Has Been Applied

Purpose

Verify that the port shaping has been applied to an interface.

Action

Following is the output before port shaping is applied to the interface ge-0/0/0, when there is egress traffic of 400 Mpbs exiting on that interface:

The Traffic statistics: field in this output shows that egress traffic is ~400 Mpbs (345,934,816 bps). When a port shaping of 100 Mbps is applied to the ge-0/0/0 interface, you see the following outputs for the show interfaces ge-0/0/0 statistics and the show class-of-service interface ge-0/0/0 commands:

Meaning

In the output for the show interfaces ge-0/0/0 statistics command, the Traffic statistics: field shows that egress traffic is ~100 Mbps (100,223,104 bps). The output for the show class-of-service interface ge-0/0/0 command shows that the shaping rate is 100,000,000 bps, which indicates that a port shaping of 100 Mbps is applied to the ge-0/0/0 interface.

Verifying That Queue Shaping Has Been Applied

Purpose

Verify that the queue shaping has been applied to the best-effort queue.

Action

Following is the output before queue shaping is applied to the best-effort queue when there is egress traffic of 400 Mpbs exiting on that interface:

The Traffic statistics: field in this output shows that the egress traffic is ~400 Mpbs (345,934,816 bps). When a queue shaping of 30 Mbps is applied to the best-effort queue, you see the following output for the show interfaces ge-0/0/2 statistics and show class-of-service scheduler-map sched-map-be commands:

Meaning

In the output for the show interfaces ge-0/0/2 statistics command, the Traffic statistics: field shows that the egress traffic is ~30 Mbps (30,097,712 bps). The output for the show class-of-service scheduler-map sched-map-be command, shows that a shaping rate of 30,000,000 bps (that is 30 Mbps) is applied to the best-effort queue.