Method, device, equipment and storage medium for realizing network damage

文档序号:1956679 发布日期:2021-12-10 浏览:15次 中文

阅读说明:本技术 一种实现网络损伤的方法、装置、设备及存储介质 (Method, device, equipment and storage medium for realizing network damage ) 是由 陆华兴 于 2020-06-09 设计创作,主要内容包括:本发明实施例提供一种实现网络损伤的方法、装置、设备及存储介质,通过在LINUX操作系统下,接收到待测试虚拟局域网VLAN发送的报文后,根据网络损伤指令对报文进行处理,在某些实施过程中,只要是能接收基于VLAN发送的报文,并且安装有LINUX操作系统的装置,就可以实现网络损伤,无需专业的网络损伤仪,降低了网络测试成本,从而提供了一种低成本的实现网络损伤的装置。(The embodiment of the invention provides a method, a device, equipment and a storage medium for realizing network damage.)

1. An apparatus to implement network impairments, the apparatus comprising:

and the processing module is used for processing the message according to the network damage instruction after receiving the message sent by the VLAN to be tested under the LINUX operating system.

2. The apparatus for implementing network impairment of claim 1, wherein the processing module is further to: and sending the processed message to the next device.

3. The apparatus for implementing network impairment of claim 1, wherein the apparatus further comprises a connection module,

the connection module is used for: and establishing the physical network bridge corresponding to the VLAN to be tested through the first network card and the second network card.

4. The apparatus for implementing network impairment of claim 3, wherein the connection module is further configured to: and configuring subinterfaces corresponding to the to-be-tested VLAN to the physical network bridge corresponding to the to-be-tested VLAN on the first network card and the second network card.

5. The apparatus for implementing network impairment of claim 4, wherein the apparatus further comprises: the configuration module is used for configuring the network damage instruction aiming at the subinterface on the first network card corresponding to the VLAN to be tested; or, configuring the network damage instruction for the subinterface on the second network card corresponding to the to-be-tested VLAN.

6. The apparatus for implementing network impairment of claim 5, wherein the configuration module is a Transmission Control Module Traffic Control.

7. The apparatus for implementing network impairment of any one of claims 1 to 6, wherein the apparatus is any one of the following apparatuses: server, computer, industrial computer.

8. A method of implementing network impairments, comprising:

under the LINUX operating system, after receiving a message sent by a virtual local area network VLAN to be tested, processing the message according to a network damage instruction.

9. An apparatus to implement network impairments, the apparatus comprising a processor, a memory, and a communication bus;

the communication bus is used for realizing connection communication between the processor and the memory;

the processor is configured to execute one or more computer programs stored in the memory to implement the steps of the method of implementing network impairments of claim 8.

10. A storage medium storing one or more computer programs, the one or more computer programs being executable by one or more processors to implement the steps of the method of implementing network impairments of claim 8.

Technical Field

The embodiments of the present invention relate to, but are not limited to, the field of communications, and in particular, to, but not limited to, a method, an apparatus, a device, and a storage medium for implementing network impairment.

Background

In order to accurately and reliably test the performance of a network application or a network device in a real network environment, the network is usually damaged. At present, network damage is usually realized by using a professional network damage instrument, and the sale price of the professional network damage instrument is high, so that the network performance test cost is high.

Disclosure of Invention

The embodiment of the invention provides a method, a device, equipment and a storage medium for realizing network damage, and mainly solves the technical problem of high network test cost.

To solve the foregoing technical problem, an embodiment of the present invention provides an apparatus for implementing network impairment, including:

and the processing module is used for processing the message according to the network damage instruction after receiving the message sent by the VLAN to be tested under the LINUX operating system.

The embodiment of the invention also provides a method for realizing network damage, which comprises the following steps:

under the LINUX operating system, after receiving a message sent by a virtual local area network VLAN to be tested, processing the message according to a network damage instruction.

The embodiment of the invention also provides equipment for realizing network damage, which comprises a processor, a memory and a communication bus;

the communication bus is used for realizing connection communication between the processor and the memory;

the processor is configured to execute one or more computer programs stored in the memory to implement the steps of the above-described method of implementing network impairment.

Embodiments of the present invention also provide a storage medium, where one or more computer programs are stored, and the one or more computer programs may be executed by one or more processors to implement the steps of the method for implementing network impairment.

According to the method, the device and the computer storage medium for realizing network damage provided by the embodiment of the invention, after the message sent by the VLAN to be tested is received under the LINUX operating system, the message is processed according to the network damage instruction, in some implementation processes, as long as the device can receive the message sent based on the VLAN and is provided with the LINUX operating system, the network damage can be realized, a professional network damage instrument is not needed, the network test cost is reduced, and therefore, the device for realizing the network damage with low cost is provided.

Additional features and corresponding advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.

Drawings

Fig. 1 is a schematic structural diagram of an apparatus for implementing network impairment according to a first embodiment of the present invention;

fig. 2 is another schematic structural diagram of an apparatus for implementing network impairment according to a first embodiment of the present invention;

fig. 3 is a schematic structural diagram of an apparatus for implementing network impairment according to a first embodiment of the present invention;

fig. 4 is a schematic structural diagram of an apparatus for implementing network impairment according to a second embodiment of the present invention;

fig. 5 is a flowchart of a method for implementing network impairment according to a third embodiment of the present invention;

fig. 6 is a flowchart of a method for implementing network impairment according to a fourth embodiment of the present invention;

fig. 7 is a schematic structural diagram of a device for implementing network impairment according to a fifth embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention are described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

The first embodiment is as follows:

in the related art, network damage is realized through a professional network damage instrument, and the professional network damage instrument is high in selling price, so that the network test cost is high. In order to solve the above problem, an embodiment of the present invention provides an apparatus for implementing network impairment, please refer to fig. 1, where the apparatus 10 includes: a processing module 101.

The processing module 101 is configured to, after receiving a message sent by a Virtual Local Area Network (VLAN) to be tested under the LINUX operating system, process the message according to a Network damage instruction. That is, as long as one device can receive the message sent based on the VLAN and is equipped with the LINUX operating system, network damage can be realized without a professional network damage instrument, and network test cost is reduced, thereby providing a low-cost device for realizing network damage. In the embodiment of the present invention, the device 10 for implementing network impairment may be any device that is installed with LINUX operating system and can receive packets sent based on VLAN, for example, a server, a computer, an industrial personal computer, and the like.

In the embodiment of the present invention, the VLAN to be tested may be any VLAN capable of being connected to the device 10 for implementing network damage. For example, in some embodiments, the VLAN under test may be a VLAN included by a device under test connected to the apparatus 10 implementing network impairments. The VLANs to be tested may be configured according to the corresponding configuration instructions, for example, all VLANs included in the devices to be tested may be set as VLANs to be tested, or a specific VLAN included in the devices to be tested may be set as a VLAN to be tested.

In the embodiment of the present invention, the network impairment instruction includes, but is not limited to, an instruction issued for at least one of time delay, packet loss, jitter, speed limit, bandwidth, and the like. For latency, it is the time it takes for a message to travel from one end of the network to the other; for jitter, it refers to the variation degree of message delay; for packet loss, it means that the packet is lost when being transmitted in the network; for speed limiting, it means limiting the network device to transfer the message at a certain speed. For example, to control the delay, a network damage instruction for the delay may be issued, and to control the delay and packet loss, a network damage instruction for the delay and packet loss may be issued. It should be understood that the network damage instructions are different and the processing modes are different, for example, if the network damage instruction is delayed by 100ms, the network damage instruction is delayed by 100ms and then sent after receiving the message sent by the VLAN to be tested; and if the network damage instruction is to add the packet loss rate, discarding part of the messages according to the packet loss rate after receiving the messages sent by the VLAN to be tested.

In the embodiment of the present invention, in order to receive a message sent based on a VLAN to be tested, that is, in order to pass through the VLAN to be tested, please refer to fig. 2, the apparatus 10 for implementing network damage further includes a connection module 102, configured to establish a physical network bridge corresponding to the VLAN to be tested through a first network card and a second network card. It should be noted that the device 10 for implementing network impairment further includes at least two network cards, where the at least two network cards include a first network card and a second network card, and the first network card and the second network card are any two network cards in the device 10 for implementing network impairment, and a physical network bridge corresponding to a VLAN may be established through the first network card and the second network card. In some embodiments, in order to establish the physical bridges corresponding to the VLANs to be tested, the device 10 for implementing network impairment may establish the physical bridges corresponding to all VLANs, that is, pass through all VLANs, before determining the VLANs to be tested, it should be understood that 4094 physical bridges may be established on the first network card and the second network card, and therefore 4094 physical bridges are established here, that is, 4094 physical bridges are established on the first network card and the second network card. Alternatively, in some embodiments, the device 10 for implementing network impairment may establish only the physical bridge corresponding to the VLAN to be tested, that is, the on-demand transparent transmission VLAN, after determining the VLAN to be tested. For example, if the device 10 that implements network impairment needs to pass through VLANs 100, 200, and 300, 4094 physical bridges may be created, or only physical bridges corresponding to VLANs 100, 200, and 300 may be created. It should be noted that VLANs correspond to physical bridges one to one.

In the embodiment of the present invention, the network card included in the device 10 for implementing network impairment may be a network card with any transmission bandwidth, for example, a network card supporting 1GE, 10GE, 25GE, 40GE, 100GE, and the like.

In this embodiment of the present invention, the connection module 102 is further configured to: and configuring the subinterfaces corresponding to the to-be-tested VLAN to the physical network bridge corresponding to the to-be-tested VLAN on the first network card and the second network card. It should be understood that, under the LINUX operating system, it is supported to create a plurality of sub-interfaces on a physical network card, and one physical network card can create up to 4094 sub-interfaces. In the embodiment of the invention, the subinterfaces corresponding to the VLANs to be tested are established on the first network card, the subinterfaces corresponding to the VLANs to be tested are established on the second network card, and the subinterfaces corresponding to the VLANs to be tested on the first network card and the subinterfaces corresponding to the VLANs to be tested are configured on the physical bridge corresponding to the VLANs to be tested. For example, assuming that the VLAN to be tested is VLAN400 (where 400 is a VLAN ID), a physical bridge br4 is established based on a first network card and a second network card, a subinterface ens1f0.400 is created on the first network card (where ens1f0 is a network card name, the first network card is characterized, and 400 is a subinterface ID), an ens1f1.400 is created on the second network card (where ens1f1 is a network card name, the second network card is characterized, and 400 is a subinterface ID), and then the ens1f0.400 and the ens1f1.400 are configured to br 4.

In some embodiments, when creating the subinterfaces corresponding to the VLANs to be tested, all subinterfaces may be created on the first network card and the second network card in advance, and after the VLANs to be tested are determined, the subinterfaces corresponding to the VLANs to be tested are configured to the corresponding physical bridges. Or after determining the VLAN to be tested, creating a subinterface corresponding to the VLAN to be tested on the first network card, and creating a subinterface corresponding to the VLAN to be tested on the second network card.

In the embodiment of the present invention, for configuring the network impairment command, please refer to fig. 3, where the apparatus 10 for implementing network impairment further includes a configuration module 103, and the configuration module 103 is configured to configure the network impairment command for the VLAN to be tested. It should be noted that, under the LINUX operating system, it is supported to set packet loss, time delay, jitter, speed limit, and the like for the network card, for example, the command for configuring the time delay for the network card under the LINUX is as follows: tc qdisc add dev ens1f0root netem delay 100 ms; where ens1f0 is the net card name and 100ms is the added latency. Therefore, in the embodiment of the present invention, when the network damage instruction is configured for the VLAN to be tested, the network damage instruction may be configured for the network card corresponding to the VLAN to be tested, for example, the network damage instruction may be configured for the first network card or the second network card. Because the network damage instruction corresponding to each VLAN to be tested may be different, when the network damage instruction is configured for the VLAN to be tested, the network damage instruction may also be configured for the subinterface on the network card corresponding to the VLAN to be tested, for example, the network damage instruction may be configured for the subinterface on the first network card corresponding to the VLAN to be tested, or the network damage instruction may be configured for the subinterface on the second network card corresponding to the VLAN to be tested. For better understanding, this is illustrated here with an example: assuming that a VLAN to be tested is VLAN500, based on a physical bridge br5 created by a first network card and a second network card, a subinterface ens1f0.500 created by the first network card and a subinterface ens1f1.500 created by the second network card are configured on a physical bridge br5, and when a network damage instruction is configured, a network damage instruction may be configured for the ens1f0.500, or the ens1f1.500.

In the embodiment of the present invention, since a Traffic Control tool TC (Traffic Control, transmission Control module) under the LINUX operating system supports setting of packet loss, time delay, jitter, speed limit, and the like for the network card, the configuration module may be a TC, and of course, the configuration module may also be another module.

In the embodiment of the present invention, after the message is processed according to the network damage instruction, the transmission module 101 may further send the processed message to the next device.

The device for realizing network damage provided by the embodiment of the invention comprises a processing module, wherein the processing module is used for processing a message according to a network damage instruction after receiving the message sent by a virtual local area network VLAN to be tested under an LINUX operating system.

Example two:

for a better understanding of the present invention, the embodiments of the present invention provide more specific examples for illustration. Referring to fig. 4, an embodiment of the present invention provides an apparatus 10 for implementing network impairment, including: the device comprises a processing module 101, a connection module 102 and a configuration module 103, wherein the connection module 102 comprises a first network card 1021 and a second network card 1022. The device 10 is equipped with a LINUX operating system.

In the embodiment of the present invention, after determining the VLAN to be tested based on the corresponding configuration instruction, the connection module 102 establishes the physical bridge corresponding to the VLAN to be tested through the first network card and the second network card in the LINUX operating system, then creates the subinterfaces corresponding to the testing VLAN on the first network card and the second network card, and configures the subinterfaces corresponding to the VLAN to be tested into the physical bridge corresponding to the VLAN to be tested, so that the device 10 for realizing network damage can transparently transmit the VLAN to be tested.

The configuration module 103 is configured to configure a network damage instruction for the to-be-tested VLAN, where the configuring a network damage instruction for the to-be-tested VLAN includes: and configuring a network damage instruction aiming at the sub-interface corresponding to the VLAN to be tested on the first network card, or configuring a network damage instruction aiming at the sub-interface corresponding to the VLAN to be tested on the second network card.

The processing module 101 is configured to process a message based on a configured network damage instruction after receiving the message sent by the VLAN to be tested.

For better understanding, this is illustrated here with an example:

assuming that the VLANs to be tested are determined to be VLAN700 and VLAN800 according to the configuration instruction, the connection module 102 creates physical bridges br7 and br8 for the VLAN700 and the VLAN800 respectively based on the first network card and the second network card, and creates sub-interfaces ens1f0.700 and ens1f0.800 on the first network card; and sub-interfaces of the sense 1f1.700 and the sense 1f1.800 are created on the second network card, the sense 1f0.700 and the sense 1f1.700 are configured on the physical bridge br7, and the sense 1f0.800 and the sense 1f1.800 are configured on the br 8. The configuration module 103 configures a network impairment instruction with an add delay of 300ms for the ens1f0.700, where the command may be: tc qdisc add dev ens1f0.700root netem delay 300 ms. Adding 8% of packet loss rate for the configuration of the ens1f1.800, wherein the command may be: tc qdisc add dev env 1f1.800root netem loss 8%. After receiving the message sent by the VLAN700, the processing module 103 waits for 300ms and then sends the message, and after receiving the message sent by the VLAN800, discards part of the message based on the packet loss rate.

In the device for realizing network damage provided by the embodiment of the invention, under the LINUX operating system, the physical network bridge is established for the VLAN to be tested through the first network card and the second network card, and after the message sent by the VLAN to be tested is received, the message is processed according to the network damage instruction.

Example three:

an embodiment of the present invention provides a method for implementing network impairment, which is shown in fig. 5 and includes:

s501: and under the LINUX operating system, after receiving the message sent by the VLAN to be tested, processing the message according to the network damage instruction.

In the embodiment of the invention, the device for realizing network damage processes the message according to the network damage instruction after receiving the message sent by the VLAN to be tested under the LINUX operating system. That is to say, the device for realizing network damage only needs to receive the message sent based on the VLAN and is equipped with the LINUX operating system, so that a professional network damage instrument is not needed, the network test cost is reduced, and thus a device for realizing network damage with low cost is provided.

In the embodiment of the invention, the VLAN to be tested can be any VLAN which can be connected with a device for realizing network damage. For example, in some embodiments, the VLAN under test may be a VLAN included by a device under test connected to a device implementing network impairments. The VLANs to be tested may be configured according to the corresponding configuration instructions, for example, all VLANs included in the devices to be tested may be set as VLANs to be tested, or a specific VLAN included in the devices to be tested may be set as a VLAN to be tested.

In the embodiment of the present invention, the network impairment instruction includes, but is not limited to, an instruction issued for at least one of time delay, packet loss, jitter, speed limit, bandwidth, and the like. For latency, it is the time it takes for a message to travel from one end of the network to the other; for jitter, it refers to the variation degree of message delay; for packet loss, it means that the packet is lost when being transmitted in the network; for speed limiting, it means limiting the network device to transfer the message at a certain speed. For example, to control the delay, a network damage instruction for the delay may be issued, and to control the delay and packet loss, a network damage instruction for the delay and packet loss may be issued. It should be understood that the network damage instructions are different and the processing modes are different, for example, if the network damage instruction is delayed by 100ms, the network damage instruction is delayed by 100ms and then sent after receiving the message sent by the VLAN to be tested; and if the network damage instruction is to add the packet loss rate, discarding part of the messages according to the packet loss rate after receiving the messages sent by the VLAN to be tested.

In the embodiment of the present invention, in order to receive a message sent based on a VLAN to be tested, that is, in order to pass through the VLAN to be tested, before S501, the method further includes: and establishing a physical network bridge corresponding to the VLAN to be tested through the first network card and the second network card.

It should be noted that the device for implementing network impairment further includes at least two network cards, where the at least two network cards include a first network card and a second network card, the first network card and the second network card are any two network cards in the device for implementing network impairment, and a physical network bridge corresponding to the VLAN may be established through the first network card and the second network card.

In some embodiments, in order to establish the physical bridges corresponding to the VLANs to be tested, the physical bridges corresponding to all the VLANs may be established in advance before determining the VLANs to be tested, that is, all the VLANs are transmitted through, it should be understood that 4094 physical bridges may be established on the first network card and the second network card, and therefore 4094 physical bridges corresponding to all the VLANs are established here, that is, 4094 physical bridges are established on the first network card and the second network card. Or, in some embodiments, after determining the VLAN to be tested, only the physical bridge corresponding to the VLAN to be tested may be established, that is, the VLAN is transparently transmitted as needed. For example, assuming that the VLANs to be tested are VLANs 100, 200, and 300, 4094 physical bridges may be created before determining the VLANs to be tested, or only the physical bridges corresponding to VLANs 100, 200, and 300 may be created after determining the VLANs to be tested. It should be noted that VLANs correspond to physical bridges one to one.

In the embodiment of the present invention, the network card may be a network card with any transmission bandwidth, for example, a network card supporting 1GE, 10GE, 25GE, 40GE, 100GE, and the like.

In the embodiment of the present invention, after the physical network bridge corresponding to the VLAN to be tested is established through the first network card and the second network card, the method may further include: and configuring the subinterfaces corresponding to the to-be-tested VLAN to the physical network bridge corresponding to the to-be-tested VLAN on the first network card and the second network card. It should be understood that, under the LINUX operating system, it is supported to create a plurality of sub-interfaces on a physical network card, and one physical network card can create up to 4094 sub-interfaces. In the embodiment of the invention, the subinterfaces corresponding to the VLANs to be tested are established on the first network card, the subinterfaces corresponding to the VLANs to be tested are established on the second network card, and the subinterfaces corresponding to the VLANs to be tested on the first network card and the subinterfaces corresponding to the VLANs to be tested are configured on the physical bridge corresponding to the VLANs to be tested. For example, assuming that the VLAN to be tested is VLAN400 (where 400 is a VLAN ID), a physical bridge br4 is established based on a first network card and a second network card, a subinterface ens1f0.400 is created on the first network card (where ens1f0 is a network card name, the first network card is characterized, and 400 is a subinterface ID), an ens1f1.400 is created on the second network card (where ens1f1 is a network card name, the second network card is characterized, and 400 is a subinterface ID), and then the ens1f0.400 and the ens1f1.400 are configured to br 4.

In some embodiments, before determining the VLAN to be tested, creating all subinterfaces on the first network card and the second network card in advance, and after determining the VLAN to be tested, configuring the subinterface corresponding to the VLAN to be tested to the corresponding physical bridge, it should be understood that 4094 subinterfaces may be created on one network card, 4094 subinterfaces may be created on the first network card in advance, 4094 subinterfaces may be created on the second network card, and after determining the VLAN to be tested, directly configuring the subinterfaces on the first network card and the second network card corresponding to the VLAN to be tested to the physical bridge established based on the first network card and the second network card. Or after determining the VLAN to be tested, creating a subinterface corresponding to the VLAN to be tested on the first network card, and creating a subinterface corresponding to the VLAN to be tested on the second network card.

In the embodiment of the present invention, before S501, the method further includes: and configuring a network damage instruction aiming at the VLAN to be tested. It should be noted that, under the LINUX operating system, it is supported to set packet loss, time delay, jitter, speed limit, and the like for the network card, for example, the command for configuring the time delay for the network card under the LINUX is as follows: tc qdisc add dev ens1f0root netem delay 100 ms; where ens1f0 is the net card name and 100ms is the added latency. Therefore, in the embodiment of the present invention, when the network damage instruction is configured for the VLAN to be tested, the network damage instruction may be configured for the network card corresponding to the VLAN to be tested, for example, the network damage instruction may be configured for the first network card or the second network card. Because the network damage instruction corresponding to each VLAN to be tested may be different, when the network damage instruction is configured for the VLAN to be tested, the network damage instruction may also be configured for the subinterface on the network card corresponding to the VLAN to be tested, for example, the network damage instruction may be configured for the subinterface on the first network card corresponding to the VLAN to be tested, or the network damage instruction may be configured for the subinterface on the second network card corresponding to the VLAN to be tested. For better understanding, this is illustrated here with an example: assuming that a VLAN to be tested is VLAN500, based on a physical bridge br5 created by a first network card and a second network card, a subinterface ens1f0.500 created by the first network card and a subinterface ens1f1.500 created by the second network card are configured on a physical bridge br5, and when a network damage instruction is configured, a network damage instruction may be configured for the ens1f0.500, or the ens1f1.500.

In the embodiment of the present invention, since a Traffic Control tool TC (Traffic Control, transmission Control module) under the LINUX operating system supports setting of packet loss, time delay, jitter, speed limit, and the like for the network card, a network damage instruction may be configured through the TC.

In the embodiment of the invention, after the message is processed according to the network damage instruction, the processed message can be sent to the next device.

According to the method for realizing network damage provided by the embodiment of the invention, after the message sent by the VLAN to be tested is received under the LINUX operating system, the message is processed according to the network damage instruction, in some implementation processes, the network damage can be realized as long as the device can receive the message sent based on the VLAN and is provided with the LINUX operating system, a professional network damage instrument is not needed, the network test cost is reduced, and therefore, the device for realizing the network damage with low cost is provided.

Example four:

an embodiment of the present invention provides a method for implementing network impairment, which is applied to a device for implementing network impairment, and as shown in fig. 6, the method includes:

s601, determining the VLAN to be tested.

In the embodiment of the invention, the device for realizing the network damage is provided with the LINUX operating system, and the VLAN to be tested is determined according to the configuration instruction under the LINUX operating system.

S602, establishing a physical network bridge corresponding to the VLAN to be tested based on the first network card and the second network card.

In the embodiment of the invention, the device for realizing the network damage comprises a first network card and a second network card, and a physical network bridge of the VLAN pair to be tested can be established through the first network card and the second network card, so that the VLAN to be tested is transmitted in a transparent mode.

S603, establishing sub-interfaces corresponding to the VLANs to be tested on the first network card and the second network card.

In the embodiment of the invention, one network card supports the creation of 4094 subinterfaces under the LINUX operating system. The device for realizing the network respectively establishes corresponding sub-interfaces on the first network card and the second network card.

S604, configuring the subinterfaces corresponding to the to-be-tested VLANs to the physical bridges corresponding to the to-be-tested VLANs.

After the subinterface is created, the subinterface is configured to the physical bridge corresponding to the VLAN to be tested (i.e., the physical bridge established in S602).

S605, configuring a network damage instruction aiming at the VLAN to be tested.

In the embodiment of the present invention, when configuring the network damage instruction for the to-be-tested VLAN, the network damage instruction may be configured for the subinterface on the first network card corresponding to the to-be-tested VLAN, or the network damage instruction may be configured for the subinterface on the second network card corresponding to the to-be-tested VLAN. Of course, in other embodiments, the network impairment instruction may also be configured for one of the network cards on the physical bridge corresponding to the VLAN to be tested.

The network impairment instruction includes, but is not limited to, an instruction issued for at least one of latency, packet loss, jitter, speed limit, bandwidth, and the like.

And S606, after receiving the message sent by the VLAN to be tested, processing the message based on the network damage instruction.

And after receiving the message sent by the VLAN to be tested, processing the message based on the network damage instruction configured in the S605. It should be noted that the network damage instructions are different and the processing modes are different, for example, if the network damage instruction is added with a delay of 100ms, the network damage instruction is delayed by 100ms and then sent after receiving the message sent by the VLAN to be tested; and if the network damage instruction is to add the packet loss rate, discarding part of the messages according to the packet loss rate after receiving the messages sent by the VLAN to be tested.

For better understanding of the present invention, which is described herein as an example, the method for implementing network impairment includes:

1. and determining the VLAN to be tested to be the VLAN900 according to the configuration instruction.

2. And establishing a network bridge br9 corresponding to the VLAN900 based on the first network card and the second network card.

3. And creating a subinterface ens1f0.900 corresponding to the VLAN900 on the first network card, and creating a subinterface ens1f1.900 corresponding to the VLAN900 on the second network card.

4. The enrens1f0.900 and the enrens1f1.900 were allocated to br 9.

5. The add delay 500ms is configured for the ens1f0.900.

6. After receiving the message sent by the VLAN900, delaying 500ms and then sending the message.

According to the method for realizing network damage provided by the embodiment of the invention, the physical network bridge is established for the VLAN to be tested through the first network card and the second network card, and the message sent by the VLAN to be tested is received and then is processed according to the network damage instruction.

EXAMPLE five

An embodiment of the present invention further provides a device for implementing network impairment, which is shown in fig. 7 and includes a processor 701, a memory 702, and a communication bus 703, where:

the communication bus 703 is used for realizing connection communication between the processor 701 and the memory 702;

the processor 701 is configured to execute one or more computer programs stored in the memory 702 to implement at least one step of the method for implementing network impairment in the third and fourth embodiments.

Embodiments of the present invention also provide a storage medium including volatile or nonvolatile, removable or non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, computer program modules or other data. Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash Memory or other Memory technology, CD-ROM (Compact disk Read-Only Memory), Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer.

The storage medium in the embodiment of the present invention may be used to store one or more computer programs, and the stored one or more computer programs may be executed by the processor to implement at least one step of the method for implementing network impairment in the third and fourth embodiments.

The device and the storage medium for realizing network damage provided by the embodiment of the invention process the message according to the network damage instruction after receiving the message sent by the VLAN to be tested under the LINUX operating system, can realize network damage as long as the message sent based on the VLAN can be received and a device of the LINUX operating system is installed in certain implementation processes, do not need a professional network damage instrument, reduce the network test cost, and thus provide a device for realizing network damage with low cost.

It will be apparent to those skilled in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software (which may be implemented in computer program code executable by a computing device), firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit.

In addition, communication media typically embodies computer readable instructions, data structures, computer program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to one of ordinary skill in the art. Thus, the present invention is not limited to any specific combination of hardware and software.

The foregoing is a more detailed description of embodiments of the present invention, and the present invention is not to be considered limited to such descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种实现云内网和云外网互通的方法、系统、设备和介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!