CN103685587B - The method and device of allocation medium access control MAC address - Google Patents

The method and device of allocation medium access control MAC address Download PDF

Info

Publication number
CN103685587B
CN103685587B CN201210330182.XA CN201210330182A CN103685587B CN 103685587 B CN103685587 B CN 103685587B CN 201210330182 A CN201210330182 A CN 201210330182A CN 103685587 B CN103685587 B CN 103685587B
Authority
CN
China
Prior art keywords
mark
port
mac address
binary digit
physical machine
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.)
Active
Application number
CN201210330182.XA
Other languages
Chinese (zh)
Other versions
CN103685587A (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

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

Abstract

The invention discloses a kind of method and devices of allocation medium access control MAC address, belong to technical field of the computer network.The method includes:The network topological information of terminal device is obtained, the network topological information includes the port-mark of the port of the switch identification and the interchanger of the connected interchanger of the terminal device for connecting the terminal device;The MAC Address including at least the switch identification and the port-mark is generated for the terminal device.So that the MAC Address of terminal device includes the network topological informations such as switch identification and port-mark, and there is certain hierarchical structure.

Description

The method and device of allocation medium access control MAC address
Technical field
The present invention relates to technical field of the computer network, the more particularly to a kind of side of allocation medium access control MAC address Method and device.
Background technology
In a local network, using 6 bytes(48 binary digits)MAC(Media Access Control, media connect Enter control)The terminal device in unique mark network is carried out in address.Currently, the MAC Address of 6 bytes is divided into two portions in equal size Point, specifically include producer's unique mark of 3 bytes and the network interface mark of 3 bytes.
The prior art distributes the MAC Address of above-mentioned format for terminal device in the following way:Producer in MAC Address Unique mark is identified usually using the producer of NIC manufacturer or is identified using the producer of the network interface manufacturer of physical machine, and Network interface mark in MAC Address is then generated according to some Generating Random Numbers at random.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:1, in MAC Address " producer's unique mark " and " network interface mark " is two random numbers not conflicted, ununified rule;2, existing to divide The MAC Address matched only includes " producer's unique mark " and " network interface mark ", can not embody the network topology of terminal device Information.
Invention content
In order to solve problems in the prior art, an embodiment of the present invention provides a kind of allocation medium access control MAC addresses Method and device.The technical solution is as follows:
On the one hand, the present invention provides a kind of method of MAC address, the method includes:
The network topological information of terminal device is obtained, the network topological information includes that the terminal device connects exchange The switch identification of machine and the interchanger are used to connect the port-mark of the port of the terminal device;
The MAC Address including at least the switch identification and the port-mark is generated for the terminal device.
It is described obtain terminal device network topological information include:
The first message that the interchanger that the terminal device is connected is sent is received, the first message includes at least described The MAC Address of interchanger and the interchanger are used to connect the port-mark of the port of the terminal device;
Using the binary digit of continuous predetermined number in the MAC Address of the interchanger as the interchanger of the interchanger Mark.
The first message includes at least Neighbor Discovery Protocol NDP message, Link Layer Discovery Protocol LLDP message, Lin Jutuo Flutter the proprietary protocol message for finding agreement NTDP message or user-defined format.
The MAC Address packet generated for the terminal device including at least the switch identification and the port-mark It includes:
When the terminal device is physical machine, and the physical machine has not created virtual machine, by the switch identification And the port-mark is spliced into the MAC address of the physical machine;
It is specified eventually for the physical machine when the terminal device is physical machine, and physical machine establishment has virtual machine End mark, and the media that the switch identification, the port-mark and the terminal iidentification are spliced into the physical machine connect Enter to control MAC Address;
It when the virtual machine that the terminal device is created by physical machine, is identified for the virtual machine designated terminal, and will The switch identification, the port-mark and the terminal iidentification are with being spliced into the media access control MAC of the virtual machine Location.
The media access control MAC that the switch identification and the port-mark are spliced into the physical machine Location includes:
The binary digit sum for the switch identification and the port-mark that statistics is indicated by binary digit;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on is less than 48, then extension information is specified, later, by the interchanger mark Knowledge, the port-mark and the extension information are spliced into the MAC Address of 48 binary digits of the physical machine, the extension Information includes at least tenant identification, and the tenant identification is used to identify the user or owner of the physical machine;
When the binary digit sum counted on is equal to 48, then the switch identification and the port-mark are spliced At the MAC Address of 48 binary digits of the physical machine.
The media that the switch identification, the port-mark and the terminal iidentification are spliced into the physical machine Access control MAC address includes:
The binary system of the switch identification, the port-mark and the terminal iidentification that statistics is indicated by binary digit Position sum;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on be less than 48 when, then specify extension information, later, by the switch identification, The port-mark, the terminal iidentification and the extension information are with being spliced into the MAC of 48 binary digits of the physical machine Location, the extension information include at least tenant identification, and the tenant identification is used to identify the user of the physical machine or gathers around The person of having;
When the binary digit sum counted on is equal to 48, then by the switch identification, the port-mark and institute State the MAC Address that terminal iidentification is spliced into 48 binary digits of the physical machine.
The media that the switch identification, the port-mark and the terminal iidentification are spliced into the virtual machine Access control MAC address includes:
The binary system of the switch identification, the port-mark and the terminal iidentification that statistics is indicated by binary digit Position sum;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on be less than 48 when, then specify extension information, later, by the switch identification, The port-mark, the terminal iidentification and the extension information are with being spliced into the MAC of 48 binary digits of the virtual machine Location, the extension information include at least tenant identification, and the tenant identification is used to identify the user of the virtual machine or gathers around The person of having;
When the binary digit sum counted on is equal to 48, then by the switch identification, the port-mark and institute State the MAC Address that terminal iidentification is spliced into 48 binary digits of the virtual machine.
On the other hand, a kind of device of allocation medium access control MAC address is provided, described device includes:Obtain mould Block, address generation module;
The acquisition module, the network topological information for obtaining terminal device, the network topological information include described The switch identification of the connected interchanger of terminal device and the interchanger are used to connect the port of the port of the terminal device Mark;
Described address generation module includes at least the switch identification and the end for being generated for the terminal device The MAC Address of mouth mark.
The acquisition module includes:
Receiving unit, the first message sent for receiving the interchanger that the terminal device is connected, described first disappears Breath is used to connect the port mark of the port of the terminal device including at least the MAC Address of the interchanger and the interchanger Know;
Acquiring unit is used for the binary digit of continuous predetermined number in the MAC Address of the interchanger as described in The switch identification of interchanger.
Described address generation module includes:
First allocation unit, for being physical machine when the terminal device, and when the physical machine has not created virtual machine, The switch identification and the port-mark are spliced into the MAC address of the physical machine;
Second allocation unit, for being physical machine when the terminal device, and the physical machine creates when having virtual machine, is The physical machine designated terminal mark, and the switch identification, the port-mark and the terminal iidentification are spliced into institute State the MAC address of physical machine;
Third allocation unit is the virtual machine when virtual machine for being created by physical machine when the terminal device Designated terminal identifies, and the switch identification, the port-mark and the terminal iidentification are spliced into the virtual machine MAC address.
First allocation unit includes:
Count subelement, for count the two of the switch identification and the port-mark that are indicated by binary digit into Position sum processed;
Determination subelement, for determining whether counted on binary digit sum is less than 48;
First distribution subelement, for when the binary digit sum counted on is less than 48, then specifying extension information, it Afterwards, the switch identification, the port-mark and the extension information are spliced into 48 binary digits of the physical machine MAC Address, the extension information includes at least tenant identification, and the tenant identification is used to identify the user of the physical machine Or owner;
Second distribution subelement, for when the binary digit sum counted on be equal to 48 when, then by the interchanger mark Knowledge and the port-mark are spliced into the MAC Address of 48 binary digits of the physical machine.
Second allocation unit includes:
Subelement is counted, for counting the switch identification indicated by binary digit, the port-mark and described The binary digit sum of terminal iidentification;
Determination subelement, for determining whether counted on binary digit sum is less than 48;
First distribution subelement, for when the binary digit sum counted on is less than 48, then specifying extension information, it Afterwards, the switch identification, the port-mark, the terminal iidentification and the extension information are spliced into the physical machine The MAC Address of 48 binary digits, the extension information include at least tenant identification, and the tenant identification is for identifying the object The user or owner of reason machine;
Second distribution subelement, for when the binary digit sum counted on be equal to 48 when, then by the interchanger mark Knowledge, the port-mark and the terminal iidentification are spliced into the MAC Address of 48 binary digits of the physical machine.
The third allocation unit includes:
Statistic unit, for counting the switch identification, the port-mark and the end indicated by binary digit Hold the binary digit sum of mark;
Determination unit, for determining whether counted on binary digit sum is less than 48;
First allocation unit, for when the binary digit sum counted on is less than 48, then specifying extension information, later, The switch identification, the port-mark, the terminal iidentification and the extension information are spliced into the 48 of the virtual machine The MAC Address of a binary digit, the extension information include at least tenant identification, and the tenant identification is described virtual for identifying The user or owner of machine;
Second allocation unit, for when the binary digit sum counted on be equal to 48 when, then by the switch identification, The port-mark and the terminal iidentification are spliced into the MAC Address of 48 binary digits of the virtual machine.
The advantageous effect that technical solution provided in an embodiment of the present invention is brought is:By the network topology for obtaining terminal device Information, the network topological information include that the switch identification of the connected interchanger of terminal device and the interchanger are used to connect The port-mark of the port of terminal device is generated for the terminal device and is marked including at least the switch identification and the port The realization of the technical solution of the MAC Address of knowledge so that the MAC Address of terminal device includes switch identification and port-mark etc. Network topological information, and have certain hierarchical structure.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, other are can also be obtained according to these attached drawings Attached drawing.
Fig. 1 is a kind of method flow schematic diagram for allocation medium access control MAC address that the embodiment of the present invention one provides;
Fig. 2 a are a kind of network architecture schematic diagrams provided by Embodiment 2 of the present invention;
Fig. 2 b are a kind of network architecture schematic diagrams provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of method flow schematic diagram of allocation medium access control MAC address provided by Embodiment 2 of the present invention;
Fig. 4 a are provided by Embodiment 2 of the present invention a kind of comprising switch identification, port-mark and the physics for extending information The exemplary plot of the MAC Address of machine;
Fig. 4 b are provided by Embodiment 2 of the present invention a kind of comprising switch identification, port-mark, terminal iidentification extension letter The exemplary plot of the MAC Address of the virtual machine of breath;
Fig. 5 is a kind of apparatus structure schematic diagram for allocation medium access control MAC address that the embodiment of the present invention three provides;
Fig. 6 is a kind of apparatus structure schematic diagram for allocation medium access control MAC address that the embodiment of the present invention three provides;
Fig. 7 is a kind of apparatus structure schematic diagram for allocation medium access control MAC address that the embodiment of the present invention three provides;
Fig. 8 is a kind of apparatus structure schematic diagram for allocation medium access control MAC address that the embodiment of the present invention three provides;
Fig. 9 is a kind of apparatus structure schematic diagram for allocation medium access control MAC address that the embodiment of the present invention three provides;
Figure 10 is a kind of apparatus structure signal for allocation medium access control MAC address that the embodiment of the present invention three provides Figure.
Specific implementation mode
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
Embodiment one
Referring to Fig. 1, a kind of method of allocation medium access control MAC address, the method includes:
Step 101:The network topological information of terminal device is obtained, the network topological information includes the terminal device institute The switch identification of the interchanger of connection and the interchanger are used to connect the port-mark of the port of the terminal device;
Step 102:It is generated including at least the MAC of the switch identification and the port-mark for the terminal device Location;
The advantageous effect that technical solution provided in an embodiment of the present invention is brought is:By the network topology for obtaining terminal device Information, the network topological information include that the switch identification for the interchanger that terminal device is connected and the interchanger are used to connect The port-mark of the port of terminal device is connect, is generated for the terminal device and includes at least the switch identification and the port The realization of the technical solution of the MAC Address of mark so that the MAC Address of terminal device includes switch identification and port-mark Equal network topological informations, and have certain hierarchical structure.
Embodiment two
Referring to Fig. 2 a, by a kind of instance graph for network architecture that the embodiment of the present invention provides, the machine apical grafting of specifically including enters Interchanger TOR(Top of Rack)201, the multiple physical machines being connected with TOR201(Here, physical machine is referred to as " Physical Machine " or " physical server ")202, here, there are multiple ports, different physical machines to pass through by TOR Ports different TOR is connected on the TOR, and in the embodiment of the present invention, interchanger is used to connect the end of the port of terminal device Mouth mark can identify the different physical machines connected on same interchanger;
Further, referring to Fig. 2 b, the physical machine 202 in the network architecture as shown in Figure 2 a can also generate multiple virtual Machine 203, here, physical machine establishment have multiple virtual ports, and different virtual machines is created different virtual by physical machine The physical machine is accessed in port, virtual machine that the physical machine can also be connected according to the establishment sequence of virtual machine and described Physical machine is specified to number accordingly, and in the embodiment of the present invention, specified number can be used as the virtual machine or the object The terminal iidentification of reason machine, for identifying the different virtual machine connected in same physical machine and the physical machine, and related object The mode that reason machine generates virtual machine may refer to the prior art.
TOR, physical machine and virtual machine in the above network architecture is by MAC(Media Access Control, media connect Enter control)Address identifies, wherein the MAC Address of TOR can when building above-mentioned network, by artificially configuring, and physical machine and The device of the distribution MAC that the MAC Address of virtual machine can then be provided by the embodiment of the present invention automatically generates, and the present invention is implemented MAC Address described in example still uses 48 binary digit structures.Wherein, the distribution MAC Address described in the embodiment of the present invention Device can specifically be built in physical machine and realize.
In the embodiment of the present invention, the interchanger in network can be identified by switch identification, and can by above description To know, physical machine is the different port of access switch, then, include in the MAC Address distributed if it is physical machine The switch identification of the physical machine access switch and the interchanger are used to connect the port-mark of the port of the physical machine, then should MAC Address can unique mark be connected to the different physical machines of same interchanger;And by above description it is recognised that physics The different virtual machines that machine is created can be identified by terminal iidentification, then, if the device of distribution MAC Address is virtual machine In addition to above-mentioned for other than identifying switch identification and the port-mark of physical machine, adding terminal mark in the MAC Address of distribution The different virtual machine in same physical machine can be distinguished by knowing.
In the embodiment of the present invention, above-described switch identification, port-mark and terminal iidentification have predetermined number Binary digit indicates.
Then be described in detail in conjunction with specific embodiments below distribution MAC Address device be how be physical machine and virtual machine MAC Address is distributed, referring to Fig. 3, an embodiment of the present invention provides a kind of methods of distribution MAC Address, may include as follows Operation:
Step 301:The device for distributing MAC Address obtains the network topological information of terminal device, the network topological information Switch identification and the interchanger including the connected interchanger of terminal device are used to connect the port of the port of the terminal device Mark;
For the embodiment of the present invention in specific implementation, the device for distributing MAC Address obtains the network topological information of terminal device May include:
The first message that the interchanger that receiving terminal apparatus is connected is sent, the first message include the interchanger MAC Address and the interchanger are used to connect the port-mark of the port of the terminal device;
In the embodiment of the present invention, the first message may operate in the IEEE including network as shown in figures 2 a and 2b (Institute of Electrical and Electronics Engineers, American Institute of Electrical and Electronics Engineers) In network defined in 802, for the node in network(Such as the physical machine in the embodiment of the present invention)It was found that neighbours save in network Point(Such as the interchanger in the embodiment of the present invention)Relevant information(The MAC Address of the interchanger as described in the embodiment of the present invention and Interchanger is used to connect the port-mark etc. of the port of terminal device), can include but is not limited to NDP(Neighbor Discovery Protocol, Neighbor Discovery Protocol)Message, LLDP(Link Layer Discovery Protocol, link Layer finds agreement)Message, NTDP(Neighbor Topology Discovery Protocol, neighbours' Topology Discovery Protocol)Disappear The proprietary protocol message of breath or user-defined format.
It, will be continuous in accessed MAC Address after the MAC Address for getting the interchanger that terminal device is connected Switch identification of the binary digit of predetermined number as the connected interchanger of terminal device;
In specific implementation, distributing the device of MAC Address can determine according to network size in acquired MAC Address The number of middle taken binary digit then can be from acquired for example, when the interchanger number in network is when within 1024 MAC Address in any position start the exchange for continuously taking 10 binary digits as the connected interchanger of the terminal device Machine identifies.
It later can be to generate the MAC including at least the switch identification and the port-mark for the terminal device Address, specific implementation may refer to the description of step 302 to 304.
Step 302:When the terminal device is physical machine, and the physical machine has not created virtual machine, MAC Address is distributed Device the switch identification and the port-mark are spliced into the MAC address of the physical machine;
For the embodiment of the present invention in specific implementation, the device for distributing MAC Address counts the friendship indicated by binary digit The binary digit sum of mark of changing planes and the port-mark;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on is less than 48, then extension information is specified, later, by the interchanger mark Knowledge, the port-mark and the extension information are spliced into the MAC Address of 48 binary digits of the physical machine, the extension Information includes at least tenant identification, and the tenant identification is used to identify the user or owner of the physical machine;
The splicing that the embodiment of the present invention does not limit the switch identification, the port-mark and the extension information is suitable Sequence according to switch identification, port-mark and can extend the sequence of information and be spliced in specific implementation, can also be by Splice, etc. according to switch identification, the sequence for extending pager port-mark.
When the binary digit sum counted on is equal to 48, then the switch identification and the port-mark are spliced At the MAC Address of 48 binary digits of the physical machine.
The embodiment of the present invention does not limit the switch identification and the splicing sequence of the port-mark, is implementing When, it can be according to switch identification and the sequential concatenation of port-mark, it can also be according to the suitable of port-mark and switch identification Sequence is spliced.
The generating process of the MAC Address of above-mentioned physical machine is first illustrated, it is as follows:
It, will when the switch identification is indicated by 12 binary digits, and the port-mark is indicated by 8 binary digits The switch identification and the port-mark share 20 binary digits after being spliced, and 48 two that MAC Address uses System bit format, therefore the extension information identified by 28 binary digits is specified here, later, by the switch identification, port Mark and extension information are spliced into the MAC Address of physical machine, and it includes switch identification, port-mark and expansion that Fig. 4 b, which give a kind of, Open up the MAC Address of the physical machine of information.
Step 303:It is the physics when the terminal device is physical machine, and physical machine establishment has virtual machine Machine designated terminal identifies, and the switch identification, the port-mark and the terminal iidentification are spliced into the physical machine MAC address;
For the embodiment of the present invention in specific implementation, the device for distributing MAC Address counts the friendship indicated by binary digit The binary digit sum of mark of changing planes and the port-mark;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on is less than 48, then extension information is specified, later, by the interchanger mark Knowledge, the port-mark and the extension information are spliced into the MAC Address of 48 binary digits of the physical machine, the extension Information includes at least tenant identification, and the tenant identification is used to identify the user or owner of the physical machine;
When the binary digit sum counted on is equal to 48, then the switch identification and the port-mark are spliced At the MAC Address of 48 binary digits of the physical machine.
Step 304:When the terminal device is the virtual machine in physical machine, the device for distributing MAC Address is the void Quasi- machine designated terminal mark, and the switch identification, the port-mark and the terminal iidentification be spliced into described virtual The MAC address of machine.
The embodiment of the present invention is in specific implementation, the switch identification that statistics is indicated by binary digit, the port Mark and the binary digit of terminal iidentification sum;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on be less than 48 when, then specify extension information, later, by the switch identification, The port-mark, the terminal iidentification and the extension information are with being spliced into the MAC of 48 binary digits of the virtual machine Location, the extension information includes tenant identification, and the tenant identification is used to identify the user or owner of the virtual machine;
The embodiment of the present invention does not limit the switch identification, the port-mark, the terminal iidentification and the expansion The splicing sequence for opening up information can be according to switch identification, port-mark, terminal iidentification and extension information in specific implementation Sequence spliced, can also according to switch identification, port-mark, extension available kiosk terminal mark sequence be spelled Connect, etc..
When the binary digit sum counted on is equal to 48, then by the switch identification, the port-mark and institute The MAC Address that terminal iidentification is spliced into 48 binary digits of the virtual machine is stated, the embodiment of the present invention does not limit the friendship The splicing sequence for the mark, the port-mark and the terminal iidentification of changing planes.
The splicing that the embodiment of the present invention does not limit the switch identification, the port-mark and the terminal iidentification is suitable Sequence can be spliced in specific implementation according to the sequence of switch identification, port-mark and terminal iidentification, can also be by According to according to the sequence of port-mark, switch identification and terminal iidentification splice, etc..
The process for the MAC Address for generating above-mentioned virtual machine is now illustrated, it is as follows:
When the switch identification is indicated by 10 binary digits, the port-mark is indicated by 6 binary digits, described When terminal iidentification is indicated by 8 binary digits, then after the switch identification, port-mark and terminal iidentification being spliced altogether There are 24 binary digits, and 48 bit formats that MAC Address uses, therefore is specified here by 24 binary digits marks Information is extended, later, the switch identification, port-mark, terminal iidentification and extension information are spliced into the MAC of virtual machine Location, Fig. 4 b give a kind of MAC Address comprising switch identification, port-mark, terminal iidentification and the virtual machine for extending information.
In the embodiment of the present invention, above-described extension information can also include other than it may include tenant identification The optional informations such as the effective time of address or self-defined information.
The advantageous effect that technical solution provided in an embodiment of the present invention is brought is:By the network topology for obtaining terminal device Information, the network topological information include that the switch identification of the connected interchanger of terminal device and the interchanger are used to connect The port-mark of the port of terminal device is generated for the terminal device and is marked including at least the switch identification and the port The realization of the technical solution of the MAC Address of knowledge so that the MAC Address of terminal device includes switch identification and port-mark etc. Network topological information, and have certain hierarchical structure.
Embodiment three
Referring to Fig. 5, an embodiment of the present invention provides a kind of device of allocation medium access control MAC address, device tools Body is identical as the described distribution device of MAC Address of embodiment of the method, may include:Acquisition module 401, address generation module 402;
Acquisition module 401, the network topological information for obtaining terminal device, the network topological information include the end The switch identification of the connected interchanger of end equipment and the interchanger are used to connect the port mark of the port of the terminal device Know;
Address generation module 402 includes at least the switch identification and the end for being generated for the terminal device The MAC Address of mouth mark.
Further, referring to Fig. 6, acquisition module 401 as shown in Figure 5 of the embodiment of the present invention may include:
Receiving unit 4011, the first message sent for receiving the interchanger that the terminal device connected, described the One message includes at least the port of the port of the MAC Address and the interchanger of the interchanger for connecting the terminal device Mark;
Acquiring unit 4012, for using the binary digit of continuous predetermined number in the MAC Address of the interchanger as The switch identification of the interchanger.
Wherein, the first message include at least Neighbor Discovery Protocol NDP message, Link Layer Discovery Protocol LLDP message, The proprietary protocol message of neighbours' Topology Discovery Protocol NTDP message or user-defined format.
Further, referring to Fig. 7, address assignment module 402 as shown in Figure 5 of the embodiment of the present invention may include:
First allocation unit 4021, for being physical machine when the terminal device, and the physical machine has not created virtually When machine, the switch identification and the port-mark are spliced into the MAC address of the physical machine;
Second allocation unit 4022, for being physical machine when the terminal device, and physical machine establishment has virtual machine When, it is identified for the physical machine designated terminal, and the switch identification, the port-mark and the terminal iidentification are spliced At the MAC address of the physical machine;
Third allocation unit 4023 is the void when virtual machine for being created by physical machine when the terminal device Quasi- machine designated terminal mark, and the switch identification, the port-mark and the terminal iidentification be spliced into described virtual The MAC address of machine.
Closer, referring to Fig. 8, as shown in Figure 7 specifically, the first allocation unit 4021 can be with for the embodiment of the present invention Including:
Subelement 4021A is counted, for counting the switch identification indicated by binary digit and the port-mark Binary digit sum;
Determination subelement 4021B, for determining whether counted on binary digit sum is less than 48;
First distribution subelement 4021C, for when the binary digit sum counted on is less than 48, then specifying extension letter Breath, later, by the switch identification, the port-mark and the extension information be spliced into 48 two of the physical machine into The MAC Address of position processed, the extension information include at least tenant identification, and the tenant identification is for identifying making for the physical machine User or owner;
Second allocation unit 4021D, for when the binary digit sum counted on be equal to 48 when, then by the interchanger Mark and the port-mark are spliced into the MAC Address of 48 binary digits of the physical machine.
Further, referring to Fig. 9, the second allocation unit 4022 as shown in Figure 7 of the embodiment of the present invention may include:
Count subelement 4022A, for count the switch identification indicated by binary digit, the port-mark and The binary digit sum of the terminal iidentification;
Determination subelement 4022B, for determining whether counted on binary digit sum is less than 48;
First distribution subelement 4022C, for when the binary digit sum counted on is less than 48, then specifying extension letter Breath, later, the object is spliced by the switch identification, the port-mark, the terminal iidentification and the extension information The MAC Address of 48 binary digits of reason machine, the extension information include at least tenant identification, and the tenant identification is for identifying The user or owner of the physical machine;
Second distribution subelement 4022D, for when the binary digit sum counted on be equal to 48 when, then by the exchange Machine mark, the port-mark and the terminal iidentification are spliced into the MAC Address of 48 binary digits of the physical machine.
Further, referring to Figure 10, third allocation unit 4023 as shown in Figure 7 of the embodiment of the present invention may include:
Count subelement 4023A, for count the switch identification indicated by binary digit, the port-mark and The binary digit sum of the terminal iidentification;
Determination subelement 4023B, for determining whether counted on binary digit sum is less than 48;
First distribution subelement 4023C, for when the binary digit sum counted on is less than 48, then specifying extension letter Breath, later, the void is spliced by the switch identification, the port-mark, the terminal iidentification and the extension information The MAC Address of 48 binary digits of quasi- machine, the extension information include at least tenant identification, and the tenant identification is for identifying The user or owner of the virtual machine;
Second distribution subelement 4023D, for when the binary digit sum counted on be equal to 48 when, then by the exchange Machine mark, the port-mark and the terminal iidentification are spliced into the MAC Address of 48 binary digits of the virtual machine.
The advantageous effect that technical solution provided in an embodiment of the present invention is brought is:By the network topology for obtaining terminal device Information, the network topological information include that the switch identification of the connected interchanger of terminal device and the interchanger are used to connect The port-mark of the port of terminal device;When terminal device is physical machine, by the switch identification and the port-mark It is spliced into the MAC address of the physical machine, is generated for the terminal device and includes at least the interchanger mark The realization of the technical solution of the MAC Address of knowledge and the port-mark so that the MAC Address of terminal device includes interchanger mark The network topological informations such as knowledge and port-mark, and have certain hierarchical structure.
It should be noted that:The device for the allocation medium access control MAC address that above-described embodiment provides is in allocation medium It, only the example of the division of the above functional modules, can be according to need in practical application when access control MAC address It wants and completes above-mentioned function distribution by different function modules, i.e., the internal structure of device is divided into different function moulds Block, to complete all or part of the functions described above.In addition, the allocation medium access control MAC that above-described embodiment provides The device of address belongs to same design with the embodiment of the method for allocation medium access control MAC address, and specific implementation process is detailed See embodiment of the method, which is not described herein again.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that realizing that all or part of step of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can be stored in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention.

Claims (11)

1. a kind of method of allocation medium access control MAC address, which is characterized in that the method includes:
The network topological information of terminal device is obtained, the network topological information includes the connected interchanger of the terminal device Switch identification and the interchanger are used to connect the port-mark of the port of the terminal device;
When the terminal device is physical machine, and the physical machine has not created virtual machine, by the switch identification and institute State the MAC address that port-mark is spliced into the physical machine;
It is the physical machine designated terminal mark when the terminal device is physical machine, and physical machine establishment has virtual machine Know, and the switch identification, the port-mark and the terminal iidentification are spliced into the media access control of the physical machine MAC Address processed;
It when the virtual machine that the terminal device is created by physical machine, is identified for the virtual machine designated terminal, and will be described Switch identification, the port-mark and the terminal iidentification are spliced into the MAC address of the virtual machine.
2. according to the method described in claim 1, it is characterized in that, the network topological information for obtaining terminal device includes:
The first message that the interchanger that the terminal device is connected is sent is received, the first message includes at least the exchange The MAC Address of machine and the interchanger are used to connect the port-mark of the port of the terminal device;
Using the binary digit of continuous predetermined number in the MAC Address of the interchanger as the interchanger mark of the interchanger Know.
3. according to the method described in claim 2, it is characterized in that, the first message includes at least Neighbor Discovery Protocol NDP The proprietary protocol of message, Link Layer Discovery Protocol LLDP message, neighbours' Topology Discovery Protocol NTDP message or user-defined format Message.
4. according to the method described in claim 1, it is characterized in that, described spell the switch identification and the port-mark The MAC address for being connected into the physical machine includes:
The binary digit sum for the switch identification and the port-mark that statistics is indicated by binary digit;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on is less than 48, then extension information is specified, later, by the switch identification, institute State port-mark and the MAC Address for extending information and being spliced into 48 binary digits of the physical machine, the extension information Including at least tenant identification, the tenant identification is used to identify the user or owner of the physical machine;
When the binary digit sum counted on is equal to 48, then the switch identification and the port-mark are spliced into institute State the MAC Address of 48 binary digits of physical machine.
5. according to the method described in claim 1, it is characterized in that, it is described by the switch identification, the port-mark and The MAC address that the terminal iidentification is spliced into the physical machine includes:
Statistics is total by the binary digit of the switch identification, the port-mark and the terminal iidentification that binary digit indicates Number;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on is less than 48, then extension information is specified, later, by the switch identification, described Port-mark, the terminal iidentification and the extension information are spliced into the MAC Address of 48 binary digits of the physical machine, institute It states extension information and includes at least tenant identification, the tenant identification is used to identify the user or owner of the physical machine;
When the binary digit sum counted on is equal to 48, then by the switch identification, the port-mark and the end End mark is spliced into the MAC Address of 48 binary digits of the physical machine.
6. according to the method described in claim 1, it is characterized in that, it is described by the switch identification, the port-mark and The MAC address that the terminal iidentification is spliced into the virtual machine includes:
Statistics is total by the binary digit of the switch identification, the port-mark and the terminal iidentification that binary digit indicates Number;
Determine whether counted on binary digit sum is less than 48;
When the binary digit sum counted on is less than 48, then extension information is specified, later, by the switch identification, described Port-mark, the terminal iidentification and the extension information are spliced into the MAC Address of 48 binary digits of the virtual machine, institute It states extension information and includes at least tenant identification, the tenant identification is used to identify the user or owner of the virtual machine;
When the binary digit sum counted on is equal to 48, then by the switch identification, the port-mark and the end End mark is spliced into the MAC Address of 48 binary digits of the virtual machine.
7. a kind of device of allocation medium access control MAC address, which is characterized in that described device includes:Acquisition module, address Generation module;
The acquisition module, the network topological information for obtaining terminal device, the network topological information include the terminal The switch identification of the connected interchanger of equipment and the interchanger are used to connect the port-mark of the port of the terminal device;
Described address generation module, including the first allocation unit, the second allocation unit and third allocation unit;First distribution Unit, for being physical machine when the terminal device, and when the physical machine has not created virtual machine, by the switch identification And the port-mark is spliced into the MAC address of the physical machine;Second allocation unit, for working as institute It is physical machine to state terminal device, and physical machine establishment is identified for the physical machine designated terminal when having virtual machine, and by institute State the MAC address that switch identification, the port-mark and the terminal iidentification are spliced into the physical machine; The third allocation unit, it is specified for the virtual machine when virtual machine for being created by physical machine when the terminal device Terminal iidentification, and the switch identification, the port-mark and the terminal iidentification are spliced into the media of the virtual machine Access control MAC address.
8. device according to claim 7, which is characterized in that the acquisition module includes:
Receiving unit, the first message sent for receiving the interchanger that the terminal device is connected, the first message is extremely Include the port-mark of the port of the MAC Address and the interchanger of the interchanger for connecting the terminal device less;
Acquiring unit, for using the binary digit of continuous predetermined number in the MAC Address of the interchanger as the exchange The switch identification of machine.
9. device according to claim 7, which is characterized in that first allocation unit includes:
Subelement is counted, the binary digit for counting the switch identification and the port-mark that are indicated by binary digit Sum;
Determination subelement, for determining whether counted on binary digit sum is less than 48;
First distribution subelement, for when the binary digit sum counted on is less than 48, then specifying extension information, later, The switch identification, the port-mark and the extension information are spliced into 48 binary digits of the physical machine MAC Address, the extension information include at least tenant identification, the tenant identification be used for identify the physical machine user or Person owner;
Second distribution subelement, for when the binary digit sum counted on is equal to 48, then by the switch identification and The port-mark is spliced into the MAC Address of 48 binary digits of the physical machine.
10. device according to claim 7, which is characterized in that second allocation unit includes:
Subelement is counted, for counting the switch identification, the port-mark and the terminal indicated by binary digit The binary digit sum of mark;
Determination subelement, for determining whether counted on binary digit sum is less than 48;
First distribution subelement later, will for when the binary digit sum counted on is less than 48, then specifying extension information The switch identification, the port-mark, the terminal iidentification and the extension information are spliced into 48 of the physical machine The MAC Address of binary digit, the extension information include at least tenant identification, and the tenant identification is for identifying the physical machine User or owner;
Second distribution subelement, for when the binary digit sum counted on be equal to 48 when, then by the switch identification, institute State port-mark and the terminal iidentification be spliced into the physical machine 48 binary digits MAC Address.
11. device according to claim 7, which is characterized in that the third allocation unit includes:
Statistic unit, for counting the switch identification, the port-mark and the terminal mark indicated by binary digit The binary digit sum of knowledge;
Determination unit, for determining whether counted on binary digit sum is less than 48;
First allocation unit, for when the binary digit sum counted on is less than 48, then extension information being specified, later, by institute State 48 two that switch identification, the port-mark, the terminal iidentification and the extension information are spliced into the virtual machine The MAC Address of system position, the extension information include at least tenant identification, and the tenant identification is for identifying the virtual machine User or owner;
Second allocation unit, for when the binary digit sum counted on is equal to 48, then by the switch identification, described Port-mark and the terminal iidentification are spliced into the MAC Address of 48 binary digits of the 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 CN103685587A (en) 2014-03-26
CN103685587B true 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)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468219B (en) * 2014-12-11 2019-01-08 新华三技术有限公司 Virtual networking method for discovering network topology and equipment
CN106713042B (en) * 2016-12-29 2020-05-26 中国银联股份有限公司 Method and device for determining network topology
CN111163187B (en) * 2019-12-31 2022-08-16 奇安信科技集团股份有限公司 MAC address generation method and device for virtual machine network port
CN115134299A (en) * 2021-03-25 2022-09-30 华为技术有限公司 Communication method and device

Citations (4)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7936670B2 (en) * 2007-04-11 2011-05-03 International Business Machines Corporation System, method and program to control access to virtual LAN via a switch

Patent Citations (4)

* 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
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

Also Published As

Publication number Publication date
CN103685587A (en) 2014-03-26

Similar Documents

Publication Publication Date Title
CN105515978B (en) Realize the method and device of distributed routing, physical host access
CN111934921B (en) Network topology discovery method and device, equipment and storage medium
CN103404084B (en) MAC Address forces retransmission unit and method
CN110401568B (en) Network topology discovery method and equipment
CN106712988B (en) A kind of virtual network management method and device
CN110351286B (en) Link flooding attack detection response mechanism in software defined network
CN103685587B (en) The method and device of allocation medium access control MAC address
CN108616402B (en) Management method and system of remote equipment
CN112866075A (en) In-band network telemetering method, system and related device for Overlay network
CN108206792B (en) Topological structure discovery method and device of switch
US9807033B2 (en) Neighbor discovery using address registration protocol over ELMI
CN107104824A (en) A kind of network topology determines method and apparatus
CN108055290A (en) Heterogeneous protocol network system and its method for interchanging data
CN107820262A (en) Method for parameter configuration, apparatus and system
US8914503B2 (en) Detected IP link and connectivity inference
US20140286339A1 (en) Hardware Acceleration for Routing Programs
CN104022972B (en) A kind of interchanger of Ethernet switch collocation method and application this method
CN108173763B (en) Message processing method, device and system
CN108471390A (en) The reorientation method of service message straddle processing system and service message
CN108521341A (en) Message transmitting method and device
CN114650565A (en) Intelligent flow control management system for intelligent gateway based on data analysis
CN107465621A (en) A kind of router finds method, SDN controllers, router and network system
US7733800B2 (en) Method and mechanism for identifying an unmanaged switch in a network
CN105681229B (en) The method and interchanger of ECP Extended Capabilities Port number
CN109039947A (en) Network packet De-weight method, device, network shunt equipment and storage medium

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