Disclosure of Invention
In view of the problems that a method for configuring a virtual machine control policy by using a VN-tag technology in the prior art has high requirements on equipment and high cost, embodiments of the present invention provide a method for configuring a virtual machine control policy and a switch.
In a first aspect, an embodiment of the present invention provides a method for configuring a virtual machine control policy, where the method includes:
receiving a first control strategy aiming at a virtual machine;
acquiring the MAC address of the virtual machine according to the virtual machine identifier in the first control strategy;
and replacing the virtual machine identifier in the first control strategy by using the MAC address of the virtual machine to obtain a second control strategy.
In a first possible implementation manner, after obtaining the second control strategy, the method further includes: receiving an address change message aiming at the virtual machine, wherein the address change message carries an updated MAC address; and replacing the MAC address in the second control strategy by using the updated MAC address to obtain a third control strategy.
With reference to the first aspect, in a second possible implementation manner, after the obtaining the second control policy, the method further includes: receiving a first update control policy for the virtual machine, wherein the first update control policy comprises the virtual machine identifier of the virtual machine; acquiring the MAC address corresponding to the virtual machine identifier, and replacing the virtual machine identifier in the first updating control strategy with the MAC address to obtain a second updating control strategy; replacing the second control strategy with the second updated control strategy.
With reference to the first aspect, in a third possible implementation manner, before the obtaining, according to the virtual machine identifier in the first control policy, the MAC address of the virtual machine, the method further includes: and receiving the virtual machine identification and N MAC addresses corresponding to the virtual machine identification, wherein N is greater than or equal to 1.
With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner, the replacing, by the MAC address of the virtual machine, the virtual machine identifier in the first control policy to obtain a second control policy specifically includes: and replacing the virtual machine identification in the first control strategy one by using the N MAC addresses to obtain N second control strategies, wherein the N second control strategies are respectively in one-to-one correspondence with the N MAC addresses.
With reference to the first aspect, in a fifth possible implementation manner, after the obtaining the second control strategy, the method further includes: and processing the received data packet with the MAC address as a destination address or a source address according to the second control strategy.
With reference to the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner, the processing, according to the second control policy, a data packet that is received and that uses the MAC address as a destination address or a source address specifically includes: receiving a data packet with the MAC address as a destination address or a source address; and forwarding the data packet or refusing to forward the data packet according to the second control strategy.
With reference to the first aspect or the first, second, third, fourth, fifth, and sixth possible implementation manners of the first aspect, in a seventh possible implementation manner, the first control policy includes at least one of the following control policies: the method comprises an access control strategy, a resource reservation strategy, a traffic priority strategy, a maximum traffic delay strategy, a maximum traffic packet loss rate strategy and a maximum traffic jitter strategy.
In a second aspect, an embodiment of the present invention provides a switch, including a control module, where the control module includes a receiving submodule, an obtaining submodule, and a converting submodule; the receiving submodule is used for receiving a first control strategy aiming at the virtual machine; the obtaining submodule is used for obtaining the MAC address of the virtual machine according to the virtual machine identifier in the first control strategy; and the conversion submodule is used for replacing the virtual machine identifier in the first control strategy by using the MAC address of the virtual machine to obtain a second control strategy.
In a first possible implementation manner, the receiving sub-module is further configured to receive an address change message for the virtual machine, where the address change message carries an updated MAC address; and the conversion module is also used for replacing the MAC address in the second control strategy by the updated MAC address to obtain a third control strategy.
With reference to the second aspect, in a second possible implementation manner, the switch further includes a replacement sub-module; the receiving submodule is further configured to receive a first update control policy for the virtual machine, where the first update control policy includes the virtual machine identifier of the virtual machine; the conversion submodule is further configured to obtain the MAC address corresponding to the virtual machine identifier, and replace the virtual machine identifier in the first update control policy with the MAC address to obtain a second update control policy; the replacement sub-module is configured to replace the second control strategy with the second updated control strategy.
With reference to the second aspect, in a third possible implementation manner, the receiving submodule is further configured to receive the virtual machine identifier and N MAC addresses corresponding to the virtual machine identifier, where N is greater than or equal to 1.
With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the conversion module is specifically configured to replace the virtual machine identifier in the first control policy one by one with the N MAC addresses to obtain N second control policies, where the N second control policies correspond to the N MAC addresses one to one, respectively.
With reference to the second aspect, in a fifth possible implementation manner, the switch further includes a switching module, and the switching module is connected to the control module; and the switching module is used for receiving the second control strategy from the control module and forwarding or rejecting the forwarding processing of the received data packet with the MAC address as a destination address or a source address according to the second control strategy.
With reference to the second aspect or the first, second, third, fourth, and fifth possible implementation manners of the second aspect, in a sixth possible implementation manner, the control policy includes, but is not limited to, one or any combination of the following: the method comprises an access control strategy, a resource reservation strategy, a traffic priority strategy, a maximum traffic delay strategy, a maximum traffic packet loss rate strategy and a maximum traffic jitter strategy.
In the embodiment of the invention, a switch acquires a first control strategy aiming at a virtual machine from a network management center; acquiring the MAC address of the virtual machine according to the virtual machine identifier in the first control strategy; and replacing the virtual machine identifier in the first control strategy by using the MAC address of the virtual machine to obtain a second control strategy. Therefore, the embodiment of the invention realizes the configuration and management of the control strategy at the MAC address level, solves the problems of high requirement on equipment and high cost of a method for configuring the control strategy of the virtual machine by using the VN-tag technology in the prior art, saves a large amount of economic cost and ensures that the strategy control at the virtual machine level is easier to realize.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic view of an application architecture of a configuration method of a virtual machine control policy according to an embodiment of the present invention. As shown in fig. 1, the network management center may obtain a virtual MAC address corresponding to each network port of the virtual machine, and may send a correspondence between the MAC address of the virtual network port of the virtual machine and the virtual machine (the correspondence may be embodied by a correspondence between a virtual machine identifier of the virtual machine (the virtual machine identifier in this document refers to an ID of the virtual machine) and the MAC address of the virtual machine), and a control policy for the virtual machine to a control module of a data center access switch, where the switch may be an OpenFlow switch; after receiving the corresponding relation between the MAC address of the virtual network port and the virtual machine and the control strategy aiming at the virtual machine, the control module can convert the control strategy aiming at the virtual machine into the control strategy aiming at the MAC address; when the switch receives a data packet from a certain MAC address of the virtual machine or a certain MAC address sent to the virtual machine, the switch can correspondingly process the data packet according to a control strategy aiming at the MAC address, thereby realizing the strategy control aiming at the virtual machine.
Fig. 2 is a flowchart of a configuration method of a virtual machine control policy according to an embodiment of the present invention. The main execution body of this embodiment is a switch, and a method of converting a control policy for a virtual machine into a control policy for a MAC address after the switch acquires the control policy for the virtual machine from a network management center is described in detail. As shown in fig. 2, this embodiment includes the steps of:
step 201, a first control strategy for a virtual machine is received.
In order to realize the technical scheme of the invention, the switch comprises a control module and a switching module, and the switching module and the control module carry out information interaction through an interface. The switch and the network management center can communicate through the management interface, and the network management center can actively send the virtual MAC address corresponding to each network port of the virtual machine and the control strategy aiming at the virtual machine to the controller component.
The first control policy acquired by the switch from the network management center is a control policy for the virtual machine, and the control policy packet may include at least one of the following control policies: the method comprises an access control strategy, a resource reservation strategy, a traffic priority strategy, a maximum traffic delay strategy, a maximum traffic packet loss rate strategy and a maximum traffic jitter strategy.
For example, an access control policy for a virtual machine may be defined as a denial of forwarding a packet sent to a virtual machine.
Certainly, the user may update the control policy of the virtual machine through the network management center, and at this time, the network management center may send the updated control policy to the switch; after the virtual machine is migrated, the MAC address of the virtual machine also changes correspondingly, and after the network management center acquires the migration information, the network management center may also actively send the updated MAC address to the switch.
Step 202, obtaining the MAC address of the virtual machine according to the virtual machine identifier in the first control policy.
After the network management center sends the virtual machine identifier of the virtual machine and the MAC address corresponding to the virtual machine identifier to the switch, the switch can store the virtual machine identifier and the virtual machine MAC address in a local database.
One virtual machine can have one or more network ports, each network port corresponds to one virtual MAC address, so that one virtual machine can have one or more virtual MAC addresses, and the switch can acquire the one or more MAC addresses from the network management center.
After the network management center receives the first control policy of the virtual machine, the switch extracts the virtual machine identifier of the virtual machine from the first control policy, and then queries the corresponding MAC address in the local database according to the virtual machine identifier.
Step 203, replacing the virtual machine identifier in the first control strategy with the MAC address of the virtual machine, so as to obtain a second control strategy.
If the virtual machine has only one network port, namely only one MAC address, the virtual machine identifier in the first control strategy aiming at the virtual machine is directly replaced by the MAC address, and then the second control strategy aiming at the MAC address can be obtained. If the virtual machine has a plurality of network ports, namely a plurality of MAC addresses MAC1, MAC2 and MAC3...... MACn, the virtual machine identifier in the first control strategy is replaced by MAC1, and then a second control strategy aiming at the MAC1 address can be obtained; replacing the virtual machine identifier in the first control strategy with MAC2 to obtain a second control strategy aiming at the MAC2 address; and after each MAC address in the n MAC addresses is used for replacing the virtual machine identifier in the first control strategy, the n second control strategies can be obtained.
For example, virtual machine 1 has only one portal, i.e., only one MAC address MAC1, and if the first control policy is to deny forwarding of all packets sent to virtual machine 1, the second control policy is to deny forwarding of all packets sent to MAC 1. If the virtual machine has a plurality of network ports, that is, a plurality of MAC addresses MAC1, MAC2, MAC3...... MACn, then if the first control policy is to refuse to forward all packets sent to the virtual machine 1, the second control policy is to refuse to forward all packets sent to the MAC1, MAC2, MAC3...... MACn.
After the control module in the switch converts the first control strategy for the virtual machine into the second control strategy for the MAC address, the second control strategy is sent to the switching module, so that the switching module processes the data packet originated from or sent to the MAC address according to the second control strategy.
Specifically, when the switching module receives a data packet with the MAC address as a destination address or a source address, the switching module may locally query a corresponding second control policy according to the source MAC address or the destination MAC address of the data packet, so as to perform corresponding processing on the data packet.
Of course, if the switch module determines that the local is not configured with the corresponding second control policy by local query after receiving the data packet with the MAC address as the destination address or the source address, the control module may issue the second control policy to the switch component. If the control module does not have a corresponding second control strategy, a first control strategy and a corresponding virtual machine MAC address corresponding to the second control strategy for the virtual machine can be obtained from the network management center, and the first control strategy is converted into the second control strategy and then is sent to the exchange module.
In an optional implementation manner of the embodiment of the present invention, after obtaining the second control policy, the method further includes: receiving an address change message aiming at the virtual machine, wherein the address change message carries an updated MAC address; and replacing the MAC address in the second control strategy by using the updated MAC address to obtain a third control strategy. Specifically, after the virtual machine is migrated, the MAC address of the virtual machine may also change correspondingly, and after the network management center acquires the migration information, the network management center may also actively send the updated MAC address to the switch through the address change message, and the switch may replace the MAC address in the stored second control policy with the updated MAC address to obtain the third control policy. If m updated MAC addresses exist, each MAC address in the m MAC addresses is used for replacing the original MAC address in the second control strategy, and then m third control strategies can be obtained.
Optionally, after the updated MAC address is obtained, a first control policy for the virtual machine may also be obtained from the network management center according to the virtual machine identifier corresponding to the MAC address, and each MAC address in the m MAC addresses is used to replace the virtual machine identifier in the first control policy, so that m second control policies may be obtained.
It should be noted here that, since the second control policy for the original MAC address is also converted from the first control policy for the corresponding virtual machine identifier, after the MAC address of the virtual machine is changed, the second control policy for the original MAC address can be deleted, so that on one hand, space can be saved, and on the other hand, it can be prevented that after the MAC address of the other virtual machine is changed to the original MAC address, an erroneous policy control is generated for the corresponding other virtual machine.
Correspondingly, after the second control strategy is obtained, the method further comprises the following steps: receiving a first update control policy for the virtual machine, wherein the first update control policy comprises the virtual machine identifier of the virtual machine; acquiring the MAC address corresponding to the virtual machine identifier, and replacing the virtual machine identifier in the first updating control strategy with the MAC address to obtain a second updating control strategy; replacing the second control strategy with the second updated control strategy. Specifically, if the user updates the control policy for the virtual machine through the network management center, the network management center may send the updated control policy to the switch, and after receiving the updated control policy, the switch may convert the updated control policy into the control policy for the corresponding MAC address, and replace the second control policy saved before with the updated control policy for the MAC address, thereby implementing configuration of the dynamic control policy.
In the embodiment of the invention, a switch acquires a first control strategy aiming at a virtual machine from a network management center; acquiring the MAC address of the virtual machine according to the virtual machine identifier in the first control strategy; and replacing the virtual machine identifier in the first control strategy by using the MAC address of the virtual machine to obtain a second control strategy. Therefore, the embodiment of the invention realizes the configuration and management of the control strategy at the MAC address level, solves the problems of high requirement on equipment and high cost of a method for configuring the control strategy of the virtual machine by using the VN-tag technology in the prior art, saves a large amount of economic cost and ensures that the strategy control at the virtual machine level is easier to realize.
It should be noted that, if the network interface adaptation module (physical network card) of the physical host where the virtual machine is located supports the hybrid mode (PromiscuousMode), the operating state of the physical network card needs to be set to the hybrid mode. In the mixed mode, the physical network card cannot modify the source MAC address of the transmitted data packet, so that the source MAC address of the data packet transmitted by the virtual network port of the virtual machine cannot be changed; and when receiving the data packet sent to the network card, the filtering operation will not be performed on the target MAC address. If the physical network card of the switch does not support the mixed mode, the function of the physical network card needs to be upgraded, so that the source MAC address is not modified when the physical network card forwards the data packet from the virtual machine, and the target MAC address is not filtered when the data packet sent to the network card is received.
Correspondingly, the embodiment of the invention also provides a switch, which can be an OpenFlow switch. Fig. 3 is a schematic diagram of a switch according to an embodiment of the present invention, and as shown in fig. 3, the switch includes a control module 310, where the control module 310 includes a receiving submodule 311, an obtaining submodule 312, and a transforming submodule 313; the switch also includes a switching module 320. Wherein the switching module 320 and the control module 310 may be connected through an interface. For example, for an OpenFlow switch, the control module 310 and the switch module 320 may be connected through an OpenFlow interface. Wherein,
the receiving submodule 311 is configured to receive a first control policy for the virtual machine.
The receiving submodule 312 is further configured to receive the virtual machine identifier and N MAC addresses corresponding to the virtual machine identifier, where N is greater than or equal to 1.
The first control policy acquired by the switch from the network management center is a control policy for the virtual machine, and the control policy packet may include at least one of the following control policies: the method comprises an access control strategy, a resource reservation strategy, a traffic priority strategy, a maximum traffic delay strategy, a maximum traffic packet loss rate strategy and a maximum traffic jitter strategy.
For example, an access control policy for a virtual machine may be defined as a denial of forwarding a packet sent to a virtual machine.
The obtaining submodule 312 is configured to obtain the MAC address of the virtual machine according to the virtual machine identifier in the first control policy.
After the network management center sends the virtual machine identifier of the virtual machine and the MAC address corresponding to the virtual machine identifier to the switch, the switch can store the virtual machine identifier and the virtual machine MAC address in a local database.
One virtual machine can have one or more network ports, each network port corresponds to one virtual MAC address, so that one virtual machine can have one or more virtual MAC addresses, and the switch can acquire the one or more MAC addresses from the network management center.
After the network management center receives the first control policy of the virtual machine, the switch extracts the virtual machine identifier of the virtual machine from the first control policy, and then queries the corresponding MAC address in the local database according to the virtual machine identifier.
And the conversion module 313 is configured to replace the virtual machine identifier in the first control policy with the MAC address of the virtual machine to obtain a second control policy.
The conversion module 313 is specifically configured to replace the virtual machine identifier in the first control policy one by one with the N MAC addresses to obtain N second control policies, where the N second control policies correspond to the N MAC addresses one to one.
If the virtual machine has only one network port, namely only one MAC address, the virtual machine identifier in the first control strategy aiming at the virtual machine is directly replaced by the MAC address, and then the second control strategy aiming at the MAC address can be obtained. If the virtual machine has a plurality of network ports, namely a plurality of MAC addresses MAC1, MAC2 and MAC3...... MACn, the virtual machine identifier in the first control strategy is replaced by MAC1, and then a second control strategy aiming at the MAC1 address can be obtained; replacing the virtual machine identifier in the first control strategy with MAC2 to obtain a second control strategy aiming at the MAC2 address; and after each MAC address in the n MAC addresses is used for replacing the virtual machine identifier in the first control strategy, the n second control strategies can be obtained.
After the control module 310 in the switch converts the first control policy for the virtual machine into the second control policy for the MAC address, the second control policy is sent to the switching module, so that the switching module 320 processes the data packet originated from or sent to the MAC address according to the second control policy.
The switching module 320 is configured to receive the second control policy from the control module, and perform forwarding or forwarding rejection processing on the received data packet with the MAC address as a destination address or a source address according to the second control policy.
Of course, if the switching module 320 determines that the local is not configured with the corresponding second control policy by local query after receiving the data packet with the MAC address as the destination address or the source address, the control module 310 may issue the second control policy to the switching module 320. If the control module 310 does not have a corresponding second control policy, a first control policy and a corresponding virtual machine MAC address for the virtual machine corresponding to the second control policy may be obtained from the network management center, and the first control policy is converted into the second control policy and then sent to the switching module 320.
Preferably, when the address of the virtual machine is changed, the receiving submodule 311 is further configured to receive an address change message for the virtual machine, where the address change message carries an updated MAC address; the conversion module 313 is further configured to replace the MAC address in the second control strategy with the updated MAC address to obtain a third control strategy. Specifically, after the virtual machine is migrated, the MAC address of the virtual machine may also change correspondingly, and after the network management center acquires the migration information, the network management center may also actively send the updated MAC address to the switch through the address change message, and the switch may replace the MAC address in the stored second control policy with the updated MAC address to obtain the third control policy. If m updated MAC addresses exist, each MAC address in the m MAC addresses is used for replacing the original MAC address in the second control strategy, and then m third control strategies can be obtained.
Optionally, after the updated MAC address is obtained, a first control policy for the virtual machine may also be obtained from the network management center according to the virtual machine identifier corresponding to the MAC address, and each MAC address in the m MAC addresses is used to replace the virtual machine identifier in the first control policy, so that m second control policies may be obtained.
It should be noted here that, since the second control policy for the original MAC address is also converted from the first control policy for the corresponding virtual machine identifier, after the MAC address of the virtual machine is changed, the second control policy for the original MAC address can be deleted, so that on one hand, space can be saved, and on the other hand, it can be prevented that after the MAC address of the other virtual machine is changed to the original MAC address, an erroneous policy control is generated for the corresponding other virtual machine.
Preferably, the switch further includes a replacement submodule 314, and after a control policy for a virtual machine is changed, the reception submodule 311 is further configured to receive a first update control policy for the virtual machine, where the first update control policy includes the virtual machine identifier of the virtual machine; the conversion module 313 is further configured to obtain the MAC address corresponding to the virtual machine identifier, and replace the virtual machine identifier in the first update control policy with the MAC address to obtain a second update control policy; a replacement sub-module 314 for replacing the second control strategy with the second updated control strategy. Specifically, if the user updates the control policy for the virtual machine through the network management center, the network management center may send the updated control policy to the switch, and after receiving the updated control policy, the switch may convert the updated control policy into the control policy for the corresponding MAC address, and replace the second control policy saved before with the updated control policy for the MAC address, thereby implementing configuration of the dynamic control policy.
Therefore, the embodiment of the invention realizes the configuration and management of the control strategy at the MAC address level, solves the problems of high requirement on equipment and high cost of a method for configuring the control strategy of the virtual machine by using the VN-tag technology in the prior art, saves a large amount of economic cost and ensures that the strategy control at the virtual machine level is easier to realize.
Correspondingly, an embodiment of the present invention further provides a switch, and fig. 4 is a schematic diagram of another switch provided in the embodiment of the present invention. As shown in fig. 4, the switch provided in the present embodiment includes a network interface 401, a processor 402, and a memory 403. The system bus 404 is used to connect the network interface 401, the processor 402, and the memory 403.
The network interface 401 may be used to communicate with a network management center and the physical host where the virtual machine resides, respectively.
The memory 403 may be a permanent memory, such as a hard disk drive and a flash memory, and the memory 403 may have a software module and a device driver therein, and may also hold a database for storing control policies. The software module can execute various functional modules of the method; the device drivers may be network and interface drivers.
At startup, these software components are loaded into memory 403 and then accessed by processor 402 and executed by the following instructions:
receiving a first control strategy aiming at a virtual machine;
acquiring the MAC address of the virtual machine according to the virtual machine identifier in the first control strategy;
and replacing the virtual machine identifier in the first control strategy by using the MAC address of the virtual machine to obtain a second control strategy.
Wherein the first control strategy comprises at least one of the following control strategies: the method comprises an access control strategy, a resource reservation strategy, a traffic priority strategy, a maximum traffic delay strategy, a maximum traffic packet loss rate strategy and a maximum traffic jitter strategy.
After the network management center sends the virtual machine identifier of the virtual machine and the MAC address corresponding to the virtual machine identifier to the switch, the switch can store the virtual machine identifier and the virtual machine MAC address in a local database.
One virtual machine can have one or more network ports, each network port corresponds to one virtual MAC address, so that one virtual machine can have one or more virtual MAC addresses, and the switch can acquire the one or more MAC addresses from the network management center.
After the network management center receives the first control policy of the virtual machine, the switch extracts the virtual machine identifier of the virtual machine from the first control policy, and then queries the corresponding MAC address in the local database according to the virtual machine identifier.
Further, after obtaining the second control strategy, the processor 402 accesses the software component of the memory 403 to execute the following steps:
receiving an address change message aiming at the virtual machine, wherein the address change message carries an updated MAC address;
and replacing the MAC address in the second control strategy by using the updated MAC address to obtain a third control strategy.
Specifically, after the virtual machine is migrated, the MAC address of the virtual machine may also change correspondingly, and after the network management center acquires the migration information, the network management center may also actively send the updated MAC address to the switch through the address change message, and the switch may replace the MAC address in the stored second control policy with the updated MAC address to obtain the third control policy. If m updated MAC addresses exist, each MAC address in the m MAC addresses is used for replacing the original MAC address in the second control strategy, and then m third control strategies can be obtained.
Optionally, after the updated MAC address is obtained, a first control policy for the virtual machine may also be obtained from the network management center according to the virtual machine identifier corresponding to the MAC address, and each MAC address in the m MAC addresses is used to replace the virtual machine identifier in the first control policy, so that m second control policies may be obtained.
It should be noted here that, since the second control policy for the original MAC address is also converted from the first control policy for the corresponding virtual machine identifier, after the MAC address of the virtual machine is changed, the second control policy for the original MAC address can be deleted, so that on one hand, space can be saved, and on the other hand, it can be prevented that after the MAC address of the other virtual machine is changed to the original MAC address, an erroneous policy control is generated for the corresponding other virtual machine.
Further, after obtaining the second control strategy, the processor 402 accesses the software component of the memory 403 to execute the following steps:
receiving a first update control policy for the virtual machine, wherein the first update control policy comprises the virtual machine identifier of the virtual machine;
acquiring the MAC address corresponding to the virtual machine identifier, and replacing the virtual machine identifier in the first updating control strategy with the MAC address to obtain a second updating control strategy;
replacing the second control strategy with the second updated control strategy.
Specifically, if the user updates the control policy for the virtual machine through the network management center, the network management center may send the updated control policy to the switch, and after receiving the updated control policy, the switch may convert the updated control policy into the control policy for the corresponding MAC address, and replace the second control policy saved before with the updated control policy for the MAC address, thereby implementing configuration of the dynamic control policy.
Further, before said querying the MAC address of the virtual machine according to the virtual machine identifier in the first control policy, after the processor 402 accesses the software component of the memory 403, the following process is performed: and receiving the virtual machine identification and N MAC addresses corresponding to the virtual machine identification, wherein N is greater than or equal to 1.
The process of the processor 402 executing the virtual machine identifier in the first control policy replaced with the MAC address of the virtual machine to obtain the second control policy specifically includes: and replacing the virtual machine identification in the first control strategy one by using the N MAC addresses to obtain N second control strategies, wherein the N second control strategies are respectively in one-to-one correspondence with the N MAC addresses.
Further, after the switch receives the data packet through the network interface 401, the processor 402 accesses the software component of the memory 403 to execute the following procedures: and processing the received data packet with the MAC address as a destination address or a source address according to the second control strategy. Specifically, receiving a data packet with the MAC address as a destination address or a source address; and forwarding the data packet or refusing to forward the data packet according to the second control strategy.
Therefore, the embodiment of the invention realizes the configuration and management of the control strategy at the MAC address level, solves the problems of high requirement on equipment and high cost of a method for configuring the control strategy of the virtual machine by using the VN-tag technology in the prior art, saves a large amount of economic cost and ensures that the strategy control at the virtual machine level is easier to realize.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.