Cấu hình CoS trên Switch EX Series

Cấu hình CoS trên Switch EX Series

Cấu hình Class of Service (CoS) trên Switch EX Series

CoS (Class of Service) giúp quản lý lưu lượng trên switch để bảo đảm các ứng dụng quan trọng khi mạng gặp tắc nghẽn và độ trễ. Bằng cách sử dụng CoS, bạn có thể phân loại lưu lượng thành các nhóm và cung cấp mức độ thông lượng (throughput) cũng như kiểm soát mất gói khác nhau. Điều này đặc biệt quan trọng đối với lưu lượng nhạy cảm với jitter và độ trễ, chẳng hạn như lưu lượng thoại (voice traffic).

Bài viết này hướng dẫn cách cấu hình CoS trên một switch EX Series đơn lẻ trong mạng.

Yêu cầu hệ thống

Bài viết này sử dụng các thành phần phần cứng và phần mềm sau:

  • Switch dòng EX Series
  • Hệ điều hành Junos OS phiên bản 9.0 trở lên cho switch EX Series

Tổng quan và mô hình mạng

Bài viết này sử dụng mô hình mạng như hình 1.

Hình 1: Mô hình cấu hình CoS

Topology for Configuring CoS

Mô hình mạng cho cấu hình CoS

Mô hình mạng trong ví dụ này bao gồm các switch EX Series hoạt động tại lớp truy cập (access layer).

Các switch EX Series tại lớp truy cập được cấu hình để hỗ trợ phân chia VLAN. Cụ thể:

  • Các cổng ge-0/0/0 và ge-0/0/1 được gán vào VLAN thoại (voice-vlan) để kết nối hai điện thoại IP VoIP.
  • Cổng ge-0/0/2 được gán vào VLAN camera (camera-vlan) để kết nối camera giám sát.
  • Các cổng ge-0/0/3, ge-0/0/4, ge-0/0/5 và ge-0/0/6 được gán vào VLAN máy chủ (server-vlan) để kết nối các máy chủ chạy các ứng dụng như Citrix, Microsoft, Oracle và SAP.
  • Các cổng trunk ge-0/0/20 và ge-0/0/21 được cấu hình để hỗ trợ VLAN máy chủ, VLAN thoại, VLAN nhân viên và VLAN camera. Chúng đóng vai trò là các cổng uplink để kết nối đến switch lớp phân phối (distribution layer switches).

Bảng 1: Cấu hình VLAN

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.

Hỗ trợ PoE trên các cổng của switch EX Series

Các cổng trên switch EX Series có khả năng cấp nguồn PoE (Power over Ethernet) để cung cấp cả kết nối mạng và nguồn điện cho các thiết bị VoIP. Điều này giúp các điện thoại IP VoIP có thể hoạt động mà không cần nguồn điện bên ngoài, giúp triển khai dễ dàng hơn.

Cấu hình cổng trên switch 48-port hỗ trợ PoE

Bảng 2 hiển thị các giao diện switch được gán vào các VLAN cũng như địa chỉ IP của các thiết bị kết nối trên switch 48 cổng, trong đó tất cả các cổng đều hỗ trợ PoE.

Bảng 2: Cấu hình cổng switch – VLAN và thiết bị trên switch PoE 48 cổng

Interfaces

VLAN

Membership

IP Addresses

Port Devices

ge-0/0/0ge-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/3ge-0/0/4ge-0/0/5ge-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.

**Lưu ý khi cấu hình CoS trên switch EX Series

  • Phạm vi của ví dụ này:
    Ví dụ này hướng dẫn cấu hình CoS trên một switch EX Series độc lập. Nó không bao gồm các tình huống triển khai CoS trên toàn bộ mạng, nơi có thể cần các cấu hình khác nhau trên các switch đầu vào (ingress) và đầu ra (egress) để đảm bảo phân loại và xử lý lưu lượng một cách đồng bộ trên nhiều thiết bị mạng.

  • Cấu hình schedulers với ưu tiên cao nhất (strict-high priority):

    • Một số cấu hình sử dụng schedulers có strict-high priority kết hợp với tham số transmit-rate. Tuy nhiên, cách cấu hình này dễ gây hiểu nhầm vì schedulers có strict-high priority vốn dĩ đã có băng thông không giới hạn, do đó tham số transmit-rate không có tác dụng.
    • Khi có tắc nghẽn mạng, các hàng đợi (queue) có mức ưu tiên thấp hơn có thể bị đói tài nguyên (starvation) nếu không được kiểm soát đúng cách.
    • Giải pháp tối ưu: Nên sử dụng tham số shaping-rate thay vì transmit-rate cho schedulers có strict-high priority. Điều này giúp kiểm soát băng thông một cách hiệu quả, tránh việc các hàng đợi ưu tiên thấp bị bỏ đói trong điều kiện tắc nghẽn.

Cấu hình CoS trên Switch EX Series

Quy trình cấu hình.

- Cấu hình nhanh bằng CLI (CLI Quick Configuration)

Để nhanh chóng cấu hình CoS trên switch EX Series, hãy sao chép và dán các lệnh sau vào terminal của switch:

[edit]

set class-of-service forwarding-classes class app queue-num 5

set class-of-service forwarding-classes class mail queue-num 1

set class-of-service forwarding-classes class db queue-num 2

set class-of-service forwarding-classes class erp queue-num 3

set class-of-service forwarding-classes class video queue-num 4

set class-of-service forwarding-classes class best-effort queue-num 0

set class-of-service forwarding-classes class voice queue-num 6

set class-of-service forwarding-classes class network-control queue-num 7

set firewall family ethernet-switching filter voip_class term voip from source-address 192.168.1.1/28

set firewall family ethernet-switching filter voip_class term voip from source-address 192.168.1.2/28

set firewall family ethernet-switching filter voip_class term voip from protocol udp

set firewall family ethernet-switching filter voip_class term voip from source-port 2698

set firewall family ethernet-switching filter voip_class term voip then forwarding-class voice loss-priority low

set firewall family ethernet-switching filter voip_class term network_control from precedence [net-control internet-control]

set firewall family ethernet-switching filter voip_class term network_control then forwarding-class network-control loss-priority low

set firewall family ethernet-switching filter voip_class term best_effort_traffic then forwarding-class best-effort loss-priority low

set interfaces ge-0/0/0 description phone1–voip-ingress-port

set interfaces ge-0/0/0 unit 0 family ethernet-switching filter input voip_class

set class-of-service interfaces ge-0/0/0 shaping-rate 100m

set interfaces ge-0/0/1 description phone2–voip-ingress-port

set interfaces ge-0/0/1 unit 0 family ethernet-switching filter input voip_class

set firewall family ethernet-switching filter video_class term video from source-address 192.168.1.17/28

set firewall family ethernet-switching filter video_class term video from protocol udp

set firewall family ethernet-switching filter video_class term video from source-port 2979

set firewall family ethernet-switching filter video_class term video then forwarding-class video loss-priority low

set firewall family ethernet-switching filter video_class term network_control from precedence [net-control internet-control]

set firewall family ethernet-switching filter video_class term network_control then forwarding-class network-control loss-priority low

set firewall family ethernet-switching filter video_class term best_effort_traffic then forwarding-class best-effort loss-priority low

set interfaces ge-0/0/2 description video-ingress-port

set interfaces ge-0/0/2 unit 0 family ethernet-switching filter input video_class

set firewall family ethernet-switching filter app_class term app from source-address 192.168.1.33/28

set firewall family ethernet-switching filter app_class term app from protocol tcp

set firewall family ethernet-switching filter app_class term app from source-port [1494 2512 2513 2598 2897]

set firewall family ethernet-switching filter app_class term app then forwarding-class app loss-priority low

set firewall family ethernet-switching filter app_class term mail from source-address 192.168.1.34/28

set firewall family ethernet-switching filter app_class term mail from protocol tcp

set firewall family ethernet-switching filter app_class term mail from source-port [25 143 389 691 993 3268 3269]

set firewall family ethernet-switching filter app_class term mail then forwarding-class mail loss-priority low

set firewall family ethernet-switching filter app_class term db from source-address 192.168.1.35/28

set firewall family ethernet-switching filter app_class term db from protocol tcp

set firewall family ethernet-switching filter app_class term db from source-port [1521 1525 1527 1571 1810 2481]

set firewall family ethernet-switching filter app_class term db then forwarding-class db loss-priority low

set firewall family ethernet-switching filter app_class term erp from source-address 192.168.1.36/28

set firewall family ethernet-switching filter app_class term erp from protocol tcp

set firewall family ethernet-switching filter app_class term erp from source-port [3200 3300 3301 3600]

set firewall family ethernet-switching filter app_class term erp then forwarding-class erp loss-priority low

set firewall family ethernet-switching filter app_class term network_control from precedence [net-control internet-control]

set firewall family ethernet-switching filter app_class term network_control then forwarding-class network-control loss-priority low

set firewall family ethernet-switching filter app_class term best_effort_traffic then forwarding-class best-effort loss-priority low

set interfaces ge-0/0/3 unit 0 family ethernet-switching filter input app_class

set interfaces ge-0/0/4 unit 0 family ethernet-switching filter input app_class

set interfaces ge-0/0/5 unit 0 family ethernet-switching filter input app_class

set interfaces ge-0/0/6 unit 0 family ethernet-switching filter input app_class

set class-of-service schedulers voice-sched shaping-rate percent 10

set class-of-service schedulers voice-sched buffer-size percent 10

set class-of-service schedulers voice-sched priority strict-high

set class-of-service schedulers video-sched priority low

set class-of-service schedulers video-sched transmit-rate percent 15

set class-of-service schedulers app-sched buffer-size percent 10

set class-of-service schedulers app-sched priority low

set class-of-service schedulers app-sched transmit-rate percent 10

set class-of-service schedulers mail-sched buffer-size percent 5

set class-of-service schedulers mail-sched priority low

set class-of-service schedulers mail-sched transmit-rate percent 5

set class-of-service schedulers db-sched buffer-size percent 10

set class-of-service schedulers db-sched priority low

set class-of-service schedulers db-sched transmit-rate percent 10

set class-of-service schedulers erp-sched buffer-size percent 10

set class-of-service schedulers erp-sched priority low

set class-of-service schedulers erp-sched transmit-rate percent 10

set class-of-service schedulers nc-sched shaping-rate percent 5

set class-of-service schedulers nc-sched buffer-size percent 5

set class-of-service schedulers nc-sched priority strict-high

set class-of-service schedulers be-sched buffer-size percent 35

set class-of-service schedulers be-sched priority low

set class-of-service schedulers be-sched transmit-rate percent 35

set class-of-service scheduler-maps ethernet-cos-map forwarding-class voice scheduler voice-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class video scheduler video-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class app scheduler app-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class mail scheduler mail-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class db scheduler db-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class erp scheduler erp-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class network-control scheduler nc-sched

set class-of-service scheduler-maps ethernet-cos-map forwarding-class best-effort scheduler be-sched

set class-of-service interfaces ge-0/0/20 scheduler-map ethernet-cos-map

set class-of-service interfaces ge-0/0/21 scheduler-map ethernet-cos-map

set class-of-service schedulers voice-sched-queue-shap shaping-rate 30m

set class-of-service scheduler-maps sched-map-be forwarding-class best-effort scheduler voice-sched-queue-shap

set class-of-service interfaces ge-0/0/2 scheduler-map sched-map-be

- Quy trình từng bước (Step-by-Step Procedure)

Để cấu hình và áp dụng CoS:

+ Cấu hình ánh xạ một-một giữa tám lớp chuyển tiếp (forwarding classes) và tám hàng đợi (queues):

[edit class-of-service]

user@switch# set forwarding-classes class app queue-num 5

user@switch# set forwarding-classes class mail queue-num 1

user@switch# set forwarding-classes class db queue-num 2

user@switch# set forwarding-classes class erp queue-num 3

user@switch# set forwarding-classes class video queue-num 4

user@switch# set forwarding-classes class best-effort queue-num 0

user@switch# set forwarding-classes class voice queue-num 6

user@switch# set forwarding-classes class network-control queue-num 7

+ Định nghĩa bộ lọc firewall voip_class để phân loại lưu lượng VoIP: 

[edit firewall]

user@switch# set family ethernet-switching filter voip_class

+ Định nghĩa điều kiện (term) cho VoIP:

[edit firewall]

user@switch# set family ethernet-switching filter voip_class term voip from source-address 192.168.1.1/28

user@switch# set family ethernet-switching filter voip_class term voip from source-address 192.168.1.2/28

user@switch# set family ethernet-switching filter voip_class term voip protocol udp

user@switch# set family ethernet-switching filter voip_class term voip source-port 2698

user@switch# set family ethernet-switching filter voip_class term voip then forwarding-class voice loss-priority low

+ Định nghĩa điều kiện (term) network_control cho bộ lọc voip_class:

[edit firewall]

user@switch# set family ethernet-switching filter voip_class term network_control from precedence [net-control internet-control]

user@switch# set family ethernet-switching filter voip_class term network_control then forwarding-class network-control loss-priority low

+ Định nghĩa điều kiện (term) best_effort_traffic mà không có điều kiện khớp (cho bộ lọc voip_class):

[edit firewall]

user@switch# set family ethernet-switching filter voip_class term best_effort_traffic then forwarding-class best-effort loss-priority low

+ Áp dụng bộ lọc firewall voip_class làm bộ lọc đầu vào cho các giao diện của điện thoại VoIP

[edit interfaces]

user@switch# set ge-0/0/0 description phone1-voip-ingress-port

user@switch# set ge-0/0/0 unit 0 family ethernet-switching filter input voip_class

user@switch# set ge-0/0/1 description phone2-voip-ingress-port

user@switch# set ge-0/0/1 unit 0 family ethernet-switching filter input voip_class

+ Cấu hình giới hạn băng thông (port shaping) trên giao diện ge-0/0/0.

[edit]

user@switch# set class-of-service interfaces ge-0/0/0 shaping-rate 100m

+ Định nghĩa bộ lọc firewall video_class để phân loại lưu lượng video:

[edit firewall]

user@switch# set family ethernet-switching filter video_class

+ Định nghĩa điều kiện (term) video:

[edit firewall]

user@switch# set family ethernet-switching filter video_class term video from source-address 192.168.1.17/28

user@switch# set family ethernet-switching filter video_class term video protocol udp

user@switch# set family ethernet-switching filter video_class term video source-port 2979

user@switch# set family ethernet-switching filter video_class term video then forwarding-class video loss-priority low

+ Định nghĩa điều kiện (term) network_control cho bộ lọc video_class.

[edit firewall]

user@switch# set family ethernet-switching filter video_class term network_control from precedence [net-control internet-control]

user@switch# set family ethernet-switching filter video_class term network_control then forwarding-class network-control loss-priority low

+ Định nghĩa điều kiện (term) best_effort_traffic mà không có điều kiện khớp (cho bộ lọc video_class).

[edit firewall]user@switch# set family ethernet-switching filter video_class term best_effort_traffic then forwarding-class best-effort loss-priority low

+ Áp dụng bộ lọc firewall video_class làm bộ lọc đầu vào cho giao diện của camera giám sát.

[edit interfaces]

user@switch# set ge-0/0/2 description video-ingress-port

user@switch# set ge-0/0/2 unit 0 family ethernet-switching filter input video_class

+ Định nghĩa bộ lọc firewall app_class để phân loại lưu lượng của các máy chủ ứng dụng.

[edit firewall]

user@switch# set family ethernet-switching filter app_class

+ Định nghĩa điều kiện (term) app cho bộ lọc app_class.

[edit firewall]

user@switch# set family ethernet-switching filter app_class term app from source-address 192.168.1.33/28

user@switch# set family ethernet-switching filter app_class term app protocol tcp

user@switch# set family ethernet-switching filter app_class term app source-port [1494 2512 2513 2598 2897]

user@switch# set family ethernet-switching filter app_class term app then forwarding-class app loss-priority low

+ Định nghĩa điều kiện (term) mail cho bộ lọc app_class.

[edit firewall]

user@switch# set family ethernet-switching filter app_class term mail from source-address 192.168.1.34/28

user@switch# set family ethernet-switching filter app_class term mail protocol tcp

user@switch# set family ethernet-switching filter app_class term mail source-port [25 143 389 691 993 3268 3269]

user@switch# set family ethernet-switching filter app_class term mail then forwarding-class mail loss-priority low

+ Định nghĩa điều kiện (term) db cho bộ lọc app_class.

[edit firewall]

user@switch# set family ethernet-switching filter app_class term db from source-address 192.168.1.35/28

user@switch# set family ethernet-switching filter app_class term db protocol tcp

user@switch# set family ethernet-switching filter app_class term db source-port [1521 1525 1527 1571 1810 2481]

user@switch# set family ethernet-switching filter app_class term db then forwarding-class db loss-priority low

+ Định nghĩa điều kiện (term) erp cho bộ lọc app_class.

[edit firewall]

user@switch# set family ethernet-switching filter app_class term erp from source-address 192.168.1.36/28

user@switch# set family ethernet-switching filter app_class term erp protocol tcp

user@switch# set family ethernet-switching filter app_class term erp source-port [3200 3300 3301 3600]

user@switch# set family ethernet-switching filter app_class term erp then forwarding-class erp loss-priority low

+ Định nghĩa điều kiện (term) network_control cho bộ lọc app_class.

[edit firewall]

user@switch# set family ethernet-switching filter app_class term network_control from precedence [net-control internet-control]

user@switch# set family ethernet-switching filter app_class term network_control then forwarding-class network-control loss-priority low

+ Định nghĩa điều kiện (term) best_effort_traffic cho bộ lọc app_class.

[edit firewall]

user@switch# set family ethernet-switching filter app_class term best_effort_traffic then forwarding-class best-effort loss-priority low

+ Áp dụng bộ lọc firewall app_class làm bộ lọc đầu vào cho các giao diện của máy chủ chạy ứng dụng.

[edit interfaces]

user@switch# set ge-0/0/3 unit 0 family ethernet-switching filter input app_class

user@switch# set ge-0/0/4 unit 0 family ethernet-switching filter input app_class

user@switch# set ge-0/0/5 unit 0 family ethernet-switching filter input app_class

user@switch# set ge-0/0/6 unit 0 family ethernet-switching filter input app_class

+ Cấu hình các lịch trình (schedulers).

[edit class-of-service]

user@switch# set schedulers voice-sched shaping-rate percent 10

user@switch# set schedulers voice-sched buffer-size percent 10

user@switch# set schedulers voice-sched priority strict-high

user@switch# set schedulers video-sched priority low

user@switch# set schedulers video-sched transmit-rate percent 15

user@switch# set schedulers app-sched buffer-size percent 10

user@switch# set schedulers app-sched priority low

user@switch# set schedulers app-sched transmit-rate percent 10

user@switch# set schedulers mail-sched buffer-size percent 5

user@switch# set schedulers mail-sched priority low

user@switch# set schedulers mail-sched transmit-rate percent 5

user@switch# set schedulers db-sched buffer-size percent 10

user@switch# set schedulers db-sched priority low

user@switch# set schedulers db-sched transmit-rate percent 10

user@switch# set schedulers erp-sched buffer-size percent 10

user@switch# set schedulers erp-sched priority low

user@switch# set schedulers erp-sched transmit-rate percent 10

user@switch# set schedulers nc-sched shaping-rate percent 5

user@switch# set schedulers nc-sched buffer-size percent 5

user@switch# set schedulers nc-sched priority strict-high

user@switch# set schedulers nc-sched transmit-rate percent 5

user@switch# set schedulers be-sched buffer-size percent 35

user@switch# set schedulers be-sched priority low

user@switch# set schedulers be-sched transmit-rate percent 35

+ Gán các lớp chuyển tiếp (forwarding classes) vào các lịch trình bằng bộ ánh xạ ethernet-cos-map.

[edit class-of-service]

user@switch# set scheduler-maps ethernet-cos-map forwarding-class voice scheduler voice-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class video scheduler video-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class app scheduler app-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class mail scheduler mail-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class db scheduler db-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class erp scheduler erp-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class network-control scheduler nc-sched

user@switch# set scheduler-maps ethernet-cos-map forwarding-class best-effort scheduler be-sched

+ Liên kết bộ ánh xạ lịch trình với các giao diện đầu ra.

[edit class-of-service interfaces]

user@switch# set ge-0/0/20 scheduler-map ethernet-cos-map

user@switch# set ge-0/0/21 scheduler-map ethernet-cos-map

+ Áp dụng giới hạn băng thông (queue shaping) cho hàng đợi best-effort.

[edit]

user@switch# set class-of-service schedulers voice-sched-queue-shap shaping-rate 30m

user@switch# set class-of-service scheduler-maps sched-map-be forwarding-class best-effort scheduler voice-sched-queue-shap

user@switch# set class-of-service interfaces ge-0/0/2 scheduler-map sched-map-be

Kết quả

Hiển thị kết quả của cấu hình.

user@switch> show firewall

firewall family ethernet-switching {

    filter voip_class {

        term voip {

            from {

                source-address {

                    192.168.1.1/28;

                     192.168.1.2/28;}

                protocol udp;

                source-port 2698;}

            then {

                forwarding-class voice;

                loss-priority low;}}

        term network control {

            from {

                precedence [net-control internet-control];}

            then {

                forwarding-class network-control;

                loss-priority low;}}

        term best_effort_traffic {

            then {

                forwarding-class best-effort;

                loss-priority low;}}}

    filter video_class {

        term video {

            from {

                source-address {

                    192.168.1.17/28;}

                protocol udp;

                source-port 2979;}

            then {

                forwarding-class video;

                loss-priority low;}}

        term network control {

            from {

                precedence [net-control internet-control];}

            then {

                forwarding-class network-control;

                loss-priority low;}}

        term best_effort_traffic {

            then {

                forwarding-class best-effort;

                loss-priority low;}}}

    filter app_class {

        term app {

            from {

                source-address {

                    192.168.1.33/28;}

                protocol tcp;

                source-port [1491 2512 2513 2598 2897];}

            then {

                forwarding-class app;

                loss-priority low;}}

        term mail {

            from {

                source-address {

                    192.168.1.34/28;}

                protocol tcp;

                source-port [25 143 389 691 993 3268 3269];}

            then {

                forwarding-class mail;

                loss-priority low;}}

        term db  {

            from {

                source-address {

                    192.168.1.35/28;}

                protocol tcp;

                source-port [1521 1525 1527 1571 1810 2481];}

            then {

                forwarding-class db;

                loss-priority low;}}

        term erp  {

            from {

                source-address {

                    192.168.1.36/28;}

                protocol tcp;

                source-port [3200 3300 3301 3600];}

            then {

                forwarding-class erp;

                loss-priority low;}}

        term network control {

            from {

                precedence [net-control internet-control];}

            then {

                forwarding-class  network-control;

                loss-priority low;}}

        term best_effort_traffic {

            then {

                forwarding-class best-effort;

                loss-priority low;}}}}

user@switch# show class-of-service

forwarding-classes {

    class app queue-num 5;

    class mail queue-num 1;

    class db queue-num 2;

    class erp queue-num 3;

    class video queue-num 4;

    class best-effort queue-num 0;

    class voice queue-num 6;

    class network-control queue-num 7;}

interfaces {

    ge-0/0/0 {

        shaping-rate 100m;}

    ge-0/0/2 {

        scheduler-map sched-map-be;}

    ge-0/0/20 {

        scheduler-map ethernet-cos-map;}

    ge-0/0/21 {

        scheduler-map ethernet-cos-map;}}

schedulers {

    voice-sched-queue-shap {

        shaping-rate 30m;}

    voice-sched {

        shaping-rate percent 10;

        buffer-size percent 10;

        priority strict-high;}

    video-sched  {

        buffer-size percent 15;

        priority low;

        transmit-rate percent 15;}

    app-sched {

        buffer-size percent 10;

        priority low;

        transmit-rate percent 10;}

    mail-sched {

        buffer-size percent 5;

        priority low;

        transmit-rate percent 5;}

    db-sched {

        buffer-size percent 10;

        priority low;

        transmit-rate percent 10;}

    erp-sched {

        buffer-size percent 10;

        priority low;

        transmit-rate percent 10;}

    nc-sched {

        shaping-rate percent 5;

        buffer-size percent 5;

        priority strict-high;}

    be-sched {

        buffer-size percent 35;

        priority low;

        transmit-rate percent 35;}}

scheduler-maps {

    ethernet-cos-map {

        forwarding-class voice scheduler voice-sched;

        forwarding-class video scheduler video-sched;

        forwarding-class app scheduler app-sched;

        forwarding-class mail scheduler mail-sched;

        forwarding-class db scheduler db-sched;

        forwarding-class erp scheduler erp-sched;

        forwarding-class network-control scheduler nc-sched;

        forwarding-class best-effort scheduler be-sched;}

    sched-map-be {

        forwarding-class best-effort scheduler  voice-sched-queue-shap;}}

user@switch# show interfaces

ge-0/0/0 {

    unit 0 {

        family ethernet {

            filter {

                input voip_class;}}}}

ge-0/0/1 {

    unit 0 {

        family ethernet {

            filter {

                input voip_class;}}}}

ge-0/0/2 {

    unit 0 {

        family ethernet {

            filter {

                input video_class;}}}}

ge-0/0/3 {

    unit 0 {

        family ethernet {

            filter {

                input app_class;}}}}

ge-0/0/4 {

    unit 0 {

        family ethernet {

            filter {

                input app_class;}}}}

ge-0/0/5 {

    unit 0 {

        family ethernet {

            filter {

                input app_class;}}}}

ge-0/0/6 {

    unit 0 {

        family ethernet {

            filter {

                input app_class;}}}}

Xác minh (Verification)

Để đảm bảo cấu hình hoạt động đúng, thực hiện các bước sau:

Xác minh rằng các lớp chuyển tiếp đã được tạo và ánh xạ đến hàng đợi

Mục đích (Purpose)

Xác minh rằng các lớp chuyển tiếp app, best-effort, db, erp, mail, network-control, video, và voice đã được tạo và ánh xạ đến các hàng đợi.

Thao tác (Action)

user@switch> show class-of-service forwarding-class                    

Forwarding class                       ID    Queue

  app                                   0       5      

  db                                    1       2     

  erp                                   2       3     

  best-effort                           3       0     

  mail                                  4       1     

  voice                                 5       6     

  video                                 6       4     

  network-control                       7       7     

Ý nghĩa (Meaning)

Kết quả đầu ra này cho thấy rằng các lớp chuyển tiếp (forwarding classes) đã được tạo và ánh xạ đến các hàng đợi (queues) thích hợp.

Xác minh rằng các lớp chuyển tiếp đã được gán vào bộ lập lịch (schedulers)

Mục đích (Purpose)

Xác minh rằng các lớp chuyển tiếp đã được gán vào các bộ lập lịch (schedulers).

Thao tác (Action)

user@switch> show class-of-service scheduler-map                    

Scheduler map: ethernet-cos-map, Index: 2

  Scheduler: voice-sched, Forwarding class: voice, Index: 22

    Shaping rate: 10 percent, Rate Limit: none, Buffer size: 10 percent,

    Priority: Strict-high

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1     

      High            TCP             1   

  Scheduler: video-sched, Forwarding class: video, Index: 22

    Transmit rate: 10 percent, Rate Limit: none, Buffer size: 10 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

  Scheduler: app-sched, Forwarding class: app, Index: 22

    Transmit rate: 10 percent, Rate Limit: none, Buffer size: 10 percent,    

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

  Scheduler: mail-sched, Forwarding class: mail, Index: 22

    Transmit rate: 5 percent, Rate Limit: none, Buffer size: 5 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

  Scheduler: db-sched, Forwarding class: db, Index: 22

    Transmit rate: 10 percent, Rate Limit: none, Buffer size: 10 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

  Scheduler: erp-sched, Forwarding class: erp, Index: 22

    Transmit rate: 10 percent, Rate Limit: none, Buffer size: 10 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

  Scheduler: be-sched, Forwarding class: best-effort, Index: 20

    Transmit rate: 35 percent, Rate Limit: none, Buffer size: 35 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

  Scheduler: nc-sched, Forwarding class: network-control, Index: 22

    Shaping rate: 5 percent, Rate Limit: none, Buffer size: 5 percent,

    Priority: Strict-high

    Drop profiles:

      Loss priority   Protocol    Index    Name

      High            non-TCP         1   

      High            TCP             1   

Ý nghĩa (Meaning)

Kết quả đầu ra này cho thấy rằng các lớp chuyển tiếp (forwarding classes) đã được gán vào các bộ lập lịch (schedulers).

Xác minh rằng bộ ánh xạ lập lịch (scheduler map) đã được áp dụng cho các giao diện

Mục đích (Purpose)

Xác minh rằng bộ ánh xạ lập lịch (scheduler map) đã được áp dụng cho các giao diện.

Thao tác (Action)

user@switch> show class-of-service interface...           

Physical interface: ge-0/0/20, Index: 149

Queues supported: 8, Queues in use: 8

  Scheduler map: ethernet-cos-map, Index: 43366

  Input scheduler map: , Index: 3...

Physical interface: ge-0/0/21, Index: 150

Queues supported: 8, Queues in use: 8

  Scheduler map: ethernet-cos-map, Index: 15103

  Input scheduler map: , Index: 5 ...

Ý nghĩa (Meaning)

Kết quả đầu ra này bao gồm thông tin chi tiết về các giao diện mà bộ ánh xạ lập lịch (scheduler map) ethernet-cos-map đã được áp dụng, cụ thể là các giao diện ge-0/0/20ge-0/0/21.

Xác minh rằng giới hạn băng thông cổng (Port Shaping) đã được áp dụng

Mục đích (Purpose)

Xác minh rằng giới hạn băng thông cổng (Port Shaping) đã được áp dụng cho một giao diện.

Thao tác (Action)

user@switch> show interfaces ge-0/0/0 extensive

Physical interface: ge-0/0/0, Enabled, Physical link is Up

  Interface index: 239, SNMP ifIndex: 548, Generation: 242

  Link-level type: Ethernet, MTU: 1514, Speed: Auto, Duplex: Auto, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online,

  Media type: Copper

  Device flags   : Present Running

  Interface flags: SNMP-Traps Internal: 0x0

  Link flags     : None

  CoS queues     : 8 supported, 8 maximum usable queues

  Hold-times     : Up 0 ms, Down 0 ms

  Current address: 00:23:9c:0b:ae:8d, Hardware address: 00:23:9c:0b:ae:8d

  Last flapped   : 2012-07-07 03:21:52 UTC (1d 18:02 ago)

  Statistics last cleared: 2012-07-07 23:54:34 UTC (21:29:59 ago)

  Traffic statistics:

   Input  bytes  :                    0                    0 bps

   Output bytes  :           2299853696            345934816 bps

   Input  packets:                    0                    0 pps

   Output packets:             17967609               337827 pps

   IPv6 transit statistics:

    Input  bytes  :                   0

    Output bytes  :                   0

    Input  packets:                   0

    Output packets:                   0

  Input errors:

    Errors: 0, Drops: 0, Framing errors: 0, Runts: 0, Policed discards: 0, L3 incompletes: 0, L2 channel errors: 0, L2 mismatch timeouts: 0, FIFO errors: 0, Resource errors: 0

  Output errors:

    Carrier transitions: 0, Errors: 0, Drops: 0, Collisions: 0, Aged packets: 0, FIFO errors: 0, HS link CRC errors: 0, MTU errors: 0, Resource errors: 0

  Egress queues: 8 supported, 4 in use

  Queue counters:       Queued packets  Transmitted packets      Dropped packets

    0 best-effort                       0             18302337                    0

    1 assured-forw                   0                    0                    0

    5 expedited-fo                    0                    0                    0

    7 network-cont                   0                    0                    0

  Queue number:         Mapped forwarding classes

    0                   best-effort

    1                   assured-forwarding

    5                   expedited-forwarding

    7                   network-control

  Active alarms  : None

  Active defects : None

  MAC statistics:                      Receive         Transmit

    Total octets                              0       2299853696

    Total packets                            0         17967609

    Unicast packets                        0         17967609

    Broadcast packets                    0                0

    Multicast packets                      0                0

    CRC/Align errors                       0                0

    FIFO errors                              0                0

    MAC control frames                   0                0

    MAC pause frames                    0                0

    Oversized frames                      0

    Jabber frames                           0

    Fragment frames                       0

    Code violations                          0

  Autonegotiation information:

    Negotiation status: Complete

    Link partner:

        Link mode: Full-duplex, Flow control: Symmetric, Remote fault: OK, Link partner Speed: 1000 Mbps

    Local resolution:

        Flow control: Symmetric, Remote fault: Link OK

  Packet Forwarding Engine configuration:

    Destination slot: 1

  CoS information:

    Direction : Output

    CoS transmit queue             Bandwidth              Buffer Priority   Limit

                            %            bps     %          usec

    0 best-effort          95      950000000    95            NA      low    none

    7 network-control       5       50000000     5            NA      low    none

  Interface transmit statistics: Disabled

  Logical interface ge-1/0/10.0 (Index 69) (SNMP ifIndex 638) (Generation 138)

    Flags: SNMP-Traps 0x0 Encapsulation: ENET2

    Traffic statistics:

     Input  bytes  :                    0

     Output bytes  :                   0

     Input  packets:                   0

     Output packets:                  0

    Local statistics:

     Input  bytes  :                    0

     Output bytes  :                   0

     Input  packets:                   0

     Output packets:                  0

    Transit statistics:

     Input  bytes  :                    0                    0 bps

     Output bytes  :                   0                    0 bps

     Input  packets:                   0                    0 pps

     Output packets:                  0                    0 pps

    Protocol eth-switch, Generation: 163, Route table: 0

      Flags: Trunk-Mode

Thống kê lưu lượng (Traffic statistics)

Trường Traffic statistics: trong kết quả đầu ra cho thấy lưu lượng egress (ra) khoảng 400 Mbps (345,934,816 bps).

Khi giới hạn băng thông cổng (Port Shaping) 100 Mbps được áp dụng cho giao diện ge-0/0/0, bạn sẽ thấy kết quả sau khi chạy lệnh:

  • show interfaces ge-0/0/0 statistics
  • show class-of-service interface ge-0/0/0

user@switch> show interfaces ge-0/0/0 statistics

Physical interface: ge-0/0/0, Enabled, Physical link is Up

  Interface index: 239, SNMP ifIndex: 548, Generation: 242

  Link-level type: Ethernet, MTU: 1514, Speed: Auto, Duplex: Auto, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online,

  Media type: Copper

  Device flags   : Present Running

  Interface flags: SNMP-Traps Internal: 0x0

  Link flags     : None

  CoS queues     : 8 supported, 8 maximum usable queues

  Hold-times     : Up 0 ms, Down 0 ms

  Current address: 00:23:9c:0b:ae:8d, Hardware address: 00:23:9c:0b:ae:8d

  Last flapped   : 2012-07-07 03:21:52 UTC (1d 18:10 ago)

  Statistics last cleared: 2012-07-07 23:54:34 UTC (21:37:58 ago)

  Traffic statistics:

   Input  bytes  :                    0                    0 bps

   Output bytes  :          15779512832            100223104 bps

   Input  packets:                   0                    0 pps

   Output packets:            123277444                97874 pps

   IPv6 transit statistics:

    Input  bytes  :                   0

    Output bytes  :                  0

    Input  packets:                  0

    Output packets:                 0

  Input errors:

    Errors: 0, Drops: 0, Framing errors: 0, Runts: 0, Policed discards: 0, L3 incompletes: 0, L2 channel errors: 0, L2 mismatch timeouts: 0, FIFO errors: 0, Resource errors: 0

  Output errors:

    Carrier transitions: 0, Errors: 0, Drops: 0, Collisions: 0, Aged packets: 0, FIFO errors: 0, HS link CRC errors: 0, MTU errors: 0, Resource errors: 0

  Egress queues: 8 supported, 4 in use

  Queue counters:       Queued packets  Transmitted packets      Dropped packets

    0 best-effort                     0            123350092             57012484

    1 assured-forw                 0                    0                    0

    5 expedited-fo                  0                    0                    0

    7 network-cont                 0                    0                    0

  Queue number:         Mapped forwarding classes

    0                   best-effort

    1                   assured-forwarding

    5                   expedited-forwarding

    7                   network-control

  Active alarms  : None

  Active defects : None

  Autonegotiation information:

    Negotiation status: Complete

    Link partner:

        Link mode: Full-duplex, Flow control: Symmetric, Remote fault: OK, Link partner Speed: 1000 Mbps

    Local resolution:

        Flow control: Symmetric, Remote fault: Link OK

  Packet Forwarding Engine configuration:

    Destination slot: 1

  CoS information:

    Direction

 

Như vậy là chúng ta đã hoàn thành Cấu hình CoS trên Switch EX Series, chúc các bạn thực hiện thành công.Hi vọng bài viết này sẽ giúp ích cho các bạn trong công việc.

Nếu bạn có vấn đề gì thắc mắc đừng ngần ngại liên hệ với chúng tôi theo thông tin dưới đây để được hỗ trợ thêm.

Hẹn gặp lại các bạn trong các bài viết tiếp theo !

 

CÔNG TY CỔ PHẦN DỊCH VỤ CÔNG NGHỆ DATECH

• Địa chỉ: Số 23E4 KĐT Cầu Diễn, Tổ 7, Phú Diễn, Bắc Từ Liêm, Hà Nội

• Điện thoại: 02432012368

• Hotline: 098 115 6699

• Email: info@datech.vn

• Website: https://datech.vn