cisco 877 路由器 QoS 对特定目的地的流量

网络工程 思科 路由器 服务质量
2021-07-28 20:03:51

是否可以在运行以下命令的 cisco 877 上限制进入或进入特定 IP 地址的流量:C870-ADVIPSERVICESK9-M, 12.4(15)T12, RELEASE SOFTWARE (fc3)?

背景:我们有一个 WAN,其中瘦客户端使用 citrix 登录。发送大打印作业时,桌面会话会受到影响。所以我想限制与源/目标打印服务器的流量。

2个回答

你所描述的将是这样的:

class-map match-all Printer
 match access-group name Printer
!
policy-map WAN-OUT
 class Printer
  shape average 1000000
 class class-default
  fair-queue
  random-detect
!
int WAN
  service-policy output WAN-OUT
!
ip access-list extended Printer
 permit ip any 192.0.2.0 0.0.0.255

这将匹配去往 192.0.2/24 的流量并将其整形为 1Mbps。但是我认为这不一定是您想要的,如果电路没有其他需求怎么办,您不希望打印作业在那个时候满负荷运转吗?

也许将流量分为 3 类,例如

  1. 重要的
  2. 普通的
  3. 清道夫

配置可能是这样的:

class-map match-any Important
 match access-group name Important
 match precedence 4  5  6  7 
 match precedence 1  2  3 
class-map match-any Normal
 match precedence 0 
 match access-group name Normal
class-map match-any Scavanger
 match access-group name Scavanger
!
class-map match-all QOS5
 match qos-group 5
class-map match-all QOS3
 match qos-group 3
class-map match-all QOS0
 match qos-group 0
!
policy-map LAN-IN
 class Scavanger
  set qos-group 0
 class Important
  set qos-group 5
 class Normal
  set qos-group 3
!
policy-map WAN-OUT
 class QOS5
  priority percent 80
 class QOS3
  bandwidth percent 20 
 class QOS0
!
int LAN
  service-policy input LAN-IN
int WAN
  service-policy output WAN-OUT
!

现在在 LAN 入口中,我们匹配流量并为其提供内部 qos-group 5、3、0,这些数字无关紧要,它们可以是任何东西,这只是在不破坏现有 CoS/PREC/DSCP 位的情况下区分流量的方法。

在我们标记 LAN 入口中的流量后,在 WAN 出口上,我们匹配先前定义的 qos-groups 并以不同方式处理流量。

在这里,我们为重要流量赋予容量 80% 的低延迟特权。对于普通流量,我们提供 20% 的合同,因此如果重要流量发送 100% 并且您开始发送普通流量,那么将丢弃 20% 的重要流量,以让一些普通流量通过。我们没有给 Scavanger 班级提供合同容量,它只会在重要或普通班级使用的容量低于合同容量时发送。

鉴于您的目标是避免 Citrix 会话滞后,我希望您只希望将 Citrix 流量优先于所有其他流量?这样,如果不是大型打印作业导致饱和,则相同的 QoS 仍然适用。

我没有用 Citrix 明确测试过这个配置,但这是我使用的。

注意:我假设您的 877 是 ADSL 调制解调器/路由器

首先,您要定义一个类映射来匹配要应用 QoS 规则的流量:

! You could match against traffic in other ways, such as via an ACL of some kind.
class-map match-any Citrix
 match protocol citrix 

然后您要定义您的 QoS 策略。我假设您的 WAN 链接是公共互联网链接。如果您有某种专用 WAN 链接(假设 QoS 还没有被剥离),那么在传入和传出流量以及链接的两侧都有 QoS 对您有益。

但是,在 WAN 链接上剥离 QoS 的情况下,您能做的最好的事情就是优先考虑上游流量,以提高整体性能。

policy-map OutboundPrioritisationPolicy
 class Citrix
! In this example I'm allowing Citrix to take up to 70% of your upstream traffic,
! as it requires, which may be overkill, depending on how many sessions you have
! running and how important they are vs. other traffic.
    priority percent 70
 ! I've also added fair-queue to all other traffic as I find it helps generally. 
 ! But this is optional for what you're trying to achieve.
 class class-default
    fair-queue

如果您使用 ADSL,则需要应用“父”策略,该策略实际应用于 WAN 接口。我相信这与 ADSL 使用虚拟接口的方式有关。必须使用整形器强制执行链接的最大上传速度。

! Use the shape average command to define your maximum upload speed.
! In this case I've set it to 1.2 Mbps. But you will want to confirm your own maximum.
policy-map OutboundPrioritisationPolicyParent
 class class-default
    shape average 1200000
  service-policy OutboundPrioritisationPolicy

最后,将您的策略​​应用到适当的接口,在我之前做过的 877 上,它似乎有效(您想要的行是“service-policy”命令)

请参阅此处以供参考:https : //supportforums.cisco.com/thread/2010527

! We want to apply the policy to the PVC interface
interface ATM0.1 point-to-point
 atm route-bridged ip
 pvc 8/35
  ! Policy added here
  service-policy output OutboundPrioritisationPolicy
  vbr-nrt 766 766
  tx-ring-limit 4
  encapsulation aal5mux ppp dialer
  dialer pool-member 1

应用服务策略后,您当然希望确保它有效。我通常做的主要有两件事:

1) 首先,也是最容易的,检查策略上的数据包计数器。它们应该在您尝试应用 QoS 规则的策略映射上增加。

2)这有点复杂,应该在下班后完成,但这是一个更好的测试。

  • 在 LAN 上设置一台运行 iperf 或其他流量生成器的 PC

  • 设置您的流量生成器以发送足够的流量来使您的上游速度饱和。因此,例如,如果您有一条最大上行速度为 1 Mbps 的 ADSL 线路,您可能希望生成接近该数量的数据,以便让您的 Citrix 客户端轻松明显地降低质量。

    例如:iperf -c XXX -u -p 5001 --time 360​​ -i 3 -b 2

    在这种情况下,我们发送 UDP:5001 流量,持续 6 分钟,每 3 秒更新一次。2 Mbp/s 的流量正在生成到 XXXX 的目的地(注意:如果您生成 UDP 流量,那么运行 iperf 服务器不是绝对必要的)。

  • 尝试登录 Citrix,它应该非常可怕。

  • 现在应用您的服务政策。它应该明显更好。

  • 也许尝试几次,确保你注意到有和没有 QoS 的区别,以确保它在做它的工作。