示例:配置基于 CoS 的转发
路由器 A 在路由器 D 上有两个要目标的 10.255.71.208 路由。一个路由通过路由器 B,另一个通过路由器 C,如图 1 所示。
通过基于 CoS 的转发 (CBF) 配置路由器 A,以选择队列 0 和队列 2 的路由器 B,以及为队列 1 和队列 3 选择路由器 C。
图 1:基于 CoS 的示例转发
将 CBF 配置为 OSPF 作为 IGP 时,必须将下一跃点指定为接口名称,而不是 IPv4 或 IPv6 地址。此示例中的下一跃点被指定为 ge-2/0/0.0 和 so-0/3/0.0。
[edit class-of-service]
forwarding-policy {
next-hop-map my_cbf {
forwarding-class be {
next-hop ge-2/0/0.0;
}
forwarding-class ef {
next-hop so-0/3/0.0;
}
forwarding-class af {
next-hop ge-2/0/0.0;
}
forwarding-class nc {
next-hop so-0/3/0.0;
}
}
}
classifiers {
inet-precedence inet {
forwarding-class be {
loss-priority low code-points [ 000 100 ];
}
forwarding-class ef {
loss-priority low code-points [ 001 101 ];
}
forwarding-class af {
loss-priority low code-points [ 010 110 ];
}
forwarding-class nc {
loss-priority low code-points [ 011 111 ];
}
}
}
forwarding-classes {
queue 0 be;
queue 1 ef;
queue 2 af;
queue 3 nc;
}
interfaces {
at-4/2/0 {
unit 0 {
classifiers {
inet-precedence inet;
}
}
}
}
[edit policy-options]
policy-statement cbf {
from {
route-filter 10.255.71.208/32 exact;
}
then cos-next-hop-map my_cbf;
}
[edit routing-options]
graceful-restart;
forwarding-table {
export cbf;
}
[edit interfaces]
traceoptions {
file trace-intf size 5m world-readable;
flag all;
}
so-0/3/0 {
unit 0 {
family inet {
address 10.40.13.1/30;
}
family iso;
family mpls;
}
}
ge-2/0/0 {
unit 0 {
family inet {
address 10.40.12.1/30;
}
family iso;
family mpls;
}
}
at-4/2/0 {
atm-options {
vpi 1 {
maximum-vcs 1200;
}
}
unit 0 {
vci 1.100;
family inet {
address 10.40.11.2/30;
}
family iso;
family mpls;
}
}