I Know What Your Packet Did Last Hop: Using Packet Histories to Troubleshoot Networks

在SDN场景下,对数据包和交换机信息进行镜像,重组packet history。

Packet history的定义:A packet history is the route a packet takes through a network plus the switch state and header modifications it encounters at each hop.

基于packet history,文章实现了四个应用

  1. ndb, an interactive network debugger
  2. netwatch, a live network invariant monitor
  3. netshark, a network-wide packet history logger
  4. nprof, a hierarchical network profiler

NetSight还提供了Packet History Filter语言,一个regex-like语言以实现查询。

NetSight通过postcard来实现对packet header的采集。 Each postcard contains a copy of the packet header, the switch ID, the output ports, and a version number for the switch forwarding state.

Motivating Packet Histories

packet history的定义

  • what the packet looked like as it entered the network (headers)
  • where the packet was forwarded (switches + ports)
  • how it was changed (header modifications)
  • why it was forwarded that way (matched flow/actions + flow table).

Challenges

  • Path Visibility: we must somehow view and record the paths taken by every packet.
  • State Visibility: we must reconstruct the exact switch state encountered at each packet hop.
  • Modification Visibility: we must know where and how each packet has changed.
  • Collection Scale: 采集性能要求
  • Storage Scale: 大规模存储
  • Processing Scale: query processing需要跟上采集和存储

Opportunities by SDN

SDN提供了一条通往我们所需的相关可见性的道路:逻辑上的集中控制提供了一个修改转发规则的自然位置,而交换机状态的共同表示使我们能够推理任何变化。

The NetSight API

Packet History Filter由Postcard Filters组成。 一个Postcard Filters就是一个包在一跳上的信息。 这个信息以一种filter的形式存在。

PHF由PF组合而来。

Applications

上面四个应用,主要是针对NetSight API给的例子

How NetSight Works

NetSight Philosophy

NetSight assembles packet histories using postcards, event records sent out whenever a packet traverses a switch. Each postcard contains the packet header, switch ID, output port, and current version of the switch state.

在普通情况下,NetSight给出以下的三个假设

  1. the network does not drop postcards
  2. the network does not modify packets
  3. packets are all unicast

System Architecture

一个NetSight Coordinator(负责管理NetSight Server)、多个NetSight Server(负责收集数据)。

Life Of a Postcard

Postcard Generation

当数据包进入交换机时,交换机通过复制数据包,将其截断到最小的数据包大小,用相关状态进行标记,并将其转发到NetSight服务器,从而创建一个Postcard。 原始数据包保持不动,继续转发。

Postcards需要被转发到NetSight Server上,为了保证这一步不是瓶颈,NetSight使用shuffling操作。通过对五元组的哈希保证局部性。

Postcards的shuffling被分成基于时间的 "回合"。 在一个回合结束时,服务器将该回合中收集的postcards发送到他们的最终目的地,在那里相应的数据包历史可以被组装和存档。 这个阶段提供了通过利用流内和流之间的header value的冗余性,在shuffle前压缩postcards数据的机会。

History Assembly

数据包历史必须是有序的,但由于从交换机到NetSight服务器的传播和排队延迟的不同,postcards可能会不按顺序到达。 NetSight使用拓扑信息,而不是细粒度的时间戳,来安排postcards的顺序。

NetSight将不变信息(IP ID, fragment offset, and TCP sequence number)等组合起来形成一个Packet ID,以Packet ID为key,存入一个Path Table。 The Path Table是一个hash table indexed by packet ID,Path Table的值是对应的postcards的list。

对每个index对应的postcards list,NetSight使用switch IDs、output ports、topology data进行拓扑排序。

一些别的设计

  • Filter triggers:实现real-time的规则触发
  • History archival:存储
  • Historical queries:查询

Relaxing the Assumptions

放宽假设。

  • Dropped Postcards:处理交给用户
  • Non-unicast Packets:对于广播和多播流量,NetSight将数据包历史以二维图形的形式返回,而不是列表。对于循环,NetSight以一个任意的起点返回数据包历史,并将其标记为循环。
  • Modified Packets:NAT可能改变packet header,破坏shuffle的locality。采用二次shuffle

NetSight Implementation

NetSight实现包括两个进程:一个插在OpenFlow控制器和它的交换机之间以记录配置变化,而另一个处理所有postcards和历史。

Postcard Generation

NetSight原型是针对SDN的,利用了网络状态变化由控制器协调的事实。 这为监控和拦截交换机配置变化提供了一个理想的场所。 它使用一个称为流表状态记录器(简称记录器)的透明代理,它位于控制器和OpenFlow交换机之间的控制路径上。

当控制器修改交换机上的流表时,记录器会拦截消息并将其存储在数据库中。 对于每个由控制器发送到交换机的OpenFlow规则,记录器添加新的动作,为每个匹配该规则的数据包生成一张明信片,此外还有控制器指定的转发。

Compression

NetSight在两个地方对postcards进行压缩:(1)在把它们shuffle到服务器之前,以及(2)在把集合的数据包历史存档到磁盘之前。

NetSight通过计算同一流中连续的数据包之间的差异来压缩数据包。 一个差异是一个(Header,Value)对,其中Header唯一标识了改变的字段,Value是其新值。

PHF Matching

NetSight中的PHF匹配引擎是基于RE1 regex引擎,并使用Linux x86 BPF编译器来匹配数据包头与BPF过滤器。