流分类、流量监管、流量整形、拥塞管理和拥塞避免是构造有区别地实施服务的基石,它们主要完成如下功能:
流分类:依据一定的匹配规则识别出对象。流分类是有区别地实施服务的前提。
流量监管:对进入设备的特定流量的规格进行监管。当流量超出规格时,可以采取限制或惩罚措施,以保护运营商的商业利益和网络资源不受损害。
流量整形:一种主动调整流的输出速率的流控措施,通常是为了使流量适配下游设备可供给的网络资源,避免不必要的报文丢弃和拥塞。
拥塞管理:拥塞管理是必须采取的解决资源竞争的措施。通常是将报文放入队列中缓存,并采取某种调度算法安排报文的转发次序。
拥塞避免:过度的拥塞会对网络资源造成损害。拥塞避免监督网络资源的使用情况,当发现拥塞有加剧的趋势时采取主动丢弃报文的策略,通过调整流量来解除网络的过载。
在这些流量管理技术中,流分类是基础,它依据一定的匹配规则识别出报文,是有区别地实施服务的前提;而流量监管、流量整形、拥塞管理和拥塞避免从不同方面对网络流量及其分配的资源实施控制,是有区别地提供服务思想的具体体现。
Juniper EX交换机支持每端口8个队列的划分。
如图所示:EX3200交换机的ge-0/0/0和ge-0/0/1端口连接2部VOIP话机,分配到voice-vlan中,ge-0/0/2连接一个摄像头划分到camera-vlan中,ge-0/0/3,ge-0/0/4,ge-0/0/5和ge0/0/6端口分别连接4台服务器,分配到server-vlan中。针对这3个vlan定义3个COS处理。
相应的接口地址如下:
配置如下:
[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/32
set firewall family ethernet-switching filter voip_class term voip from source-address 192.168.1.2/32
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 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.14/32
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.23/32
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.24/32
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.25/32
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.26/32
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 buffer-size percent 10
set class-of-service schedulers voice-sched priority strict-high
set class-of-service schedulers voice-sched transmit-rate percent 10
set class-of-service schedulers video-sched buffer-size percent 15
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 buffer-size percent 5
set class-of-service schedulers nc-sched priority strict-high
set class-of-service schedulers nc-sched transmit-rate percent 5
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