Virtual link network traffic statistics method, device, electronic device and storage medium

By introducing the concept of virtual links into network traffic statistics and using link IDs and virtual link IDs to mark data packets, the problems of coarse statistical granularity and complex configuration in the existing technology are solved, and an efficient and easy implementation is achieved. Network traffic statistics used.

CN118972291BActive Publication Date: 2025-01-21WUHAN SIPU TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411441317.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-01-21
Estimated Expiration
2044-10-16

AI Technical Summary

Technical Problem

The existing network traffic statistics methods are based on physical interfaces or sub-interfaces, with coarse statistical granularity and complex configurations, which are not conducive to lightness and speed.

Method used

By creating links based on physical interfaces and assigning link IDs, creating virtual links under each link based on traffic characteristics and assigning virtual link IDs, and using the link ID and virtual link ID to ID mark data packets. Implement fine-grained network traffic statistics.

Benefits of technology

It achieves fine-grained traffic statistics, simplifies configuration, reduces the complexity of user operations, and improves statistical efficiency and ease of use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972291B_ABST
    Figure CN118972291B_ABST
Patent Text Reader

Abstract

The present invention provides a virtual link network traffic statistics method, device, electronic device and storage medium, belonging to the technical field of network traffic statistics, and the method includes: creating a plurality of links based on a physical interface, and assigning a link ID to each link; creating at least one virtual link under each link based on traffic characteristics, and assigning a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to the network traffic statistics requirements; and marking the data message with an ID based on the link ID and the virtual link ID to count the network traffic. The present invention adds a logical level called "virtual link" on the basis of the conventional physical port, and classifies the traffic statistics more finely based on the traffic statistics requirements of the user, and is simple to configure and easy to expand. Compared with the prior art, it reduces the configuration difficulty and improves the statistical efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network traffic statistics, and in particular to a virtual link network traffic statistics method, device, electronic equipment and computer-readable storage medium. Background Art

[0002] Current network traffic products generally use physical interfaces or sub-interfaces as basic units to count network traffic. However, this method of traffic statistics is inadequate in terms of statistical structure, statistical dimension, statistical efficiency, and statistical standardization. In other words, the basic units designed based on physical interfaces or sub-interfaces have a relatively coarse granularity when calculating traffic statistics.

[0003] Of course, many products now also provide more fine-grained statistical functions, such as by optimizing the format of data packets, the port of traffic statistics, or the user interface. However, these methods require the configuration of relatively cumbersome rules, which is inconvenient for users or traffic statistics personnel and is not conducive to the portability and speed of network traffic statistics.

[0004] Therefore, it is necessary to improve the existing network traffic statistics method. Summary of the invention

[0005] In view of this, it is necessary to provide a virtual link network traffic statistics method, device, electronic device and storage medium, which can achieve fine traffic statistics granularity while being simple to configure, easy to expand and convenient to operate.

[0006] In a first aspect, in order to achieve the above-mentioned object, the present invention provides a virtual link network traffic statistics method, comprising:

[0007] Create several links based on the physical interface and assign a link ID to each link;

[0008] Creating at least one virtual link under each link based on traffic characteristics, and assigning a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements;

[0009] The data message is ID-tagged based on the link ID and the virtual link ID to count the network traffic.

[0010] In a possible implementation, each link is bound to one or more physical interfaces. When network traffic passes through the bound one or more physical interfaces, the network traffic is marked with the link ID of the link corresponding to the one or more physical interfaces as the first identifier.

[0011] In a possible implementation, the traffic characteristics include a traffic label and a traffic range, and the traffic label includes at least one of the following items: vlan, vxlan, mpls label, IP network segment and MAC address; the traffic range is the port range corresponding to the traffic label.

[0012] In a possible implementation, at least one virtual link is created under each link based on traffic characteristics, and a virtual link ID is assigned to each virtual link, including:

[0013] Obtaining a flow label and a flow range, and creating at least one virtual link corresponding to the flow label and the flow range under each link;

[0014] A unique virtual link ID is assigned to each virtual link.

[0015] In a possible implementation, when the network traffic meets the traffic label and traffic range corresponding to the virtual link, the network traffic is marked with a link ID corresponding to the virtual link as the second identifier.

[0016] In a possible implementation, performing ID marking on a data message based on the link ID and the virtual link ID to count network traffic includes:

[0017] When the network traffic passes through the link and the virtual link successively, the data message is marked with an ID by the link ID and the virtual link ID respectively, and stored as traffic two-dimensional data;

[0018] All the two-dimensional traffic data are traversed, statistics are collected on the two-dimensional traffic data, and the data are output in the form of logs or reports in real time.

[0019] In a possible implementation, the two-dimensional traffic data is a two-dimensional array, and the link ID and the virtual link ID are used as subscripts of two dimensions respectively, and the two-dimensional array is accumulated in a cumulative form.

[0020] In a second aspect, the present invention further provides a virtual link network traffic statistics device, comprising:

[0021] A link creation module is used to create several links based on the physical interface and assign a link ID to each link;

[0022] A virtual link creation module, used to create at least one virtual link under each link based on traffic characteristics, and to assign a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements;

[0023] The traffic statistics module is used to perform ID marking on data messages based on the link ID and the virtual link ID to count network traffic.

[0024] In a third aspect, the present invention further provides an electronic device, including a memory and a processor, wherein:

[0025] The memory is used to store programs;

[0026] The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the virtual link network traffic statistics method described in any one of the possible implementation modes.

[0027] In a fourth aspect, the present invention also provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps in the virtual link network traffic statistics method described in any one of the above possible implementation methods are implemented.

[0028] The beneficial effects of the present invention are as follows: the present invention first creates a plurality of links based on a physical interface, and allocates a link ID to each link to realize the first marking of flow statistics; secondly, based on flow characteristics, at least one virtual link is created under each link, and a virtual link ID is allocated to each virtual link to realize the second marking of flow statistics; finally, based on the link ID and the virtual link ID, data packets are ID-marked to count network flow, that is, flow statistics are performed on data packets that need to be counted by marking twice, which is convenient and quick.

[0029] The present invention adds a logical layer called "virtual link" on the basis of the conventional physical port, and classifies the traffic statistics in more detail based on the user's traffic statistics needs. It is simple to configure and easy to expand. Compared with the existing technology, it reduces the configuration difficulty and improves the statistical efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0031] Figure 1 A schematic flow chart of an embodiment of a method for counting virtual link network traffic provided by the present invention;

[0032] Figure 2 A schematic flow chart of another embodiment of the virtual link network traffic statistics method provided by the present invention;

[0033] Figure 3A schematic diagram of the structure of an embodiment of a virtual link network traffic statistics device provided by the present invention;

[0034] Figure 4 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0035] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0036] It should be understood that the schematic drawings are not drawn to scale. The flowchart used in the present invention shows the operations implemented according to some embodiments of the present invention. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art, under the guidance of the content of the present invention, can add one or more other operations to the flowchart, and can also remove one or more operations from the flowchart. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor systems and / or microcontroller systems.

[0037] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0038] The present invention provides a virtual link network traffic statistics method, device, electronic device and storage medium, which are respectively described below.

[0039] Figure 1 A flow chart of an embodiment of a method for counting virtual link network traffic provided by the present invention is as follows: Figure 1 As shown, the virtual link network traffic statistics method includes:

[0040] S101, creating several links based on the physical interface, and assigning a link ID to each link;

[0041] S102, creating at least one virtual link under each link based on traffic characteristics, and assigning a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements;

[0042] S103: Mark the data message with an ID based on the link ID and the virtual link ID to count network traffic.

[0043] It is understandable that in step S101, the purpose of creating a link is that when each link is bound to one or more physical interfaces, each link will be assigned an ID as a unique identifier, so that any traffic received by the interface bound to the link will be marked with the link ID. This first mark is used to perform preliminary identification of data packets.

[0044] It should be noted that in step S102, the virtual link is a virtual link and does not actually exist. Its purpose is to be able to build a link on the link to serve as a marker according to network traffic requirements (ie, customer requirements) so as to specifically identify data packets.

[0045] Compared with the prior art, the present invention first creates several links based on the physical interface, and assigns a link ID to each link to achieve the first marking of traffic statistics; secondly, creates at least one virtual link under each link based on the traffic characteristics, and assigns a virtual link ID to each virtual link to achieve the second marking of traffic statistics; finally, based on the link ID and the virtual link ID, the data message is ID-marked to count the network traffic, that is, the traffic statistics of the data message to be counted are performed by marking twice, which is convenient and fast.

[0046] The present invention adds a logical layer called "virtual link" on the basis of the conventional physical port, and classifies the traffic statistics in more detail based on the user's traffic statistics needs. It is simple to configure and easy to expand. Compared with the existing technology, it reduces the configuration difficulty and improves the statistical efficiency.

[0047] In some embodiments of the present invention, each link is bound to one or more physical interfaces. When network traffic passes through the bound one or more physical interfaces, the network traffic is marked with the link ID of the link corresponding to the one or more physical interfaces as the first identifier.

[0048] In some embodiments of the present invention, traffic is further divided based on certain characteristics of traffic, and the set carrying these traffic is called a virtual link. The traffic characteristics include a traffic label and a traffic range, and the traffic label includes at least one of the following items: vlan, vxlan, mpls label, IP network segment and MAC address; the traffic range is the port range corresponding to the traffic label.

[0049] In some embodiments of the present invention, at least one virtual link is created under each link based on traffic characteristics, and a virtual link ID is assigned to each virtual link, including:

[0050] Obtaining a flow label and a flow range, and creating at least one virtual link corresponding to the flow label and the flow range under each link;

[0051] A unique virtual link ID is assigned to each virtual link.

[0052] In a specific embodiment, taking the traffic label as vlan as an example, the traffic range represents the vlan port range. For example, if the vlan port range value is 100 to 1000, the virtual link matches the data traffic with the lan port range value of 100 to 1000.

[0053] In a possible implementation, when the network traffic meets the traffic label and traffic range corresponding to the virtual link, the network traffic is marked with a link ID corresponding to the virtual link as the second identifier.

[0054] In a possible implementation, performing ID marking on a data message based on the link ID and the virtual link ID to count network traffic includes:

[0055] When the network traffic passes through the link and the virtual link successively, the data message is marked with an ID by the link ID and the virtual link ID respectively, and stored as traffic two-dimensional data;

[0056] All the two-dimensional traffic data are traversed, statistics are collected on the two-dimensional traffic data, and the data are output in the form of logs or reports in real time.

[0057] In a possible implementation, the two-dimensional traffic data is a two-dimensional array, and the link ID and the virtual link ID are used as subscripts of two dimensions respectively, and the two-dimensional array is accumulated in a cumulative form.

[0058] In the specific embodiments, see Figure 2 , Figure 2Another embodiment of the virtual link network traffic statistics method provided by the present invention is a flow chart. If a user wants to count the data traffic size of a certain port with a vlan value ranging from 100 to 1000, the implementation steps are as follows:

[0059] Step 1: Create a link and bind the physical interface. Assume that the system assigns a link ID of 1 to the link. Then create a virtual link under the link. The filtering condition of the virtual link is VLAN value 100-1000. Assume that the system assigns a virtual link ID of 2 to the virtual link. At this time, the system will create a traffic statistics structure with a link ID of 1 and a virtual link ID of 2 and store it in the memory. It can be understood that the system in this embodiment refers to a traffic statistics system, which is generally executed by software on the PC.

[0060] Step 2: When a vlan200 data packet enters the system from this physical interface, the system first marks the packet with a link ID of 1 according to the port, and then checks all virtual links under this link. There is a virtual link with a filtering condition of vlan100-1000, so the vlan value of this packet is checked to be 200, which meets the filtering condition, and determines that the traffic belongs to this virtual link, and marks the packet with a virtual link ID of 2.

[0061] Step 3: The message enters the traffic statistics module, and according to the mark in the message, its data is recorded in the traffic statistics data structure with link ID 1 and virtual link ID 2. The general data structure can use a two-dimensional array, with the link ID and virtual link ID as the subscripts of the two dimensions respectively, and the calculation method is generally to accumulate the original data.

[0062] Step 4: The system starts a task separately, regularly traverses all traffic statistics data structures, calculates the traffic data of each link and its virtual link, and outputs it in real time in the form of logs or reports. Finally, the traffic data of the VLAN values ​​100 to 1000 corresponding to the virtual link 2 under link 1 can be seen from the interface.

[0063] Step 5: If a packet with vlan 10 enters from the same interface, the system will mark the packet with a link ID of 1. However, the packet cannot match the filtering rules of any virtual link, so the packet will not be marked with a virtual link ID (in other implementations, the virtual link ID of 0 can be considered a special value, indicating that the packet does not belong to any virtual link, and can be marked with a virtual link ID of 0). Then, when statistics are performed later, the packet will only be counted in the traffic of link 1, and will not be counted in any virtual link.

[0064] It should be noted that the above is explained with vlan as the traffic label. If other traffic labels are used, such as vxlan, mpls labels, IP segments and MAC addresses, this solution can also be implemented. The specific process is not repeated here.

[0065] In order to better implement the virtual link network traffic statistics method in the embodiment of the present invention, based on the virtual link network traffic statistics method, the embodiment of the present invention also provides a virtual link network traffic statistics device, such as Figure 3 As shown, the virtual link network traffic statistics device 300 includes:

[0066] The link creation module 301 is used to create a plurality of links based on the physical interface and assign a link ID to each link;

[0067] A virtual link creation module 302, configured to create at least one virtual link under each link based on traffic characteristics, and to assign a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements;

[0068] The traffic statistics module 303 is used to perform ID marking on data messages based on the link ID and the virtual link ID to count network traffic.

[0069] The virtual link network traffic statistics device 300 provided in the above embodiment can implement the technical solution described in the above virtual link network traffic statistics method embodiment. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above virtual link network traffic statistics method embodiment, which will not be repeated here.

[0070] like Figure 4 As shown, the present invention also provides an electronic device 400. The electronic device 400 includes a processor 401, a memory 402 and a display 403. Figure 4 Only some of the components of the electronic device 400 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0071] In some embodiments, the processor 401 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run program codes or process data stored in the memory 402, such as the virtual link network traffic statistics method of the present invention.

[0072] In some embodiments of the present invention, processor 401 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, processor 401 may be local or remote. In some embodiments, processor 401 may be implemented in a cloud platform. In one embodiment, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination thereof.

[0073] In some embodiments, the memory 402 may be an internal storage unit of the electronic device 400 , such as a hard disk or a memory of the electronic device 400 .

[0074] Furthermore, the memory 402 may include both an internal storage unit of the electronic device 400 and an external storage device. The memory 402 is used to store application software installed in the electronic device 400 and various data.

[0075] In some embodiments, the display 403 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 403 is used to display information of the electronic device 400 and to display a visual user interface. The components 401-403 of the electronic device 400 communicate with each other via a system bus.

[0076] In some embodiments of the present invention, when the processor 401 executes the virtual link network traffic statistics program in the memory 402, the following steps may be implemented:

[0077] Create several links based on the physical interface and assign a link ID to each link;

[0078] Creating at least one virtual link under each link based on traffic characteristics, and assigning a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements;

[0079] The data message is ID-tagged based on the link ID and the virtual link ID to count the network traffic.

[0080] It should be understood that: when the processor 401 executes the virtual link network traffic statistics program in the memory 402, in addition to the above functions, other functions can also be implemented. For details, please refer to the description of the above corresponding method embodiments.

[0081] Correspondingly, an embodiment of the present invention also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, it can implement the steps or functions of the virtual link network traffic statistics method provided by the above-mentioned method embodiments.

[0082] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0083] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0084] The above is a detailed introduction to a virtual link network traffic statistics method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principle and implementation method of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A virtual link network traffic statistics method, characterized in that: include: Create several links based on the physical interface and assign a link ID to each link; Creating at least one virtual link under each link based on traffic characteristics, and assigning a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements; Performing ID marking on the data message based on the link ID and the virtual link ID to count network traffic includes: When the network traffic passes through the link and the virtual link successively, the data message is marked with an ID by the link ID and the virtual link ID respectively, and stored as traffic two-dimensional data; All the two-dimensional traffic data are traversed, statistics are collected on the two-dimensional traffic data, and the data are output in the form of logs or reports in real time.

2. The virtual link network traffic statistics method according to claim 1, characterized in that: Each link is bound to one or more physical interfaces. When network traffic passes through the bound one or more physical interfaces, the network traffic is marked with the link ID of the link corresponding to the one or more physical interfaces as the first identifier.

3. The virtual link network traffic statistics method according to claim 1, characterized in that: The traffic characteristics include a traffic label and a traffic range, and the traffic label includes at least one of the following items: vlan, vxlan, mpls label, IP network segment and MAC address; the traffic range is the port range corresponding to the traffic label.

4. The virtual link network traffic statistics method according to claim 3 is characterized in that: At least one virtual link is created under each link based on traffic characteristics, and a virtual link ID is assigned to each virtual link, including: Obtaining a flow label and a flow range, and creating at least one virtual link corresponding to the flow label and the flow range under each link; A unique virtual link ID is assigned to each virtual link.

5. The virtual link network traffic statistics method according to claim 4 is characterized in that: When the network traffic meets the traffic label and traffic range corresponding to the virtual link, the network traffic is marked with the link ID corresponding to the virtual link as the second identifier.

6. The virtual link network traffic statistics method according to claim 1, characterized in that: The two-dimensional traffic data is a two-dimensional array, and the link ID and the virtual link ID are used as subscripts of two dimensions respectively, and the two-dimensional array is accumulated in a cumulative form.

7. A virtual link network traffic statistics device, characterized in that: include: A link creation module is used to create several links based on the physical interface and assign a link ID to each link; A virtual link creation module, used for creating at least one virtual link under each link based on traffic characteristics, and assigning a virtual link ID to each virtual link, wherein the traffic characteristics are determined according to network traffic statistics requirements; A traffic statistics module, used for performing ID marking on data messages based on the link ID and the virtual link ID to count network traffic, including: When the network traffic passes through the link and the virtual link successively, the data message is marked with an ID by the link ID and the virtual link ID respectively, and stored as traffic two-dimensional data; All the two-dimensional traffic data are traversed, statistics are collected on the two-dimensional traffic data, and the data are output in the form of logs or reports in real time.

8. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the virtual link network traffic statistics method described in any one of claims 1 to 6 above.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps in the virtual link network traffic statistics method described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Packet forwarding method, system and device

    CN104954249A