通过 Junos OS CoS 进程配置基本数据包流
以下配置演示了通过 CoS 过程的数据包流:
定义分类器
如果您信任数据包标头中的 CoS 值,则可以使用行为聚合分类将这些值映射到转发类并丢弃优先级。例如:
[edit class-of-service] classifiers { exp exp_classifier { forwarding-class data-queue { loss-priority high code-points 001; loss-priority low code-points 000; } forwarding-class nc-queue { loss-priority high code-points 111; loss-priority low code-points 110; } forwarding-class video-queue { loss-priority high code-points 011; loss-priority low code-points 010; } forwarding-class voice-queue { loss-priority high code-points 101; loss-priority low code-points 100; } }
如果不信任数据包标头中的 CoS 值,则可以使用更复杂的多域分类将入口流量映射到转发类并丢弃优先级。例如:
[edit firewall] family inet { filter classify { term sip { from { protocol [ udp tcp ]; port 5060; } then { forwarding-class nc-queue; loss-priority low; accept; } } } }
另请参阅
将分类器应用于接口上的传入数据包
您可以在层次结构级别将行为聚合分类器应用于逻辑接口 [edit class-of-service interfaces]
。例如:
[edit class-of-service] interfaces { so-* { unit 0 { classifiers { exp exp_classifier; } } } t3-* { unit 0 { classifiers { exp exp_classifier; } } } }
将多域分类器作为输入过滤器应用于层级的 [edit interfaces]
逻辑接口。例如:
[edit interfaces] fe-0/0/2 { unit 0 { family inet { filter { input classify; } address 10.12.0.13/30; } } }
定义监管器以限制流量和控制拥塞
如果需要对流量进行速率限制,可以通过丢弃多余流量(硬管制)或将多余的流量重新分配给不同的转发类和/或丢失优先级(软管制),请定义监管器并将监管器应用于该流量的防火墙过滤器。例如:
[edit firewall] policer be-lp { if-exceeding { bandwidth-limit 10m; burst-size-limit 62500; } then loss-priority high; } family inet { filter be-lp { term t1 { from { protocol tcp; port 80; } then policer be-lp; then loss-priority low; then accept; } } }
另请参阅
定义丢弃配置文件
使用丢弃配置文件定义延迟缓冲区占用范围内的丢弃概率,从而支持随机早期检测 (RED) 流程。
[edit class-of-service] drop-profiles { be-red { fill-level 20 drop-probability 25; fill-level 30 drop-probability 50; fill-level 40 drop-probability 75; fill-level 50 drop-probability 100; } }
另请参阅
将每个转发类分配给一个队列
要为每个转发类提供差异化服务,请为每个转发类分配其自己的输出队列。例如:
[edit class-of-service] forwarding-classes { queue 0 data-queue; queue 1 video-queue; queue 2 voice-queue; queue 3 nc-queue; }
另请参阅
定义调度器
定义每个转发类的调度器特征。例如:
[edit class-of-service] schedulers { # data-scheduler { buffer-size percent 50; drop-profile-map loss-priority high protocol any drop-profile be-red; priority low; transmit-rate percent 50; } nc-scheduler { buffer-size percent 5; priority high; transmit-rate percent 5; } video-scheduler { buffer-size percent 25; priority strict-high; transmit-rate percent 25; } voice-scheduler { buffer-size percent 20; priority high; transmit-rate percent 20; } }
另请参阅
定义调度器图
使用调度器图将调度器映射到转发类。例如:
[edit class-of-service] scheduler-maps { sched1 { forwarding-class data-queue scheduler data-scheduler; forwarding-class nc-queue scheduler nc-scheduler; forwarding-class video-queue scheduler video-scheduler; forwarding-class voice-queue scheduler voice-scheduler; } }
另请参阅
定义 CoS 标头重写规则
使用重写规则重新定义传出数据包的 CoS 位模式。例如:
[edit class-of-service] rewrite-rules { inet-precedence inet-rewrite { forwarding-class data-queue { loss-priority high code-point 001; loss-priority low code-point 000; } forwarding-class nc-queue { loss-priority high code-point 111; loss-priority low code-point 110; } forwarding-class video-queue { loss-priority high code-point 101; loss-priority low code-point 100; } forwarding-class voice-queue { loss-priority high code-point 011; loss-priority low code-point 010; } } }
另请参阅
将调度器图和重写规则应用于出口接口
[edit class-of-service] interfaces { ge-* { scheduler-map sched1; unit * { rewrite-rules { inet-precedence inet-rewrite; } } } }
另请参阅
释放
描述
21.2
从 Junos OS 21.2 版开始,Junos OS 无论配置顺序如何,都按字母顺序显示服务等级配置。