Detailed Description
Please refer to fig. 1, which is a schematic diagram of a network topology scenario, wherein S1, S2, S3, S4 and S5 are edge devices in a switching network, taking STP (Spanning Tree Protocol) as an example, the switching network in which S1, S2 and S3 are located runs STP, the network in which S4 and S5 are located does not run STP, in order to enable transparent transmission of Protocol packets between S1 and S2, i.e. the Protocol packets of the network in which S1, S2 and S3 are located are required to pass through the networks in which S4 and S5 are located, since an STP Protocol packet is a du bpprotocol packet, a BPDU Tunnel needs to be configured between S4 and S5 to implement a transparent transmission function, so that when S4 receives a Protocol packet sent by S1, a MAC address of the STP Protocol is converted, a destination MAC packet of the STP Protocol is returned to a destination MAC packet of the STP 56 in the form of the MAC packet of the STP, the MAC address of the STP 8653 and the MAC packet of the S828653, and finally to S2. After the network topology in fig. 1 is stable, if the interface of S2 connection S5 is blocked and the interface of S3 connection S2 is blocked, the data packet traffic from terminal 1 to terminal 2 is specifically: terminal 1- > S4- > S1- > S2- > terminal 2.
However, if the topology of the network where S1, S2, and S3 are located changes and is renegotiated by STP, the interface of S2 connected to S1 is blocked, and the interface of S2 connected to S5 is restored to a normal state, as shown in fig. 2, at this time, since the network where S4 and S5 are located does not run STP, the topology change of the network cannot be sensed, the forwarding direction of the data packet from the terminal 1 to the terminal 2 on S4 is still S4 to S1, and since the interface of S2 connected to S1 is blocked, the data packet traffic is not passed through, and finally the data packet is lost. For the above scenario, in order to avoid the problem of data packet loss caused by the change of the topology structure of the network, the following describes the embodiments of the present application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Example one
Please refer to fig. 3, which is a flowchart illustrating a method for sending a data packet according to an embodiment of the present invention, the method includes the following steps:
step 301: when receiving a BPDU protocol message, judging whether the received BPDU protocol message is a message related to the change of the topological structure of the network.
Wherein the determining whether the received BPDU protocol packet is a packet related to a topology change of a network includes: judging whether each received BPDU protocol message is a message related to the change of the topological structure of the network; or judging whether the received BPDU protocol message is a message related to the change of the topological structure of the network within a specific time.
For example, taking the topology shown in fig. 1 as an example, each time the edge device S4 or S5 at both ends of the BPDU Tunnel receives a BPDU protocol packet, it is determined whether the BPDU protocol packet is a packet related to a topology change of the network in which S1, S2, and S3 are located. Alternatively, in order to save consumption, the network device S4 or S5 may determine whether the BPDU protocol packet received within a specific time is a packet related to a topology change of the network in which S1, S2, and S3 are located, for example, a timer may be set, and determine whether the BPDU protocol packet received within the timer time is a packet related to a topology change of the network in which S1, S2, and S3 are located, or the network device S4 or S5 may buffer the BPDU protocol packet received within the timer time, and when the timer times out, the edge device S4 or S5 may determine whether the BPDU protocol packet received within the timer time that is buffered is a packet related to a topology change of the network in which S1, S2, and S3 are located.
When the S4 or S5 determines whether the received BPDU protocol packet is a packet related to a topology change of the network in which S1, S2, and S3 are located, the method includes: when the BPDU Protocol message is an analysis Spanning Tree Protocol (STP) message, analyzing the STP message to obtain a message header of the STP message; judging whether the BPDU protocol message is a message related to the topology structure change of the network in which the S1, S2 and S3 are positioned according to the TC zone bit or the message type identification read from the message header of the STP message; or analyzing the BPDU protocol message to obtain a message header of the BPDU protocol message; and judging whether the BPDU protocol message is a message related to the change of the topological structure of the network in which the S1, the S2 and the S3 are positioned according to a flush domain read from a message header of the BPDU protocol message.
For example, once the network structure of the topological network is changed, as shown in fig. 1, when the interface of S2 connected to S5 is blocked and the interface of S3 connected to S2 is blocked, the system may transmit a TC message, a TCN message, or a flush message in the topological network to indicate that the topological structure of the network is changed, where a TC flag bit is set in a header of an STP message, if the TC flag bit is set to 1, it indicates that the STP message is a TC message, i.e., the BPDU protocol message is a TC message related to the topological structure change of the network in which S1, S2, and S3 are located, and if the TC flag bit is set to 0, it indicates that the STP message is not a TC message, i.e., the BPDU protocol message is not a message related to the topological structure change of the network in which S1, S2, and S3 are located.
Similarly, a message type identifier is set in a message header of the STP message, if the message type identifier is set to 1, that is, the STP message is a TCN message, that is, the BPDU protocol message is a TCN message related to a change in the topology of the network in which S1, S2, and S3 is located, otherwise, that the STP message is not a TCN message, that is, the BPDU protocol message is not a message related to a change in the topology of the network in which S1, S2, and S3 are located.
Similarly, a flush field is extended in the header of the BPDU protocol message, if the flush field is set to 1, it indicates that the BPDU protocol message is a flush message, and if the flush field is set to 0, it indicates that the BPDU protocol message is not a flush message.
Step 302: and if the received BPDU protocol message is a message related to the change of the network topology structure, sending the received data message to the edge device of the opposite end in a broadcasting way.
Wherein, the sending the received data message to the edge device of the opposite end in a broadcast manner includes: and deleting the MAC address table entry related to the interface according to the interface for receiving the message related to the change of the topological structure of the network where the edge device is located, so that the edge devices at two ends of the BPDU Tunnel send the data message to the edge device at the opposite end in a broadcasting manner.
In the two-layer switching technology, generally, an edge device belongs to a data link layer device, and establishes a correspondence between an MAC address and an interface corresponding to the MAC address, and records the correspondence as an entry in an address table in the edge device. In this embodiment, taking the BPDU protocol packet as an STP packet as an example, when the edge device S4 determines that the protocol packets received from S1 and S5 are TC packets or TCN packets, the MAC address table entries related to the interface connected to S1 and the interface connected to S5 may be deleted from the address table maintained by the edge device S4, or the entire address table of the edge device S4 may be deleted, and at this time, the MAC address table entries related to the interface connected to S1 and the interface connected to S5 are correspondingly deleted.
In general, in the three-layer switching technology, the "address resolution" is a process of converting a destination IP address into a destination MAC address before sending a message. The basic function of ARP is to establish a correspondence between an IP address, an MAC address, and a corresponding outgoing interface, record the correspondence as an entry in an ARP cache table, and query the corresponding destination MAC address and the corresponding interface through the destination IP address in the data packet. When the edge device S4 determines that the protocol packet received from S1 and S5 is a flush packet, it may delete the ARP entry associated with the interface connected to S1 and the interface connected to S5 from the ARP cache table maintained by the edge device itself, or delete the entire ARP cache table, and at this time, the ARP entry associated with the interface connected to S1 and the interface connected to S5 is correspondingly deleted.
Take an example where edge device a (192.168.1.5) sends a data message to edge device B (192.168.1.1). When sending data message, edge device a will look for whether there is destination IP address of edge device B in its ARP cache table. If yes, the destination MAC address of the edge device B is known, and the destination MAC address is directly written into the message and sent; if the corresponding destination IP address is not found in the ARP cache table, the edge device a will send a broadcast on the network, and the destination MAC address is "ff.
It should be noted that the above-mentioned "edge device at the opposite end" refers to all edge devices having a connection relationship with one edge device, for example, taking the edge device S4 in fig. 1 as an example, the edge devices having a connection relationship with the edge device S4 are S1 and S5, the edge devices at the opposite end of the edge device S4 are S1 and S5, and the S4 sends the received data packet to S1 and S5 in a broadcast manner.
It should also be noted that the edge device may include a switch, router, routing switch, IAD, MAN or WAN device installed on the edge network, and is responsible for packet transmission between the access device and the core/backbone network device. An edge device is a physical device that applies data link layer (second layer) and network layer (third layer) technologies.
And when the received BPDU protocol message is not a message related to the change of the topological structure of the network, sending the received data message to the edge equipment indicated by the destination address.
For example, still taking fig. 1 as an example, when the edge device S4 determines that the received BPDU protocol packet is not a packet related to the topology change of the network in which S1, S2, and S3 are located, that is, the edge device S4 does not receive a packet related to the topology change of the network in which S1, S2, and S3 are located, indicating that the network structure of the topology network has not changed, at this time, the data packet is still sent to the edge device indicated by the destination address.
It can be understood by those skilled in the art that after the step 302, normal MAC address learning or ARP resolution may be further included, and after the MAC address learning or ARP resolution, a new data packet forwarding path is established, and the received data packet is sent to the edge device indicated by the target address, and is not sent to the edge device of the opposite end in a broadcast manner any more.
It can be seen from the above embodiments that edge devices at both ends of a bridge protocol data unit Tunnel BPDU Tunnel analyze received BPDU protocol messages, and when it is determined that the BPDU protocol messages are not messages related to changes in the topology structure of the network, send the data messages to the edge device indicated by the MAC address; when the BPDU protocol message is judged to be a topology change TC message or a refresh flush message, the topology network structure is changed, at the moment, the received data message is sent to the edge device of the opposite end in a broadcasting mode, which is equivalent to enlarging the sending path of the data message, and when the network topology changes, the problem of data message loss caused by the topology change of the network can be avoided.
Example two
Please refer to fig. 4 in conjunction with the topology network structure diagram shown in fig. 1, which is a flowchart of another embodiment of a method for sending a data packet according to the present invention, including the following steps:
step 401: the method comprises the steps that edge devices S4 at two ends of a bridge protocol data unit Tunnel (BPDU) Tunnel receive BPDU protocol messages;
step 402: the edge device S4 determines whether the received BPDU protocol message is a TC message, a TCN message, or a flush message, if so, step 403 is performed, and if not, step 405 is performed;
the edge device S4 may determine, every time a BPDU protocol message is received, whether the BPDU protocol message is a TC message, a TCN message, or a flush message, or may start a timer to determine whether the BPDU protocol message received within a timing time of the timer is a TC message, a TCN message, or a flush message.
For the determination of the TC packet, specifically, the STP packet is analyzed to obtain a packet header of the STP packet, a TC flag bit is read from the packet header of the STP packet, and it is determined whether the TC flag bit is set to 1, if so, the STP packet is the TC packet.
For the determination of the TCN packet, specifically, the STP packet is analyzed to obtain a packet header of the STP packet; reading a message type identifier from a message header of the STP message, and judging whether the message type identifier is set to be 1 or not, wherein if the message type identifier is set to be 1, the STP message is a TCN message.
The judgment of the flush message may specifically be that the BPDU protocol message is analyzed to obtain a message header of the BPDU protocol message, a flush domain is read from the message header of the BPDU protocol message, and whether the flush domain is set to 1 is judged, if so, the BPDU protocol message is the flush message.
Step 403: according to the interface for receiving the TC message, the TCN message or the flush message, the edge device S4 deletes the MAC address table item related to the interface;
in the two-layer switching network, the edge device S4 deletes the MAC address table entry related to the interface between S4 and S1 from the address table if the BPDU protocol packet received from S1 is a TC packet.
Step 404: when the edge device S4 receives the data packet, it sends the data packet to the edge device of the opposite end in a broadcast manner;
for example, when the edge device S4 determines that the BPDU protocol packet received by itself is a TC packet, it sends the received data packet to the edge devices S1 and S5 of the opposite end in a broadcast manner.
If the interface of S2 connection S5 is blocked and the interface of S3 connection S2 is blocked, as shown in fig. 2, the data packet traffic from terminal 1 to terminal 2 is specifically: terminal 1- > S4- > S1- > S2- > terminal 2. If the network topology of S1, S2, and S3 changes and is renegotiated by STP, the interface of S2 to S1 is blocked, and the interface of S2 to S5 is restored to a normal state, as shown in fig. 3, since S4 can receive a TC message, a TCN message, or a flush message when the STP renegotiates, the data message is simultaneously sent to S1 and S5 in a broadcast manner, and since the interface of S1 is blocked by S2, the data message on the path is lost, and the data message flowing through terminal 1- > S4- > S5- > S2- > terminal 2 is normally sent, so that the data message is not lost after the topology network changes.
Step 405: when the edge device S4 does not receive the TC message, the TCN message, or the flush message, the edge device S4 sends the data message to the edge device indicated by the destination address.
In addition, after the edge device S4 deletes the MAC address table entry related to the interface between S1, if a data packet, such as the data packet sent by the terminal 2, is received from S5, a new MAC address table entry is created in the address table based on the MAC address learning mechanism according to the source MAC address of the data packet, such as the MAC address of the terminal 2 and the incoming interface of the data packet. After the MAC address learning, when receiving the data packet sent to the terminal 2 again, the edge device S4 searches the address table, finds the MAC address table entry corresponding to the terminal 2, and sends the data packet to the terminal 2 according to the interface in the MAC address table entry.
It can be seen from the above embodiments that edge devices at both ends of a bridge protocol data unit Tunnel BPDU Tunnel analyze received BPDU protocol messages, and when it is determined that the BPDU protocol messages are not messages related to changes in the topology structure of the network, send the data messages to the edge device indicated by the MAC address; when the BPDU protocol message is judged to be a message related to the change of the topological structure of the network, the change of the topological network structure is indicated, at the moment, each received data message is sent to the edge device of the opposite end in a broadcasting mode, which is equivalent to the expansion of a sending path of the data message, and when the network topology changes, the problem of data message loss caused by the change of the network topology can be avoided.
EXAMPLE III
Corresponding to the above method for sending the data message, the embodiment of the invention also provides an edge device. Please refer to fig. 5, which is a block diagram illustrating an embodiment of an edge device according to the present invention, the edge device includes a determining unit 501 and a sending unit 502. The internal structure and connection relationship of the device will be further described below in conjunction with the working principle of the device.
A determining unit 501, configured to determine, when receiving a BPDU protocol packet, whether the received BPDU protocol packet is a packet related to a topology change of a network;
a sending unit 502, configured to send the received data packet to an edge device of an opposite end in a broadcast manner when the BPDU protocol packet is a packet related to a topology change of a network.
The aforementioned judging unit 501 may include: a first parsing subunit 5011 and a first reading subunit 5012,
the first parsing subunit 5011 is configured to parse a spanning tree protocol STP packet to obtain a packet header of the STP packet;
the first reading subunit 5012 is configured to determine, according to the TC flag bit or the packet type identifier read from the packet header of the STP packet, whether the BPDU protocol packet is a packet related to a network topology change.
Alternatively, the above-mentioned judgment 501 may further include: a second parsing subunit and a second reading subunit,
the second analysis subunit is configured to analyze the BPDU protocol packet to obtain a packet header of the BPDU protocol packet;
and the second reading subunit is used for judging whether the BPDU protocol message is a message related to the change of the network topology structure according to the flush domain read from the message header of the BPDU protocol message. It should be noted that the edge device includes: a switch, router, routing switch, IAD, MAN, or WAN device.
It can be seen from the above embodiments that edge devices at both ends of a bridge protocol data unit Tunnel BPDU Tunnel analyze received BPDU protocol messages, and when it is determined that the BPDU protocol messages are not messages related to changes in the topology structure of the network, send the data messages to the edge device indicated by the MAC address; when the BPDU protocol message is judged to be a message related to the change of the topological structure of the network, the change of the topological network structure is indicated, at the moment, each received data message is sent to the edge device of the opposite end in a broadcasting mode, which is equivalent to the expansion of a sending path of the data message, and when the network topology changes, the problem of data message loss caused by the change of the network topology can be avoided.
Example four
The embodiment of the invention also provides a system for sending the data message. Please refer to fig. 6, which is a block diagram of a system for sending data packets according to an embodiment of the present invention, the system includes: the edge devices 601 and 602 at both ends of the BPDU Tunnel form a topology, wherein,
the edge devices 601 at two ends of the BPDU Tunnel are configured to, when receiving a BPDU protocol packet, determine whether the received BPDU protocol packet is a packet related to a topology change of a network in which the edge device is located, send the received data packet to an edge device at an opposite end in a broadcast manner when the BPDU protocol packet is a packet related to a topology change of a network in which the edge device is located, and send the received data packet to the edge device indicated by a destination address when the BPDU protocol packet is not a packet related to a topology change of a network in which the edge device is located;
the edge device 602, which forms a topology with edge devices at two ends of the BPDU Tunnel, is configured to receive the BPDU protocol packet forwarded by the edge devices at two ends of the BPDU Tunnel, and operate the received BPDU protocol packet.
Wherein, the edge device 601 at both ends of the BPDU Tunnel includes:
a determining unit 6011, configured to, when receiving the BPDU protocol packet, determine whether the received BPDU protocol packet is a packet related to a topology change of a network;
a sending unit 6012, configured to send the received data packet to an edge device of an opposite end in a broadcast manner when the BPDU protocol packet is a packet related to a topology change of a network.
It can be seen from the above embodiments that edge devices at both ends of a bridge protocol data unit Tunnel BPDU Tunnel analyze received BPDU protocol messages, and when it is determined that the BPDU protocol messages are not messages related to changes in the topology structure of the network, send the data messages to the edge device indicated by the MAC address; when the BPDU protocol message is judged to be a message related to the change of the topological structure of the network, the change of the topological network structure is indicated, at the moment, each received data message is sent to the edge device of the opposite end in a broadcasting mode, which is equivalent to the expansion of a sending path of the data message, and when the network topology changes, the problem of data message loss caused by the change of the network topology can be avoided.
It should be noted that, as will be understood by those skilled in the art, all or part of the processes in the methods of the above embodiments may be implemented by a computer program, which may be stored in a computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The method, system and edge device for sending a data packet provided by the present invention are described in detail above, and a specific embodiment is applied in this document to explain the principle and implementation of the present invention, and the description of the above embodiment is only used to help understand the method and core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.