Sổ tay kỹ thuật

Cấu hình QoS trên IOS XR (MQC) và Junos class-of-service

how-to#qos#iosxr#junos#mpls· cập nhật 2026-11-06

Cấu hình policing ingress cho khách, marking EXP, hàng đợi priority/bandwidth trên link core và shaping cho khách bằng class-map/policy-map trên IOS XR và class-of-service trên Junos.

Sửa trang này
Mục lục

Tóm tắt: IOS XR dùng MQC: class-map (match) → policy-map (hành động theo class) → service-policy input|output trên interface. Junos tách thành nhiều khối trong class-of-service: classifier (gói vào forwarding-class nào), scheduler + scheduler-map (hàng đợi ra), rewrite-rules (đánh dấu khi ra), còn policer nằm ở firewall policer. Khái niệm xem QoS concepts.

Ví dụ: PE nhận khách tại GigabitEthernet0/0/0/1 (XR) / ge-0/0/1 (Junos), khách mua 500 Mbps, thoại EF tối đa 50 Mbps. Link core HundredGigE0/0/0/0 / et-0/0/0 có 3 lớp: voice (EXP 5), network control (EXP 6), best-effort.

Luồng hoạt động

flowchart LR C["Khách"] --> I["Ingress PE: classify DSCP, police, set EXP"] I --> M["MPLS core"] M --> E["Egress core: priority EXP 5, bandwidth EXP 6, BE"] E --> P["PE xa: shape 500M về khách"]

Cấu hình

IOS XR

class-map match-any VOICE
 match dscp ef
 end-class-map
!
class-map match-any EXP5
 match mpls experimental topmost 5
 end-class-map
!
class-map match-any EXP6
 match mpls experimental topmost 6
 end-class-map
!
policy-map CUST-IN
 class VOICE
  police rate 50 mbps
  !
  set mpls experimental imposition 5
 !
 class class-default
  police rate 500 mbps
  !
  set mpls experimental imposition 0
 !
 end-policy-map
!
policy-map CORE-OUT
 class EXP5
  priority level 1
  police rate percent 20
  !
 !
 class EXP6
  bandwidth remaining percent 10
 !
 class class-default
  bandwidth remaining percent 90
 !
 end-policy-map
!
policy-map CUST-SHAPE-OUT
 class class-default
  shape average 500 mbps
 !
 end-policy-map
!
interface GigabitEthernet0/0/0/1
 service-policy input CUST-IN
 service-policy output CUST-SHAPE-OUT
!
interface HundredGigE0/0/0/0
 service-policy output CORE-OUT
!

Mặc định police rate có conform transmit, exceed drop. Muốn remark thay vì drop, khai báo trong submode police: exceed-action set mpls experimental imposition 1.

Khả năng QoS khác nhau nhiều giữa các dòng IOS XR. ASR 9000 hỗ trợ đầy đủ mẫu trên. NCS 5500/5700 dùng mô hình riêng: ingress phân loại và set traffic-class, egress queuing match theo traffic-class, một số hành động (vd marking egress) bị giới hạn. Kiểm tra QoS configuration guide cho đúng platform và release trước khi áp.

Junos

set firewall policer VOICE-50M if-exceeding bandwidth-limit 50m
set firewall policer VOICE-50M if-exceeding burst-size-limit 62500
set firewall policer VOICE-50M then discard
set firewall policer CUST-500M if-exceeding bandwidth-limit 500m
set firewall policer CUST-500M if-exceeding burst-size-limit 625k
set firewall policer CUST-500M then discard
set firewall family inet filter CUST-IN term VOICE from dscp ef
set firewall family inet filter CUST-IN term VOICE then policer VOICE-50M
set firewall family inet filter CUST-IN term VOICE then forwarding-class expedited-forwarding
set firewall family inet filter CUST-IN term VOICE then accept
set firewall family inet filter CUST-IN term REST then policer CUST-500M
set firewall family inet filter CUST-IN term REST then forwarding-class best-effort
set firewall family inet filter CUST-IN term REST then accept
set interfaces ge-0/0/1 unit 0 family inet filter input CUST-IN
 
set class-of-service classifiers exp CORE-EXP import default
set class-of-service rewrite-rules exp CORE-EXP-RW forwarding-class expedited-forwarding loss-priority low code-point 101
set class-of-service rewrite-rules exp CORE-EXP-RW forwarding-class network-control loss-priority low code-point 110
set class-of-service rewrite-rules exp CORE-EXP-RW forwarding-class best-effort loss-priority low code-point 000
 
set class-of-service schedulers SCH-EF transmit-rate percent 20
set class-of-service schedulers SCH-EF priority strict-high
set class-of-service schedulers SCH-NC transmit-rate percent 10
set class-of-service schedulers SCH-NC priority low
set class-of-service schedulers SCH-BE transmit-rate remainder
set class-of-service schedulers SCH-BE priority low
set class-of-service scheduler-maps CORE-MAP forwarding-class expedited-forwarding scheduler SCH-EF
set class-of-service scheduler-maps CORE-MAP forwarding-class network-control scheduler SCH-NC
set class-of-service scheduler-maps CORE-MAP forwarding-class best-effort scheduler SCH-BE
 
set class-of-service interfaces et-0/0/0 scheduler-map CORE-MAP
set class-of-service interfaces et-0/0/0 unit 0 classifiers exp CORE-EXP
set class-of-service interfaces et-0/0/0 unit 0 rewrite-rules exp CORE-EXP-RW
set class-of-service interfaces ge-0/0/1 shaping-rate 500m

Forwarding-class mặc định trên MX: best-effort (queue 0), expedited-forwarding (1), assured-forwarding (2), network-control (3). Code point EXP viết dạng 3 bit (101 = 5), DSCP dạng 6 bit hoặc alias (ef, af41). burst-size-limit tính bằng byte, thường chọn khoảng 10 ms ở tốc độ policer (500 Mbps × 10 ms = 625 KB).

Junos: strict-high không tự giới hạn theo transmit-rate. Giới hạn hàng thoại bằng policer ở ingress (như trên) để nó không chiếm hết link khi có lỗi marking.

Kiểm tra

Mục đích IOS XR Junos
Counter theo class show policy-map interface HundredGigE0/0/0/0 output show interfaces queue et-0/0/0
Policer ingress khách show policy-map interface GigabitEthernet0/0/0/1 input show firewall filter CUST-IN hoặc show policer
Tham số đã cài xuống phần cứng show qos interface HundredGigE0/0/0/0 output show class-of-service interface et-0/0/0
Forwarding class và queue — show class-of-service forwarding-class
Định nghĩa classifier / rewrite show running-config policy-map CORE-OUT show class-of-service classifier name CORE-EXP

Lỗi thường gặp

Triệu chứng Nguyên nhân Cách xử lý
Commit XR báo không hỗ trợ trên interface Hành động không có trên platform/hướng đó (vd NCS 5500 queuing ingress) Đọc QoS guide của platform, đổi sang mô hình traffic-class
Class voice luôn 0 gói Khách không đánh DSCP, hoặc PE nhận gói đã có label (match DSCP thay vì EXP) Xem counter từng class; match đúng trường theo vị trí trong mạng
Khách đo được thấp hơn tốc độ mua Burst policer quá nhỏ, TCP bị drop răng cưa Tăng burst hoặc dùng shaping ở phía egress thay cho policing
Junos: mọi traffic vào best-effort Chưa gắn classifier cho unit, hoặc filter không có then forwarding-class show class-of-service interface để xem classifier đang áp
EXP về 0 ở PE xa Rewrite rule thiếu trên link core, hoặc PHP làm mất label ngoài Gắn rewrite-rules exp; xem mục MPLS trong QoS concepts
BGP/IGP flap khi link nghẽn Network control không có hàng riêng Thêm lớp cho EXP 6 / CS6 với băng thông bảo đảm

Tham khảo