定义CoS重写规则(CLI过程)
您可以配置重写规则CoS EX 系列交换机出站接口上的传出数据包中的路由值,以便与目标对等方的策略匹配。策略匹配允许相邻网络的下游路由平台或交换机将每个数据包分类至相应的服务组。
要配置 CoS 重写规则,请为规则指定名称,并将其与转发类、丢失优先级和代码点关联,从而创建重写表,您可以在接口上启用重写规则。在 EX 系列交换机(EX4300交换机除外)上,您还可以在路由 VLAN 接口 (RVIS) 上启用重写规则。在EX4300交换机上,您还可以在集成路由和桥接 (IRB) 接口上启用重写规则。如果您需要自定义重写规则,可以使用防火墙过滤器配置创建自定义重写规则。您可以为 DSCP、IP 优先级CoS 802.1p 配置IEEE重写规则。
您可以为以下标记类型配置重写CoS规则:
dscp 和 dscp-ipv6—分别处理传入 IPv4 和 IPv6 数据包。在EX4300交换机上,不能在同一个接口上配置 DSCP IPv4 和 DSCP IPv6 重写规则。如果在接口上配置 DSCP IPv4 重写规则以重写 IPv4 流量,则同一重写规则也会应用于该接口上的 IPv6 流量,反之亦然。
ieee-802.1—处理第 2 层CoS。
inet-precedence—处理传入 IPv4 数据包。IP 优先级映射只需 DSCP 字段高三位。
要用相同类型的新重写规则替换接口上的现有重写规则,首先要明确删除重写规则,然后应用新规则。
要创建IEEE 802.1p 重写规则并启用它们位于第 2 层接口上:
要创建一IEEE 802.1p 重写规则,在重写表中命名为 所有
customup-rw
2 层接口:[edit class-of-service rewrite-rules] user@switch# set ieee-802.1 customup-rw forwarding-class be loss-priority low code-point 000 user@switch# set ieee-802.1 customup-rw forwarding-class be loss-priority high code-point 001 user@switch# set ieee-802.1 customup-rw forwarding-class af loss-priority low code-point 010 user@switch# set ieee-802.1 customup-rw forwarding-class af loss-priority high code-point 011 user@switch# set ieee-802.1 customup-rw forwarding-class ef loss-priority low code-point 100 user@switch# set ieee-802.1 customup-rw forwarding-class ef loss-priority high code-point 101 user@switch# set ieee-802.1 customup-rw forwarding-class nc loss-priority low code-point 110 user@switch# set ieee-802.1 customup-rw forwarding-class nc loss-priority high code-point 111
要启用 802.1p IEEE第 2 层接口上名为 customup-rw 的重写规则:
[edit] user@switch# set class-of-service interfaces ge-0/0/0 unit 0 rewrite-rules ieee-802.1 customup-rw
(在 EX4300 交换机上)要启用 802.1p IEEE第 2 层接口上名为 customup-rw 的重写规则:
[edit] user@switch# set class-of-service interfaces ge-0/0/0 rewrite-rules ieee-802.1 customup-rw
要启用 IEEE 802.1p 重写规则,在交换机上的所有千兆以太网接口上名为 customup-rw,请使用通配符表示接口名称和逻辑接口(单元)编号:
[edit] user@switch# set class-of-service interfaces ge-* unit * rewrite-rules customup-rw
(在 EX4300 交换机上)要启用 IEEE 802.1p 重写规则,在交换机上的所有千兆以太网接口上名为 customup-rw,请使用通配符表示接口名称:
[edit] user@switch# set class-of-service interfaces ge-* rewrite-rules customup-rw