# Patent

## Title
Remote port mirroring

## Abstract

A switch that facilitates remote port mirroring is described. The switch can include an encapsulation mechanism and a forwarding mechanism. The encapsulation mechanism can be configured to encapsulate a copy of a first packet in a second packet, thereby preserving header information (e.g., a VLAN identifier and/or a TRILL header) of the first packet. The forwarding mechanism can be configured to forward the first packet using header information of the first packet, and forward the second packet using header information of the second packet. The second packet can be received at a destination switch which extracts the first packet from the second packet, and sends the first packet on a port which is coupled to a network analyzer.

## Background
RELATED APPLICATION
This application claims priority to U.S. Provisional Application No. 61/352,790, entitled “Remote Port Monitoring in TRILL Networks,” filed 8 Jun. 2010, the contents of which are herein incorporated by reference.
This application also claims priority to U.S. Provisional Application No. 61/380,820, entitled “Remote Port Mirroring,” filed 8 Sep. 2010, the contents of which are herein incorporated by reference.


BACKGROUND
1. Technical Field
This disclosure relates to computer networking. More specifically, this disclosure relates to systems and techniques for remote port mirroring.
2. Related Art
Computer networking has permeated almost all aspects of our daily lives—at work we use computer networks to access files and send and receive emails, and at home we use them to make telephone calls, watch movies, and browse the World Wide Web (WWW). Since computer networks have become an important part of our daily lives, it is very important to ensure that network problems can be identified and resolved quickly.
Network analysis is an important technique that is used for identifying and resolving network problems. In network analysis, packets traversing the network are analyzed to ensure that the packets have the correct information. Unfortunately, some conventional techniques that facilitate network analysis do not provide all of the information necessary to identify and resolve network problems.
SUMMARY
Some embodiments of the present invention provide a system (e.g., a switch) that can perform remote port mirroring. Remote port mirroring is a technique in which certain packets are copied and sent across a network to a network analyzer. The network analyzer can then be used to analyze the copies of the packets to help identify and resolve network problems.
In some embodiments, a switch capable of remote port mirroring includes an encapsulation mechanism and a forwarding mechanism. The encapsulation mechanism can be configured to encapsulate a copy of a first packet in a second packet. Encapsulating the copy of the first packet in the second packet preserves header information of the first packet. Specifically, in some embodiments, the VLAN (Virtual Local Area Network) identifier in the first packet's header is preserved. In some embodiments, the TRILL header of the packet is preserved. The forwarding mechanism can be configured to forward the first packet using header information of the first packet, and forward the second packet using header information of the second packet.
In some embodiments, the first packet is an Ethernet packet (with or without one or more VLAN tags) and the second packet is a TRILL (Transparent Interconnection of Lots of Links) packet. In some embodiments, both the first packet and the second packet are TRILL packets. Note that a packet can be a unicast, a multicast, or a broadcast packet. Specifically, in some embodiments, the first packet is either a unicast packet or a multicast packet, and the second packet is either a unicast packet that is sent to a network analyzer or a multicast packet which is sent to a multicast address which is associated with a multicast group that includes the network analyzer.
Some embodiments of the present invention provide a network which includes a source switch and at least two destination switches. The source switch may be configured to: encapsulate a copy of a first packet in a second packet; send the first packet to a first destination switch; and send the second packet to a second destination switch. The second destination switch may be configured to: receive the second packet; extract the copy of the first packet from the second packet; and send the copy of the first packet on a port which is coupled to a network analyzer.



BRIEF DESCRIPTION OF THE FIGURES
FIG. 1 illustrates a TRILL network in accordance with some embodiments of the present invention.
FIG. 2 illustrates a portion of an Ethernet packet which includes a TRILL header in accordance with some embodiments of the present invention.
FIG. 3 illustrates a conventional remote port mirroring system.
FIG. 4A illustrates a remote port mirroring system which uses encapsulation in accordance with some embodiments of the present invention.
FIG. 4B illustrates a remote port mirroring system which uses encapsulation in accordance with some embodiments of the present invention.
FIG. 5 illustrates a switch in accordance with some embodiments of the present invention.
FIG. 6 presents a flowchart that illustrates a process for performing remote port mirroring in accordance with some embodiments of the present invention.
FIG. 7 illustrates a system in accordance with some embodiments of the present invention.



DETAILED DESCRIPTION
The following description is presented to enable any person skilled in the art to make and use the invention, and is provided in the context of a particular application and its requirements. Various modifications to the disclosed embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other embodiments and applications without departing from the spirit and scope of the present invention. Thus, the present invention is not limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
TRILL (Transparent Interconnection of Lots of Links)
TRILL combines the advantages of bridging and routing. Bridges (e.g., devices that perform layer-2 forwarding) can transparently connect multiple links to create a single local area network. Without TRILL, bridges use the spanning tree protocol (STP) which restricts the topology on which traffic is forwarded to a tree to prevent loops. Unfortunately, forwarding the traffic over a tree causes traffic concentration on the links that correspond to the tree edges, leaving other links completely unutilized. Unlike bridges, Internet Protocol (IP) routers (e.g., devices that perform IP forwarding) do not need to create a spanning tree for forwarding traffic. However, routers that forward IP traffic require more configuration than bridges, and moving nodes in an IP network requires changing the IP address of the nodes. Each link in an IP network is associated with an address prefix, and all nodes on that link must have that IP prefix. If a node moves to another link that has a different IP prefix, the node must change its IP address. Unless otherwise stated, the term “IP” refers to both “IPv4” and “IPv6” in this disclosure.
A TRILL network includes “routing bridges” (referred to as RBridges) which route packets, but like bridges, learn layer-2 address locations through receipt of packets. Since packets are routed, packet forwarding is not limited to a spanning tree. Also, since a hop count is included in a TRILL packet, packets do not circulate forever in the network in the presence of loops. Further, since the layer-2 address locations are learned, a TRILL network allows IP nodes to move from one link to another in the network without any restrictions.
FIG. 1 illustrates a TRILL network in accordance with some embodiments of the present invention. TRILL network 100 can be a service provider's network which includes core RBridges 102 and 104 and edge RBridges 106, 108, and 110. RBridges 102, 106, 108, and 110 are coupled to customer devices, whereas RBridge 104 is not. Specifically, port P3 on RBridge 102 can be coupled to a device in customer C3's network at site S1; ports labeled P1 on RBridges 106, 108, and 110 can be coupled to devices in customer C1's networks at sites S2, S3, and S4, respectively; and port P3 on RBridge 110 can be coupled to a device in customer C3's network at site S5. Note that the port numbers in FIG. 1 match the customer numbers, i.e., ports labeled P1 are associated with customer C1, ports labeled P3 are associated with customer C3, etc. This has been done for ease of discourse. In general, any port on any RBridge can potentially be assigned to one or more virtual networks that are associated with one or more customers.
A virtual local area network (VLAN) in a customer's network may span multiple customer sites. For example, VLANs 112 and 114 in customer C3's network include nodes in sites S1 and S5. Similarly, VLANs 116 and 118 in customer C1's network include nodes in sites S2 and S3, and VLAN 120 in customer C1's network includes nodes in sites S3 and S4.
Nodes that belong to the same VLAN, but which are located at different sites, can communicate with each other transparently through TRILL network 100. Specifically, the ingress RBridge can encapsulate a packet (e.g., an Ethernet packet with or without one or more VLAN tags) received from a customer and route the packet within TRILL network 100 using a TRILL header. The egress RBridge can then strip the TRILL header and send the original customer packet on the appropriate port. For example, packet 122 can originate in customer C3's network at site S1, and be received on port P3 of RBridge 102 with a VLAN tag associated with VLAN 112. Next, RBridge 102, which is the ingress RBridge for this packet, can encapsulate packet 122 by adding a TRILL header to obtain packet 124 (the TRILL header is the shaded portion in packet 124). Next, the TRILL header of packet 124 can be used to route packet 124 through TRILL network 100 until packet 124 reaches RBridge 110, which is the egress RBridge for the packet. RBridge 110 can then strip away the TRILL header on packet 124 to obtain the original packet 122, and send packet 122 on port P3 so that the packet can be delivered to the intended destination in VLAN 112 in customer C3's network at site S5. In FIG. 1, the packet that is received at the ingress RBridge and the packet that is sent from the egress RBridge are shown to be the same. However, these packets can be different. For example, if VLAN translation is being performed, then the packet that is received at the ingress RBridge and the packet that is sent from the egress RBridge can have different VLAN tags.
Details of the TRILL packet format and RBridge forwarding can be found in IETF draft “RBridges: Base Protocol Specification,” available at http://tools.ietf.org/html/draft-ietf-trill-rbridge-protocol-16, which is incorporated herein by reference.
Although some examples in this disclosure are presented in the context of a TRILL network that includes RBridges, the present invention is not limited to TRILL networks or RBridges. The terms “frame” or “packet” generally refer to a group of bits. The use of the term “frame” is not intended to limit the present invention to layer-2 networks. Similarly, the use of the term “packet” is not intended to limit the present invention to layer-3 networks. Unless otherwise stated, the terms “frame” or “packet” may be substituted with other terms that refer to a group of bits, such as “cell” or “datagram.”
Network Virtualization
Network virtualization enables a service provider to provision virtual networks (VNs) over a common network infrastructure. To a user on a VN it appears as if the traffic is being carried over a separate network that has been specifically built for the user. However, in reality, the traffic from multiple VNs may be carried over a common network infrastructure.
Network virtualization has many uses. For example, network virtualization can be used to create multiple, logically distinct networks on the same physical network to comply with government regulations. Other uses of network virtualization include, but are not limited to, partitioning network resources between different organizations in a company thereby reducing network costs and simplifying network management.
One approach for addressing the problem that is solved by network virtualization is to duplicate resources (e.g., routers, switches, etc.) in the network so that the resources can be provisioned on a per-customer basis. However, this approach is impractical because it is costly and it is not scalable.
Some embodiments of the present invention implement network virtualization and/or partitioning in the TRILL network by embedding a VPN identifier in a TRILL option field in the TRILL header. Specifically, the ingress RBridge can determine a VPN identifier for each packet it receives from a customer, and embed the VPN identifier in a TRILL option field in the TRILL header. Next, the VPN identifier can be used to support network virtualization and/or partitioning in the TRILL network. Specifically, once the VPN identifier is embedded into the TRILL header, RBridges in the TRILL network can use the VPN identifier to determine how to handle the packet.
In some embodiments, the system can use a service provider VLAN identifier to implement network virtualization and/or partitioning. Specifically, ingress RBridges can add appropriate S-tags to packets received from customers (note that the S-tag based approach may not work for incoming packets that already have an S-tag). Next, the S-tag can be used to implement virtualization and/or partitioning in the network.
Packet Format
FIG. 2 illustrates a portion of an Ethernet packet which includes a TRILL header in accordance with some embodiments of the present invention. The packet shown in FIG. 2 is for illustration purposes only, and is not intended to limit the present invention.
Packet 200 can include one or more of the following fields: outer MAC (medium access control) addresses 202, outer VLAN tag 204, TRILL header field 206, TRILL option field 208, inner MAC addresses 210, and inner VLAN tags 212. Typically, the packet is transmitted from top to bottom, i.e., the bits associated with outer MAC addresses 202 will appear on the transmission medium before the bits associated with outer VLAN tag 204 appear on the transmission medium, and so forth. The contents of these fields and their uses are discussed below.
Outer MAC addresses 202 can include outer destination MAC address 214 and outer source MAC address 216. These MAC addresses and outer VLAN tag 204 typically change at each TRILL hop as the packet traverses the service provider's network. Specifically, at each hop, outer source MAC address 216 is associated with the MAC address of the source node (e.g., RBridge) for that hop, outer destination MAC address 214 is associated with the MAC address of the destination node (e.g., RBridge) for that hop, and outer VLAN tag 204 is associated with the VLAN that includes the source node and the destination node for that hop.
Outer VLAN tag 204 can include Ethernet type field 218 and outer VLAN identifier 220. The value of Ethernet type field 218 can indicate that the next field is a VLAN identifier. VLAN identifier 220 can be used in the service provider's network to create multiple broadcast domains.
TRILL header field 206 can include Ethernet type field 222 and TRILL header 224. The value of Ethernet type field 222 can indicate that the next field is a TRILL header. TRILL header 224 can include information for routing the packet through a TRILL network that is embedded in the service provider's network. Specifically, as shown in FIG. 2, TRILL header 224 can include version field 246 which indicates the TRILL version, reserved field 248 which may be reserved for future use, multicast field 250 which indicates whether this packet is a multicast packet, TRILL option length 252 which indicates the length (in terms of 32-bit words) of any TRILL option field that follows the TRILL header, and hop count 254 which may be decremented at each RBridge as the packet traverses the service provider's network.
TRILL header 224 also includes egress RBridge nickname 256 and ingress RBridge nickname 258. Ingress RBridge nickname 258 corresponds to the ingress RBridge which receives the packet from the customer's network, and, for unicast packets, egress RBridge nickname 256 corresponds to the egress RBridge which sends the packet to the customer's network. For multicast packets, egress RBridge nickname 256 corresponds to the RBridge which is the root of the multicast tree on which the packet is to be forwarded. For example, in FIG. 1, when packet 122 is received at ingress RBridge 102, ingress RBridge 102 can use the header information in packet 122 to determine that packet 122 needs to be routed to egress RBridge 110. Next, ingress RBridge 102 can add TRILL header field 206 to packet 122 to obtain packet 124. Specifically, RBridge 102 can set ingress RBridge nickname 258 in packet 124's TRILL header to RBridge 102's nickname, and set egress RBridge nickname 256 in packet 124's TRILL header to RBridge 110's nickname. RBridge 102 can then forward packet 124 based solely or partly on packet 124's TRILL header.
TRILL option field 208 can include bit-encoded options and one or more options encoded in a TLV (type-length-value) format. Specifically, TRILL option field 208 can include bit-encoded options 260 which are one-bit option flags, and TLV-encoded option 226. For example, a 20-bit VPN identifier can be encoded as a TLV-encoded option. Specifically, the value of type field 262 can indicate that this option specifies a VPN identifier. Length field 264 can indicate the length of the data portion of the TLV-encoded option in octets. In the packet shown in FIG. 2, TLV-encoded option 226 is used for specifying a 20-bit VPN identifier, and length field 264 is set to the value 0×6. The data portion of TLV-encoded option 226 begins immediately after length field 264. Specifically, in the packet shown in FIG. 2, the total length (in octets) of fields 266, 268, and 228 is equal to 0×6 as specified by length field 264. Further, as shown in FIG. 2, the last 20 bits of the data portion in TLV-encoded option 226 can be used for specifying VPN identifier 228.
Note that a 20-bit VPN identifier can be specified using a smaller data portion, e.g., only 0×3 octets instead of 0×6 octets. However, some embodiments use the following non-obvious insight: it may be desirable to align the 20-bit VPN identifier with the word boundary to simplify chip design and/or to improve performance. Thus, in some embodiments, 0×6 octets are used instead of 0×3 octets so that the 20-bit VPN identifier is aligned with a 32-bit word boundary. For example, as shown in FIG. 2, VPN identifier 228 is aligned with the 32-bit word boundary.
Inner MAC addresses 210 can include inner source MAC address 232 and inner destination MAC address 230 Inner MAC addresses 210 can be the MAC addresses that were present in the header of the packet that was received from the customer's network. For example, in FIG. 1, suppose a source node in VLAN 112 in customer C3's network at site 51 sends a packet to a destination node in VLAN 112 in customer C3's network at site S5. In this scenario, inner source MAC address 232 can correspond to the source node at site S1, and inner destination MAC address 230 can correspond to the destination node at site S5.
Inner VLAN tags 212 can include one or more VLAN tags. For example, inner VLAN tags 212 can include an S-tag which includes Ethernet type field 234 and S-VLAN-identifier 236, a C-tag which includes Ethernet type field 238 and C-VLAN-identifier 240, and another tag which includes Ethernet type field 242 and VLAN identifier 244. Each VLAN tag in outer VLAN tag 204 and inner VLAN tags 212 can also include a three-bit Priority Code Point (PCP) field (also referred to as the “priority” or “priority bits” in this disclosure), e.g., PCP 270, and a one-bit CFI field, e.g., CFI 272. When an S-tag is used, the CFI field can carry a drop eligibility indicator (DEI) bit. The values in Ethernet type fields (e.g., 234, 238, and 242) can indicate the type of VLAN tag that follows. For example, Ethernet type field 234 and 238 can indicate a VLAN identifier for an S-tag and a VLAN identifier for the C-tag follow the respective Ethernet type fields. The S-tag and the C-tag can be used by the customer to create a stacked-VLAN architecture, e.g., as defined in the Provider Bridging standard. The S-tag may also be used by the service provider to implement network virtualization and/or partitioning. Packet 200 can also include other tags, each tag having a tag-type field which indicates the type of the tag, and a field that stores contents (e.g., an identifier) related to the tag. For example, packet 200 can include a 32-bit congestion-notification-tag (CN-tag) which includes a 16-bit tag-type field and a 16-bit flow-identifier. The congestion-notification-tag may be used by the customer to manage network congestion.
Note that a packet may or may not include all of the fields shown in FIG. 2. For example, in some embodiments, a packet may not include one or more of inner VLAN tags 212 and/or outer VLAN tag 204. Further, certain combinations of fields may not be allowed in some embodiments. For example, in some embodiments, a packet may include either an S-tag or a TRILL option field, but not both. Additionally, the values of some fields may be related to each other. For example, in some embodiments, S-VLAN-identifier 236 may be copied into the 12 least significant bits of VPNID 228.
VLAN tagging is specified in IEEE (Institute of Electrical and Electronics Engineers) standard IEEE 802.1Q. The earlier versions of the standard, including and up to IEEE 802.1Q-2005 of this standard describes how a single VLAN tag can be added to an Ethernet packet to create multiple broadcast domains within the same local area network (LAN). The term Provider Bridging refers to an amendment of this standard which allows an S-tag (a service VLAN tag is sometimes referred to as a provider tag) to be stacked in a single Ethernet packet. Provider Bridging enables a service provider to carry VLAN traffic from multiple customers on a shared network infrastructure without restricting the VLAN address space available to each customer. Further details on Provider Bridging can be found in the specification for standard IEEE 802.1ad.
In some embodiments, the system can add a TRILL header to a Provider Bridging packet. In these embodiments, the packet received from the customer network may include an S-tag. The service provider's network may then add a TRILL header to the packet. In some embodiments, the system may ensure that the priority bits in the outermost VLAN tag are the same as the priority bits in the S-tag.
Remote Port Mirroring
Service provider networks can be very large and complex. Not surprisingly, the network often needs to be debugged. Remote port mirroring is a technique that can be used to identify and resolve network problems.
FIG. 3 illustrates a conventional remote port mirroring system. Ethernet switches 302, 304, 306, 308, and 310 are part of a LAN (local area network). Source node 314 is coupled to Ethernet switch 302, and destination node 316 is coupled to Ethernet switch 308. Network analyzer 312 is coupled to Ethernet switch 310. Network analyzer 312 can be used to analyze packets in the network to identify and resolve problems. In remote port mirroring, copies of packets that are received on a port in the network are sent to a network analyzer.
For example, remote port mirroring can be performed on the port on Ethernet switch 302 which is coupled to source node 314. Suppose packet 318 with a VLAN identifier 322 is received from source 314 on Ethernet switch 302. Further, assume that packet 318 is destined for destination 316. Note that FIG. 3 is for illustration purposes only. The packet format shown in FIG. 3 is not intended to reflect the actual packet format. For example, an Ethernet packet includes source and destination MAC addresses, which have not been shown in FIG. 3 for the sake of clarity.
Ethernet switch 302 will forward the packet with the original VLAN identifier, i.e., VLAN identifier 322 to destination 316. For example, packet 318 may traverse Ethernet switches 302, 306, and 308, before being received at destination 316. In conventional approaches, a copy of packet 318 with a different VLAN identifier is also forwarded in the network for remote port mirroring purposes. Specifically, Ethernet switch 302 creates packet 320 with VLAN identifier 324, which is different from VLAN identifier 322. Ethernet switch 302 then forwards packet 320 to network analyzer 312. Packet 320 may traverse Ethernet switches 302 and 310 before being received at network analyzer 312.
Note that VLAN identifier 324 is used in the network to tag network analysis traffic. Replacing the original VLAN identifier with a VLAN identifier that is specifically used for network analysis traffic enables conventional networks to ensure that these packets are delivered to network analyzers.
Unfortunately, conventional port mirroring techniques may not be able to identify and/or resolve certain network problems. Specifically, since conventional networks modify the original VLAN identifier, the packet that is received at the network analyzer is not the original packet. If the original VLAN identifier was one of the causes of the network problem, the network analyzer will not be able to identify and/or resolve the network problem.
In contrast to conventional techniques, some embodiments of the present invention encapsulate the copy of the packet, and forward the encapsulated copy of the packet to a network analyzer. Since some embodiments of the present invention encapsulate the copy of the packet, they preserve the original VLAN identifier and optionally preserve other header information in the original packet.
Typically, when a packet is encapsulated to obtain an encapsulated packet, the entire contents of the packet are preserved. The encapsulated packet usually has its own header which is used for forwarding the encapsulated packet. According to one definition of encapsulation, encapsulation is a process which adds new fields to the packet header which are used for forwarding the encapsulated packet. For example, a packet can be encapsulated by adding a TRILL header to the packet which is then used for routing the packet through the network. Merely modifying the VLAN tag is not encapsulation because no new fields are added to the header, and because the original VLAN tag is not preserved.
FIG. 4A illustrates a remote port mirroring system which uses encapsulation in accordance with some embodiments of the present invention.
Suppose packet 406 with VLAN identifier 418 is sent from a source node in VLAN 112 in customer C3's network at site S1 to a destination node in VLAN 112 in customer C3's network at site S5.
When packet 406 is received on port P3 of RBridge 102, packet 406 can be encapsulated with TRILL header 410 to obtain encapsulated packet 408. Encapsulated packet 408 can then be routed through TRILL network 100 to RBridge 110. RBridge 110 can then extract packet 406 from encapsulated packet 408, and forward packet 406 to the destination node in VLAN 112 in customer C3's network at site S5. Note that, in the above example, packet 406 is an Ethernet packet (with or without one or more VLAN tags), and encapsulated packet 408 is a TRILL packet.
Some embodiments of the present invention can perform remote port mirroring at an arbitrary level of granularity, and can use arbitrarily complex criteria to determine which packets to mirror. Specifically, remote port mirroring can be enabled for packets that are received or sent on a particular port, that have a specific VLAN tag, that originate from a particular source node, that are destined for a particular destination node, or that match a combination of these criteria. In general, the system may use an arbitrarily complex logical function (e.g., an access control list) to identify packets that need to be mirrored.
Let us assume that remote port mirroring has been enabled on port P3 of RBridge 102, and packet 406 has been identified as a packet that needs to be mirrored. In this case, RBridge 102 can create a copy of packet 406, and encapsulate the copy of packet 406 using TRILL header 414 to obtain encapsulated packet 412. Encapsulated packet 412 can then be routed through TRILL network 100 to RBridge 106. Note that TRILL header 414 is different from TRILL header 410. Specifically, TRILL header 410 causes packet 408 to be routed to RBridge 110, whereas TRILL header 414 causes encapsulated packet 412 to be routed to RBridge 106. RBridge 106 can then extract the copy of packet 406 (shown as packet 416 in FIG. 4A) from encapsulated packet 412, and forward the copy of packet 406 to network analyzer 402 which may belong to VLAN 404. VLAN 404 may have been specifically created for analyzing network traffic. The packet that is sent to the network analyzer may include some indication that the packet is a mirrored packet. For example, if mirrored packets have a specific VLAN identifier (e.g., VLAN 404 as shown in FIG. 4A), then the VLAN identifier can be used to indicate that the packet is a mirrored packet.
Note that the VLAN identifier was not modified, i.e., the VLAN identifier in packet 416 is the same as the VLAN identifier in packet 406. In this manner, some embodiments of the present invention facilitate debugging the network by preserving VLAN identifier information during remote port mirroring.
Remote port mirroring can also be enabled on ports that are internal to the TRILL network. In these embodiments, an additional TRILL header can be added to preserve the original TRILL header.
FIG. 4B illustrates a remote port mirroring system which uses encapsulation in accordance with some embodiments of the present invention.
As before, RBridge 102 can encapsulate packet 406 with TRILL header 410 to obtain encapsulated packet 408. Encapsulated packet 408 can then be routed through TRILL network 100 to RBridge 110. RBridge 110 can then extract packet 406 from encapsulated packet 408, and forward packet 406 to the destination node in VLAN 112 in customer C3′s network at site S5.
Let us assume that remote port mirroring has been enabled on the port on RBridge 102 that couples RBridge 102 with RBridge 106, and packet 408 has been identified as a packet that needs to be mirrored. In this case, RBridge 102 can create a copy of packet 408 and encapsulate the copy of packet 408 using TRILL header 422 to obtain encapsulated packet 420. Next, encapsulated packet 420 can be routed through TRILL network 100 to RBridge 106. Note that TRILL header 422 is different from TRILL header 410. Specifically, TRILL header 410 causes packet 408 to be routed to RBridge 110, whereas TRILL header 422 causes encapsulated packet 420 to be routed to RBridge 106. RBridge 106 can then extract the copy of packet 408 (shown as packet 424 in FIG. 4B) from encapsulated packet 420, and forward the copy of packet 408 to network analyzer 402 which may belong to VLAN 404. Note that, in the above example, encapsulated packets 408 and 420 are TRILL packets.
FIG. 5 illustrates a switch in accordance with some embodiments of the present invention.
Switch 500 can include a plurality of mechanisms which may communicate with one another via a communication channel, e.g., a bus. Switch 500 may be realized using one or more integrated circuits. In some embodiments, switch 500 is an RBridge (e.g., RBridge 102) which includes copying mechanism 502, encapsulation mechanism 504, and forwarding mechanism 506.
Switch 500 may receive a packet which may be destined for destination address D1 (e.g., the header information of the packet may include destination address D1). Copying mechanism 502 may be configured to create a copy of the packet. In some embodiments, copying mechanism 502 may be configured to first identify which packets need to be mirrored, and then create copies of the identified packets. The packet that is being mirrored can be an Ethernet packet (with or without one or more VLAN tags) or a TRILL packet.
Encapsulation mechanism 504 may be configured to encapsulate the copy of the packet to obtain an encapsulated packet which is destined for destination address D2 (e.g., the header information of the encapsulated packet may include destination address D2). In some embodiments, the encapsulated packet is a TRILL packet. Destination address D2 may or may not be the same as destination address D1. A destination address can be a unicast, a multicast, or a broadcast address. Specifically, in some embodiments, the first packet is either a unicast packet or a multicast packet, and the second packet is either a unicast packet that is sent to a network analyzer or a multicast packet which is sent to a multicast address which is associated with a multicast group that includes the network analyzer. Note that encapsulating the copy of the packet to obtain an encapsulated packet preserves header information of the original packet (e.g., VLAN identifier, TRILL header, etc.).
Forwarding mechanism 506 may be configured to forward the original packet according to address D1, and forward the encapsulated packet according to address D2. For example, forwarding mechanism 506 may first perform a forwarding lookup (e.g., by performing a lookup in a ternary context addressable memory) for addresses D1 and D2 to determine the output ports for the two packets. Next, forwarding mechanism 506 may queue the packets to be sent through the appropriate output ports.
Note that FIG. 5 is for illustration purposes only, and is not intended to limit the present invention to the forms disclosed. Specifically, in some embodiments, switch 500 may not be an RBridge, and/or may include fewer or more mechanisms than those shown in FIG. 5.
FIG. 6 presents a flowchart that illustrates a process for performing remote port mirroring in accordance with some embodiments of the present invention.
The process can be performed by a switch, e.g., RBridge 102. The switch may receive a first packet, e.g., packet 406. The switch may then determine whether the first packet is to be mirrored. If the first packet is to be mirrored, the switch may create a copy of the first packet.
Next, the switch may encapsulate the copy of the first packet in a second packet, e.g., packet 412 (operation 602). Note that the first packet and second packet may be destined for different addresses. The first packet and the second packet can be unicast, multicast, or broadcast packets. Specifically, in some embodiments, the first packet is either a unicast packet or a multicast packet, and the second packet is either a unicast packet that is sent to a network analyzer or a multicast packet which is sent to a multicast address which is associated with a multicast group that includes the network analyzer.
The switch can then forward the first packet using header information of the first packet (operation 604), and forward the second packet using the header information of the second packet (operation 606). Note that operations 604 and 606 may be performed sequentially (in any order) or concurrently.
FIG. 7 illustrates a system in accordance with some embodiments of the present invention.
System 700 can include processor 702 (e.g., a network processor) and memory 704. Processor 702 may be capable of accessing and executing instructions stored in memory 704. For example, processor 702 and memory 704 may be coupled by a bus. Memory 704 may store instructions that when executed by processor 702 cause system 700 to perform the process illustrated in FIG. 6. Specifically, in some embodiments, memory 704 may store instructions for encapsulating a copy of a first packet in a second packet, instructions for forwarding the first packet using header information of the first packet, and instructions for forwarding the second packet using header information of the second packet.
The data structures and code described in this disclosure can be partially or fully stored on a non-transitory computer-readable storage medium and/or a hardware module and/or a hardware apparatus. A computer-readable storage medium includes, but is not limited to, volatile memory, non-volatile memory, magnetic and optical storage devices such as disk drives, magnetic tape, CDs (compact discs), DVDs (digital versatile discs or digital video discs), or other media, now known or later developed, that are capable of storing code and/or data. Hardware modules or apparatuses described in this disclosure include, but are not limited to, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), dedicated or shared processors, and/or other hardware modules or apparatuses now known or later developed. Specifically, the methods and/or processes may be described in a hardware description language (HDL) which may be compiled to synthesize register transfer logic (RTL) circuitry which can perform the methods and/or processes.
The methods and processes described in this disclosure can be partially or fully embodied as code and/or data stored in a computer-readable storage medium or device, so that when a computer system reads and/or executes the code and/or data, the computer system performs the associated methods and processes. The methods and processes can also be partially or fully embodied in hardware modules or apparatuses, so that when the hardware modules or apparatuses are activated, they perform the associated methods and processes. Further, the methods and processes can be embodied using a combination of code, data, and hardware modules or apparatuses.
The foregoing descriptions of embodiments of the present invention have been presented only for purposes of illustration and description. They are not intended to be exhaustive or to limit the present invention to the forms disclosed. Accordingly, many modifications and variations will be apparent to practitioners having ordinary skill in the art. Additionally, the above disclosure is not intended to limit the present invention. The scope of the present invention is defined by the appended claims.

## Claims

1. A switch, comprising:
encapsulation circuitry configured to encapsulate a first packet in a second packet and a copy of the first packet in a third packet, wherein the second packet and the third packet are based on a same encapsulation protocol; and
forwarding circuitry configured to:
determine an output port for the second packet using header information of the second packet, wherein destination information of the second packet corresponds to destination information of the first packet, and
determine an output port for the third packet using header information of the third packet, wherein destination information of the third packet is based on port mirroring.

2. The switch of claim 1, wherein the second packet is a unicast packet.

3. The switch of claim 2, wherein the third packet is a multicast packet.

4. The switch of claim 1, wherein the encapsulation protocol is TRILL (Transparent Interconnection of Lots of Links) protocol.

5. The switch of claim 1, wherein while encapsulating the first packet in the second packet and the copy of the first packet in the third packet, the encapsulation circuitry is configured to preserve header information of the first packet and the copy of the first packet.

6. The switch of claim 5, wherein the header information of the first packet includes a VLAN (Virtual Local Area Network) identifier.

7. The switch of claim 1, wherein the encapsulation circuitry is further configured to encapsulate a copy of the second packet in a fourth packet, wherein the second packet and the fourth packet are based on the same encapsulation protocol.

8. A system, comprising:
a processor; and
a memory storing instructions that when executed by the processor cause the system to perform a method, the method comprising:
encapsulating of a first packet in a second packet and a copy of the first packet in a third packet, wherein the second packet and the third packet are based on a same encapsulation protocol;
determining an output port for the second packet using header information of the second packet, wherein destination information of the second packet corresponds to destination information of the first packet, and
determining an output port for the third packet using header information of the third packet, wherein destination information of the third packet is based on port mirroring.

9. The system of claim 8, wherein the second packet is a unicast packet.

10. The system of claim 9, wherein the third packet is a multicast packet.

11. The system of claim 8, wherein the encapsulation protocol is TRILL (Transparent Interconnection of Lots of Links) protocol.

12. The system of claim 8, wherein encapsulating the first packet in the second packet and the copy of the first packet in the third packet, comprises preserving header information of the first packet.

13. The system of claim 12, wherein the header information of the first packet includes a VLAN (Virtual Local Area Network) identifier.

14. The system of claim 8, wherein the method further comprises encapsulating a copy of the second packet in a fourth packet, wherein the second packet and the fourth packet are based on the same encapsulation protocol.

15. A network, comprising:
a first source switch, a first destination switch, and a second destination switch;
wherein the first source switch is configured to:
encapsulate a first packet in a second packet and a copy of the first packet in a third packet, wherein the second packet and the third packet are based on a same encapsulation protocol
determine an output port corresponding to the first destination switch for the second packet, wherein destination information of the second packet corresponds to destination information of the first packet, and
determine an output port for corresponding to the second destination switch for the third packet, wherein destination information of the third packet is based on port mirroring; and

wherein the second destination switch is configured to:
identify the -third packet,
extract the copy of the first packet from the third packet, and
determine an output port which is coupled to a network analyzer for the copy of the first packet.

16. The network of claim 15, wherein the second packet is a unicast packet.

17. The network of claim 16, wherein the destination information of the third packet includes a multicast address associated with a multicast group that includes the network analyzer.

18. The network of claim 15, wherein the encapsulation protocol is TRILL (Transparent Interconnection of Lots of Links) protocol.

19. The network of claim 15, wherein while encapsulating the first packet in the second packet and the copy of the first packet in the third packet, the first source switch is configured to preserve header information of the first packet.

20. The network of claim 19, wherein the header information of the first packet includes a VLAN (Virtual Local Area Network) identifier.

21. The network of claim 15, wherein the first source switch is further configured to encapsulate a copy of the first packet in a fourth packet, wherein the second packet and the fourth packet are based on the same encapsulation protocol.

22. A method, comprising:
encapsulating a first packet in a second packet and a copy of the first packet in a third packet, wherein the second packet and the third packet are based on a same encapsulation protocol;
determining an output port for the second packet using header information of the second packet, wherein destination information of the second packet corresponds to destination information of the first packet; and
determining an output port for the third packet using header information of the third packet, wherein destination information of the third packet is based on port mirroring.

23. The method of claim 22, wherein the second packet is a unicast packet.

24. The method of claim 23, wherein the third packet is a multicast packet.

25. The method of claim 22, wherein encapsulation protocol is TRILL (Transparent Interconnection of Lots of Links) protocol.

26. The method of claim 22, wherein encapsulating the first packet in the second packet and the copy of the first packet in the third packet comprises preserving header information of the first packet.

27. The method of claim 26, wherein the header information of the first packet includes a VLAN (Virtual Local Area Network) identifier.

28. The method of claim 22, further comprising encapsulating a copy of the second packet in a fourth packet, wherein the second packet and the fourth packet are based on the same encapsulation protocol.