CN103685587A - Method and device for assigning MAC (Media Access Control) address - Google Patents

Method and device for assigning MAC (Media Access Control) address Download PDF

Info

Publication number
CN103685587A
CN103685587A CN201210330182.XA CN201210330182A CN103685587A CN 103685587 A CN103685587 A CN 103685587A CN 201210330182 A CN201210330182 A CN 201210330182A CN 103685587 A CN103685587 A CN 103685587A
Authority
CN
China
Prior art keywords
port
mark
mac address
physical machine
binary digit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201210330182.XA
Other languages
Chinese (zh)
Other versions
CN103685587B (en
Inventor
丘子隽
邱谆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Tencent Computer Systems Co Ltd
Original Assignee
Shenzhen Tencent Computer Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Tencent Computer Systems Co Ltd filed Critical Shenzhen Tencent Computer Systems Co Ltd
Priority to CN201210330182.XA priority Critical patent/CN103685587B/en
Publication of CN103685587A publication Critical patent/CN103685587A/en
Application granted granted Critical
Publication of CN103685587B publication Critical patent/CN103685587B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a method and device for assigning an MAC (Media Access Control) address and belongs to the field of computer network technologies. The method comprises the following steps: acquiring the network topological information of terminal equipment, wherein the network topological information comprises the logo of a switch connected with the terminal equipment and the logo of the port, for connecting the switch to the terminal equipment, of the switch; generating an MAC address for the terminal equipment, wherein the MAC address at least comprises the logos of both the switch and the port. Therefore, the MAC address of the terminal equipment comprises the network topological information such as the logos of both the switch and the port, and has a structure with certain hierarchy.

Description

Method and the device of allocation medium access control MAC address
Technical field
The present invention relates to technical field of the computer network, particularly method and the device of a kind of allocation medium access control MAC address.
Background technology
In local area network (LAN), adopting the MAC(Media Access Control of 6 bytes (48 binary digits), media access control) address carrys out the terminal equipment in unique identification network.At present, the MAC Address of 6 bytes is divided into two parts in equal size, specifically comprises producer's unique identification of 3 bytes and the network interface of 3 bytes sign.
Prior art carrys out to distribute for terminal equipment the MAC Address of above-mentioned form in the following way: the producer's unique identification in MAC Address is conventionally used producer's sign of NIC manufacturer or uses producer's sign of the network interface manufacturer of physical machine, and the network interface sign in MAC Address generates at random according to some Generating Random Numbers.
In realizing process of the present invention, inventor finds that prior art at least exists following problem: 1, " the producer's unique identification " in MAC Address and " network interface sign " two random numbers for not conflicting, do not have unified rule; 2, existing distributed MAC Address only comprises " producer's unique identification " and " network interface sign ", cannot embody the network topological information of terminal equipment.
Summary of the invention
In order to solve the problem of prior art, the embodiment of the present invention provides method and the device of a kind of allocation medium access control MAC address.Described technical scheme is as follows:
On the one hand, the invention provides the method for a kind of media access control MAC address, described method comprises:
Obtain the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that described terminal equipment connects and described switch are for connecting the port-mark of the port of described terminal equipment;
For described terminal equipment generates the MAC Address that at least comprises described switch identification and described port-mark.
The described network topological information that obtains terminal equipment comprises:
Receive the first message that switch that described terminal equipment connects sends, described the first message at least comprises that the MAC Address of described switch and described switch are for connecting the port-mark of the port of described terminal equipment;
Switch identification using the binary digit of predetermined number continuous in the MAC Address of described switch as described switch.
Described the first message at least comprises the proprietary protocol message of Neighbor Discovery Protocol NDP message, Link Layer Discovery Protocol LLDP message, neighbours' Topology Discovery Protocol NTDP message or user-defined format.
Described is that described terminal equipment generation at least comprises that the MAC Address of described switch identification and described port-mark comprises:
When described terminal equipment is physical machine, and described physical machine has not been while having created virtual machine, described switch identification and described port-mark is spliced into the media access control MAC address of described physical machine;
When described terminal equipment is physical machine, and described physical machine creates while having virtual machine, for described physical machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described physical machine;
When described terminal equipment be physical machine create virtual machine time, be described virtual machine designated terminal sign, and described switch identification, described port-mark and described terminal iidentification be spliced into the media access control MAC address of described virtual machine.
The described media access control MAC address that described switch identification and described port-mark are spliced into described physical machine comprises:
The described switch identification that statistics is represented by binary digit and the binary digit of described port-mark sum;
Determine whether the binary digit sum counting on is less than 48;
When counted on binary digit sum is less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
When counted on binary digit sum equals 48, described switch identification and described port-mark are spliced into the MAC Address of 48 binary digits of described physical machine.
The described media access control MAC address that described switch identification, described port-mark and described terminal iidentification are spliced into described physical machine comprises:
The binary digit sum of the described switch identification that statistics is represented by binary digit, described port-mark and described terminal iidentification;
Determine whether the binary digit sum counting on is less than 48;
When the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
When counted on binary digit sum equals 48, described switch identification, described port-mark and described terminal iidentification are spliced into the MAC Address of 48 binary digits of described physical machine.
The described media access control MAC address that described switch identification, described port-mark and described terminal iidentification are spliced into described virtual machine comprises:
The binary digit sum of the described switch identification that statistics is represented by binary digit, described port-mark and described terminal iidentification;
Determine whether the binary digit sum counting on is less than 48;
When the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described virtual machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described virtual machine;
When counted on binary digit sum equals 48, described switch identification, described port-mark and described terminal iidentification are spliced into the MAC Address of 48 binary digits of described virtual machine.
On the other hand, provide the device of a kind of allocation medium access control MAC address, described device comprises: acquisition module, address generation module;
Described acquisition module, for obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that described terminal equipment connects and described switch are for connecting the port-mark of the port of described terminal equipment;
Described address generation module, is used to described terminal equipment to generate the MAC Address that at least comprises described switch identification and described port-mark.
Described acquisition module comprises:
Receiving element, the first message sending for receiving switch that described terminal equipment connects, described the first message at least comprises that the MAC Address of described switch and described switch are for connecting the port-mark of the port of described terminal equipment;
Acquiring unit, for the switch identification using the binary digit of the continuous predetermined number of the MAC Address of described switch as described switch.
Described address generation module comprises:
The first allocation units, for being physical machine when described terminal equipment, and described physical machine has not been while having created virtual machine, described switch identification and described port-mark is spliced into the media access control MAC address of described physical machine;
The second allocation units, for working as described terminal equipment, it is physical machine, and described physical machine creates while having virtual machine, be described physical machine designated terminal sign, and described switch identification, described port-mark and described terminal iidentification be spliced into the media access control MAC address of described physical machine;
The 3rd allocation units, for when described terminal equipment be physical machine create virtual machine time, for described virtual machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described virtual machine.
Described the first allocation units comprise:
Statistics subelement, for adding up the binary digit sum of the described switch identification that represented by binary digit and described port-mark;
Determine subelement, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement, for working as counted on binary digit sum while being less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
Second distributes subelement, for working as counted on binary digit sum while equaling 48, described switch identification and described port-mark is spliced into the MAC Address of 48 binary digits of described physical machine.
Described the second allocation units comprise:
Statistics subelement, for adding up the binary digit sum of the described switch identification being represented by binary digit, described port-mark and described terminal iidentification;
Determine subelement, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement, for when the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
Second distributes subelement, for working as counted on binary digit sum while equaling 48, described switch identification, described port-mark and described terminal iidentification is spliced into the MAC Address of 48 binary digits of described physical machine.
Described the 3rd allocation units comprise:
Statistic unit, for adding up the binary digit sum of the described switch identification being represented by binary digit, described port-mark and described terminal iidentification;
Determining unit, for determining whether the binary digit sum counting on is less than 48;
The first allocation units, for when the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described virtual machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described virtual machine;
The second allocation units, for working as counted on binary digit sum while equaling 48, are spliced into described switch identification, described port-mark and described terminal iidentification the MAC Address of 48 binary digits of described virtual machine.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is: by obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that terminal equipment connects and described switch are for connecting the port-mark of the port of terminal equipment, for described terminal equipment generates the realization of the technical scheme of the MAC Address that at least comprises described switch identification and described port-mark, make the MAC Address of terminal equipment include the network topological informations such as switch identification and port-mark, and have certain hierarchical structure.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing of required use during embodiment is described is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skills, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the method flow schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention one;
Fig. 2 a is a kind of network architecture schematic diagram that the embodiment of the present invention two provides;
Fig. 2 b is a kind of network architecture schematic diagram that the embodiment of the present invention two provides;
Fig. 3 is the method flow schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention two;
Fig. 4 a is the exemplary plot of the MAC Address of a kind of physical machine that comprises switch identification, port-mark and extend information that the embodiment of the present invention two provides;
Fig. 4 b is the exemplary plot of the MAC Address of a kind of virtual machine that comprises switch identification, port-mark, terminal iidentification extend information that the embodiment of the present invention two provides;
Fig. 5 is the apparatus structure schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention three;
Fig. 6 is the apparatus structure schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention three;
Fig. 7 is the apparatus structure schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention three;
Fig. 8 is the apparatus structure schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention three;
Fig. 9 is the apparatus structure schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention three;
Figure 10 is the apparatus structure schematic diagram of a kind of allocation medium access control MAC address of providing of the embodiment of the present invention three.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment mono-
Referring to Fig. 1, the method for a kind of allocation medium access control MAC address, described method comprises:
Step 101: obtain the network topological information of terminal equipment, described network topological information comprises that the switch identification of the switch that described terminal equipment connects and described switch are for connecting the port-mark of the port of described terminal equipment;
Step 102: for described terminal equipment generates the MAC Address that at least comprises described switch identification and described port-mark;
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is: by obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of the switch that terminal equipment connects and described switch are for connecting the port-mark of the port of terminal equipment, for described terminal equipment generates the realization of the technical scheme of the MAC Address that at least comprises described switch identification and described port-mark, make the MAC Address of terminal equipment include the network topological informations such as switch identification and port-mark, and have certain hierarchical structure.
Embodiment bis-
Referring to Fig. 2 a, the instance graph of a kind of network architecture providing for the embodiment of the present invention, specifically comprise machine top access switch TOR(Top of Rack) 201, a plurality of physical machine that are connected with TOR201 (here, physical machine also can be called " Physical Machine " or " physical server ") 202, here, there are a plurality of ports in TOR, different physical machine is connected on described TOR by the different port of TOR, in the embodiment of the present invention, switch just can identify for connecting the port-mark of the port of terminal equipment the different physical machine connecting on same switch,
Further, referring to Fig. 2 b, physical machine 202 in the network architecture as shown in Figure 2 a can also generate a plurality of virtual machines 203, here, physical machine creates a plurality of virtual ports, the different virtual port that different virtual machines creates by physical machine accesses described physical machine, described physical machine can also be sequentially that connected virtual machine and described physical machine specified corresponding numbering according to the establishment of virtual machine, in the embodiment of the present invention, specified numbering can be used as the terminal iidentification of described virtual machine or described physical machine, for identifying different virtual machines and the described physical machine connecting on Same Physical machine, and the mode of Physics machine generating virtual machines can be referring to prior art.
TOR in the above network architecture, physical machine and virtual machine are by MAC(Media Access Control, media access control) address identifies, wherein, the MAC Address of TOR can be when building above-mentioned network, by artificially configuring, the device of the distribution MAC that the MAC Address of physical machine and virtual machine can be provided by the embodiment of the present invention generates automatically, and the MAC Address described in the embodiment of the present invention still adopts 48 binary digit structures.Wherein, the device of the distribution MAC Address described in the embodiment of the present invention specifically can be built in physical machine and realize.
In the embodiment of the present invention, switch in network can be identified by switch identification, and can be known by above description, physical machine is the different port of access switch, so, in the MAC Address that physical machine is distributed if, include the switch identification of this physical machine access switch and this switch for connecting the port-mark of the port of this physical machine, this MAC Address just can unique identification be connected in the different physical machine of same switch; And can be known by above description, the different virtual machine that physical machine creates can be identified by terminal iidentification, so, if distribute the device of MAC Address be in the virtual machine MAC Address of distributing except above-mentioned for identifying the switch identification and port-mark of physical machine, add terminal iidentification and just can distinguish the different virtual machine on Same Physical machine.
In the embodiment of the present invention, above-described switch identification, port-mark and terminal iidentification all have the binary digit of predetermined number to represent.
Describe in conjunction with specific embodiments that to distribute the device of MAC Address be how for physical machine and virtual machine distribute MAC Address below in detail, referring to Fig. 3, the embodiment of the present invention provides a kind of method of distributing MAC Address, can comprise following operation:
Step 301: distribute the device of MAC Address to obtain the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that terminal equipment connects and this switch are for connecting the port-mark of the port of this terminal equipment;
The embodiment of the present invention is when specific implementation, and the network topological information that the device of distribution MAC Address obtains terminal equipment can comprise:
The first message that switch that receiving terminal apparatus connects sends, described the first message is drawn together the MAC Address of described switch and described switch for connecting the port-mark of the port of described terminal equipment;
In the embodiment of the present invention, described the first message may operate in the IEEE(Institute of Electrical and Electronics Engineers that comprises network as shown in Fig. 2 a and 2b, IEEE-USA) in 802 defined networks, for the relevant information of neighbor node (as the switch in the embodiment of the present invention) in node (as the physical machine in the embodiment of the present invention) discovering network of network (MAC Address of switch and switch are for connecting the port-mark etc. of the port of terminal equipment described in the embodiment of the present invention), can include but not limited to NDP(Neighbor Discovery Protocol, Neighbor Discovery Protocol) message, LLDP(Link Layer Discovery Protocol, Link Layer Discovery Protocol) message, NTDP(Neighbor Topology Discovery Protocol, neighbours' Topology Discovery Protocol) the proprietary protocol message of message or user-defined format.
After getting the MAC Address of the switch that terminal equipment connects, the switch identification using the binary digit of predetermined number continuous in accessed MAC Address as switch that terminal equipment connects;
When specific implementation, distribute the device of MAC Address can determine according to network size the number of the binary digit of getting in obtained MAC Address, for example, switch number in network in 1024 time, can start to get continuously 10 binary digits as the switch identification of switch that described terminal equipment connects in the optional position from obtained MAC Address.
Afterwards just can be for described terminal equipment generates the MAC Address that at least comprise described switch identification and described port-mark, specific implementation can the description to 304 referring to step 302.
Step 302: when described terminal equipment is physical machine, and this physical machine is not while having created virtual machine, distributes the device of MAC Address described switch identification and described port-mark to be spliced into the media access control MAC address of described physical machine;
The embodiment of the present invention is when specific implementation, and the described switch identification that the device statistics of distribution MAC Address is represented by binary digit and the binary digit of described port-mark are total;
Determine whether the binary digit sum counting on is less than 48;
When counted on binary digit sum is less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
The embodiment of the present invention does not limit the splicing order of described switch identification, described port-mark and described extend information, when specific implementation, can splice according to the order of switch identification, port-mark and extend information, also can splice according to the order of switch identification, extend information machine port-mark, etc.
When counted on binary digit sum equals 48, described switch identification and described port-mark are spliced into the MAC Address of 48 binary digits of described physical machine.
The embodiment of the present invention does not limit the splicing order of described switch identification and described port-mark, when specific implementation, can, according to the order splicing of switch identification and port-mark, can splice according to the order of port-mark and switch identification yet.
The generative process that first illustrates the MAC Address of above-mentioned physical machine is as follows:
When described switch identification is represented by 12 binary digits, when described port-mark is represented by 8 binary digits, after being spliced, described switch identification and described port-mark have 20 binary digits, and 48 bit format that MAC Address adopts, therefore specify the extend information by 28 binary digit signs here, afterwards, described switch identification, port-mark and extend information are spliced into the MAC Address of physical machine, Fig. 4 b has provided a kind of MAC Address of the physical machine that comprises switch identification, port-mark and extend information.
Step 303: when described terminal equipment is physical machine, and described physical machine creates while having virtual machine, for described physical machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described physical machine;
The embodiment of the present invention is when specific implementation, and the described switch identification that the device statistics of distribution MAC Address is represented by binary digit and the binary digit of described port-mark are total;
Determine whether the binary digit sum counting on is less than 48;
When counted on binary digit sum is less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
When counted on binary digit sum equals 48, described switch identification and described port-mark are spliced into the MAC Address of 48 binary digits of described physical machine.
Step 304: when described terminal equipment is the virtual machine in physical machine, the device that distributes MAC Address is described virtual machine designated terminal sign, and described switch identification, described port-mark and described terminal iidentification is spliced into the media access control MAC address of described virtual machine.
The embodiment of the present invention is when specific implementation, and the binary digit of described switch identification, described port-mark and described terminal iidentification that statistics is represented by binary digit is total;
Determine whether the binary digit sum counting on is less than 48;
When the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described virtual machine, described extend information comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described virtual machine;
The embodiment of the present invention does not limit the splicing order of described switch identification, described port-mark, described terminal iidentification and described extend information, when specific implementation, can splice according to the order of switch identification, port-mark, terminal iidentification and extend information, also can splice according to the order of switch identification, port-mark, extend information machine terminal iidentification, etc.
When counted on binary digit sum equals 48, described switch identification, described port-mark and described terminal iidentification are spliced into the MAC Address of 48 binary digits of described virtual machine, the embodiment of the present invention does not limit the splicing order of described switch identification, described port-mark and described terminal iidentification.
The embodiment of the present invention does not limit the splicing order of described switch identification, described port-mark and described terminal iidentification, when specific implementation, can splice according to the order of switch identification, port-mark and terminal iidentification, also can be according to splicing according to the order of port-mark, switch identification and terminal iidentification, etc.
The process that now illustrates the MAC Address that generates above-mentioned virtual machine is as follows:
When described switch identification is represented by 10 binary digits, described port-mark is represented by 6 binary digits, when described terminal iidentification is represented by 8 binary digits, by described switch identification, after splicing, port-mark and terminal iidentification have 24 binary digits, and 48 bit format that MAC Address adopts, therefore specify the extend information by 24 binary digit signs here, afterwards, by described switch identification, port-mark, terminal iidentification and extend information are spliced into the MAC Address of virtual machine, Fig. 4 b has provided a kind of switch identification that comprises, port-mark, the MAC Address of the virtual machine of terminal iidentification and extend information.
In the embodiment of the present invention, above-described extend information, except can comprising that tenant identifies, can also comprise the optional informations such as effective time or the self-defined information of address.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is: by obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that terminal equipment connects and described switch are for connecting the port-mark of the port of terminal equipment, for described terminal equipment generates the realization of the technical scheme of the MAC Address that at least comprises described switch identification and described port-mark, make the MAC Address of terminal equipment include the network topological informations such as switch identification and port-mark, and have certain hierarchical structure.
Embodiment tri-
Referring to Fig. 5, the embodiment of the present invention provides the device of a kind of allocation medium access control MAC address, and this device is concrete identical with the device of the described distribution MAC Address of embodiment of the method, can comprise: acquisition module 401, address generation module 402;
Acquisition module 401, for obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that described terminal equipment connects and described switch are for connecting the port-mark of the port of described terminal equipment;
Address generation module 402, is used to described terminal equipment to generate the MAC Address that at least comprises described switch identification and described port-mark.
Further, referring to Fig. 6, embodiment of the present invention acquisition module 401 as shown in Figure 5 can comprise:
Receiving element 4011, the first message sending for receiving switch that described terminal equipment connects, described the first message at least comprises that the MAC Address of described switch and described switch are for connecting the port-mark of the port of described terminal equipment;
Acquiring unit 4012, for the switch identification using the binary digit of the continuous predetermined number of the MAC Address of described switch as described switch.
Wherein, described the first message at least comprises the proprietary protocol message of Neighbor Discovery Protocol NDP message, Link Layer Discovery Protocol LLDP message, neighbours' Topology Discovery Protocol NTDP message or user-defined format.
Further, referring to Fig. 7, embodiment of the present invention address assignment module 402 as shown in Figure 5 can comprise:
The first allocation units 4021, for being physical machine when described terminal equipment, and described physical machine has not been while having created virtual machine, described switch identification and described port-mark is spliced into the media access control MAC address of described physical machine;
The second allocation units 4022, for working as described terminal equipment, it is physical machine, and described physical machine creates while having virtual machine, for described physical machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described physical machine;
The 3rd allocation units 4023, for when described terminal equipment be physical machine create virtual machine time, for described virtual machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described virtual machine.
Closer, referring to Fig. 8, as shown in Figure 7 particularly, the first allocation units 4021 can comprise the embodiment of the present invention:
Statistics subelement 4021A, for adding up the described switch identification that represented by binary digit and the binary digit sum of described port-mark;
Determine subelement 4021B, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement 4021C, for working as counted on binary digit sum while being less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
The second allocation units 4021D, for working as counted on binary digit sum while equaling 48, is spliced into described switch identification and described port-mark the MAC Address of 48 binary digits of described physical machine.
Further, referring to Fig. 9, the embodiment of the present invention the second allocation units 4022 as shown in Figure 7 can comprise:
Statistics subelement 4022A, for adding up the binary digit sum of the described switch identification being represented by binary digit, described port-mark and described terminal iidentification;
Determine subelement 4022B, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement 4022C, for when the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
Second distributes subelement 4022D, for working as counted on binary digit sum while equaling 48, described switch identification, described port-mark and described terminal iidentification is spliced into the MAC Address of 48 binary digits of described physical machine.
Further, referring to Figure 10, the embodiment of the present invention the 3rd allocation units 4023 as shown in Figure 7 can comprise:
Statistics subelement 4023A, for adding up the binary digit sum of the described switch identification being represented by binary digit, described port-mark and described terminal iidentification;
Determine subelement 4023B, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement 4023C, for when the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described virtual machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described virtual machine;
Second distributes subelement 4023D, for working as counted on binary digit sum while equaling 48, described switch identification, described port-mark and described terminal iidentification is spliced into the MAC Address of 48 binary digits of described virtual machine.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is: by obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that terminal equipment connects and described switch are for connecting the port-mark of the port of terminal equipment; When terminal equipment is physical machine, described switch identification and described port-mark are spliced into the media access control MAC address of described physical machine, for described terminal equipment generates the realization of the technical scheme of the MAC Address that at least comprises described switch identification and described port-mark, make the MAC Address of terminal equipment include the network topological informations such as switch identification and port-mark, and have certain hierarchical structure.
It should be noted that: the device of the allocation medium access control MAC address that above-described embodiment provides is when allocation medium access control MAC address, only the division with above-mentioned each functional module is illustrated, in practical application, can above-mentioned functions be distributed and by different functional modules, completed as required, the internal structure that is about to device is divided into different functional modules, to complete all or part of function described above.In addition, the device of the allocation medium access control MAC address that above-described embodiment provides and the embodiment of the method for allocation medium access control MAC address belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step that realizes above-described embodiment can complete by hardware, also can come the hardware that instruction is relevant to complete by program, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be read-only memory, disk or CD etc.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (13)

1. a method for allocation medium access control MAC address, is characterized in that, described method comprises:
Obtain the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that described terminal equipment connects and described switch are for connecting the port-mark of the port of described terminal equipment;
For described terminal equipment generates the MAC Address that at least comprises described switch identification and described port-mark.
2. method according to claim 1, is characterized in that, described in obtain terminal equipment network topological information comprise:
Receive the first message that switch that described terminal equipment connects sends, described the first message at least comprises that the MAC Address of described switch and described switch are for connecting the port-mark of the port of described terminal equipment;
Switch identification using the binary digit of predetermined number continuous in the MAC Address of described switch as described switch.
3. method according to claim 2, is characterized in that, described the first message at least comprises the proprietary protocol message of Neighbor Discovery Protocol NDP message, Link Layer Discovery Protocol LLDP message, neighbours' Topology Discovery Protocol NTDP message or user-defined format.
4. method according to claim 1, is characterized in that, described is that described terminal equipment generation at least comprises that the MAC Address of described switch identification and described port-mark comprises:
When described terminal equipment is physical machine, and described physical machine has not been while having created virtual machine, described switch identification and described port-mark is spliced into the media access control MAC address of described physical machine;
When described terminal equipment is physical machine, and described physical machine creates while having virtual machine, for described physical machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described physical machine;
When described terminal equipment be physical machine create virtual machine time, be described virtual machine designated terminal sign, and described switch identification, described port-mark and described terminal iidentification be spliced into the media access control MAC address of described virtual machine.
5. method according to claim 4, is characterized in that, the described media access control MAC address that described switch identification and described port-mark are spliced into described physical machine comprises:
The described switch identification that statistics is represented by binary digit and the binary digit of described port-mark sum;
Determine whether the binary digit sum counting on is less than 48;
When counted on binary digit sum is less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
When counted on binary digit sum equals 48, described switch identification and described port-mark are spliced into the MAC Address of 48 binary digits of described physical machine.
6. method according to claim 4, is characterized in that, the described media access control MAC address that described switch identification, described port-mark and described terminal iidentification are spliced into described physical machine comprises:
The binary digit sum of the described switch identification that statistics is represented by binary digit, described port-mark and described terminal iidentification;
Determine whether the binary digit sum counting on is less than 48;
When the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
When counted on binary digit sum equals 48, described switch identification, described port-mark and described terminal iidentification are spliced into the MAC Address of 48 binary digits of described physical machine.
7. method according to claim 4, is characterized in that, the described media access control MAC address that described switch identification, described port-mark and described terminal iidentification are spliced into described virtual machine comprises:
The binary digit sum of the described switch identification that statistics is represented by binary digit, described port-mark and described terminal iidentification;
Determine whether the binary digit sum counting on is less than 48;
When the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described virtual machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described virtual machine;
When counted on binary digit sum equals 48, described switch identification, described port-mark and described terminal iidentification are spliced into the MAC Address of 48 binary digits of described virtual machine.
8. a device for allocation medium access control MAC address, is characterized in that, described device comprises: acquisition module, address generation module;
Described acquisition module, for obtaining the network topological information of terminal equipment, described network topological information comprises that the switch identification of switch that described terminal equipment connects and described switch are for connecting the port-mark of the port of described terminal equipment;
Described address generation module, is used to described terminal equipment to generate the MAC Address that at least comprises described switch identification and described port-mark.
9. device according to claim 8, is characterized in that, described acquisition module comprises:
Receiving element, the first message sending for receiving switch that described terminal equipment connects, described the first message at least comprises that the MAC Address of described switch and described switch are for connecting the port-mark of the port of described terminal equipment;
Acquiring unit, for the switch identification using the binary digit of the continuous predetermined number of the MAC Address of described switch as described switch.
10. device according to claim 8, is characterized in that, described address generation module comprises:
The first allocation units, for being physical machine when described terminal equipment, and described physical machine has not been while having created virtual machine, described switch identification and described port-mark is spliced into the media access control MAC address of described physical machine;
The second allocation units, for working as described terminal equipment, it is physical machine, and described physical machine creates while having virtual machine, be described physical machine designated terminal sign, and described switch identification, described port-mark and described terminal iidentification be spliced into the media access control MAC address of described physical machine;
The 3rd allocation units, for when described terminal equipment be physical machine create virtual machine time, for described virtual machine designated terminal identifies, and described switch identification, described port-mark and described terminal iidentification are spliced into the media access control MAC address of described virtual machine.
11. devices according to claim 10, is characterized in that, described the first allocation units comprise:
Statistics subelement, for adding up the binary digit sum of the described switch identification that represented by binary digit and described port-mark;
Determine subelement, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement, for working as counted on binary digit sum while being less than 48, specify extend information, afterwards, described switch identification, described port-mark and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
Second distributes subelement, for working as counted on binary digit sum while equaling 48, described switch identification and described port-mark is spliced into the MAC Address of 48 binary digits of described physical machine.
12. devices according to claim 10, is characterized in that, described the second allocation units comprise:
Statistics subelement, for adding up the binary digit sum of the described switch identification being represented by binary digit, described port-mark and described terminal iidentification;
Determine subelement, for determining whether the binary digit sum counting on is less than 48;
First distributes subelement, for when the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described physical machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described physical machine;
Second distributes subelement, for working as counted on binary digit sum while equaling 48, described switch identification, described port-mark and described terminal iidentification is spliced into the MAC Address of 48 binary digits of described physical machine.
13. devices according to claim 11, is characterized in that, described the 3rd allocation units comprise:
Statistic unit, for adding up the binary digit sum of the described switch identification being represented by binary digit, described port-mark and described terminal iidentification;
Determining unit, for determining whether the binary digit sum counting on is less than 48;
The first allocation units, for when the binary digit sum counting on is less than 48, specify extend information, afterwards, described switch identification, described port-mark, described terminal iidentification and described extend information are spliced into the MAC Address of 48 binary digits of described virtual machine, described extend information at least comprises that tenant identifies, and described tenant's sign is for identifying user or the owner of described virtual machine;
The second allocation units, for working as counted on binary digit sum while equaling 48, are spliced into described switch identification, described port-mark and described terminal iidentification the MAC Address of 48 binary digits of described virtual machine.
CN201210330182.XA 2012-09-07 2012-09-07 The method and device of allocation medium access control MAC address Active CN103685587B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210330182.XA CN103685587B (en) 2012-09-07 2012-09-07 The method and device of allocation medium access control MAC address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210330182.XA CN103685587B (en) 2012-09-07 2012-09-07 The method and device of allocation medium access control MAC address

Publications (2)

Publication Number Publication Date
CN103685587A true CN103685587A (en) 2014-03-26
CN103685587B CN103685587B (en) 2018-07-17

Family

ID=50321859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210330182.XA Active CN103685587B (en) 2012-09-07 2012-09-07 The method and device of allocation medium access control MAC address

Country Status (1)

Country Link
CN (1) CN103685587B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468219A (en) * 2014-12-11 2015-03-25 杭州华三通信技术有限公司 Virtual networking network topology discovery method and device
CN106713042A (en) * 2016-12-29 2017-05-24 中国银联股份有限公司 Method and device for determination of network topology
CN111163187A (en) * 2019-12-31 2020-05-15 奇安信科技集团股份有限公司 MAC address generation method and device for virtual machine network port
WO2022199285A1 (en) * 2021-03-25 2022-09-29 华为技术有限公司 Communication method and apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101060454A (en) * 2007-05-16 2007-10-24 杭州华三通信技术有限公司 Proxy access method, control network equipment and proxy access system
US20080253380A1 (en) * 2007-04-11 2008-10-16 International Business Machines Corporation System, method and program to control access to virtual lan via a switch
CN101488862A (en) * 2009-02-23 2009-07-22 中兴通讯股份有限公司 Distributed Ethernet switch and internal MAC address maintaining method thereof
CN102255918A (en) * 2011-08-22 2011-11-23 神州数码网络(北京)有限公司 DHCP (Dynamic Host Configuration Protocol) Option 82 based user accessing authority control method
CN102318322A (en) * 2011-07-28 2012-01-11 华为技术有限公司 Device and method for distributing MAC address

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080253380A1 (en) * 2007-04-11 2008-10-16 International Business Machines Corporation System, method and program to control access to virtual lan via a switch
CN101060454A (en) * 2007-05-16 2007-10-24 杭州华三通信技术有限公司 Proxy access method, control network equipment and proxy access system
CN101488862A (en) * 2009-02-23 2009-07-22 中兴通讯股份有限公司 Distributed Ethernet switch and internal MAC address maintaining method thereof
CN102318322A (en) * 2011-07-28 2012-01-11 华为技术有限公司 Device and method for distributing MAC address
CN102255918A (en) * 2011-08-22 2011-11-23 神州数码网络(北京)有限公司 DHCP (Dynamic Host Configuration Protocol) Option 82 based user accessing authority control method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468219A (en) * 2014-12-11 2015-03-25 杭州华三通信技术有限公司 Virtual networking network topology discovery method and device
CN104468219B (en) * 2014-12-11 2019-01-08 新华三技术有限公司 Virtual networking method for discovering network topology and equipment
CN106713042A (en) * 2016-12-29 2017-05-24 中国银联股份有限公司 Method and device for determination of network topology
CN111163187A (en) * 2019-12-31 2020-05-15 奇安信科技集团股份有限公司 MAC address generation method and device for virtual machine network port
CN111163187B (en) * 2019-12-31 2022-08-16 奇安信科技集团股份有限公司 MAC address generation method and device for virtual machine network port
WO2022199285A1 (en) * 2021-03-25 2022-09-29 华为技术有限公司 Communication method and apparatus

Also Published As

Publication number Publication date
CN103685587B (en) 2018-07-17

Similar Documents

Publication Publication Date Title
CN102137007B (en) Method and system for generating network topology as well as coordinator
Adhikari et al. The Artificially Intelligent Switching Framework for Terminal Access Provides Smart Routing in Modern Computer Networks
CN104468219B (en) Virtual networking method for discovering network topology and equipment
CN110401568B (en) Network topology discovery method and equipment
CN102316043B (en) Port virtualization method, switch and communication system
CN102427410B (en) Method, device and system for processing fiber channel identity, and network equipment
CN103476023A (en) Configuration method of access point equipment, access controller and communication system
CN103731353A (en) Physical address acquiring method of virtual machine
CN103685587A (en) Method and device for assigning MAC (Media Access Control) address
CN104506462A (en) MAC (Media Access Control) address management method and equipment in distributed switch
CN104022972B (en) A kind of interchanger of Ethernet switch collocation method and application this method
CN108494607A (en) The design method and system of big double layer network framework based on container
CN109309633A (en) A kind of whole machine cabinet server node management method and device based on management interchanger
CN103326887A (en) Interface management method and system
CN102571416A (en) Positioning method and device for virtual machine
CN103684861A (en) Method and device for processing network configuration and communication system
CN103503413A (en) Method and device for transmitting network information
CN103945015A (en) Node logic ID distribution device and method and communication system
CN104519145A (en) An address resource managing method, system and DHCP server
CN109889421B (en) Router management method, device, terminal, system and storage medium
CN102917370B (en) Method, device and system for determining corresponding near-end unit of far-end unit and far-end unit
CN107612753A (en) Processing method, device and the radio reception device of wireless messages
CN102291313A (en) Method, device and equipment for finding virtual router redundancy protocol (VRRP) network topology
CN110493365A (en) A kind of common-use tunnel method for switching network and device
CN112953739A (en) K8S platform-based method, system and storage medium for nanotube SDN

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant