CN111935334A - Method, system, server and readable storage medium for intelligently allocating network addresses - Google Patents

Method, system, server and readable storage medium for intelligently allocating network addresses Download PDF

Info

Publication number
CN111935334A
CN111935334A CN202010819695.1A CN202010819695A CN111935334A CN 111935334 A CN111935334 A CN 111935334A CN 202010819695 A CN202010819695 A CN 202010819695A CN 111935334 A CN111935334 A CN 111935334A
Authority
CN
China
Prior art keywords
address
mac
host
port
network
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
CN202010819695.1A
Other languages
Chinese (zh)
Other versions
CN111935334B (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.)
Zhuzhou Huina Technology Co ltd
Original Assignee
Zhuzhou Huina Technology 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 Zhuzhou Huina Technology Co ltd filed Critical Zhuzhou Huina Technology Co ltd
Priority to CN202010819695.1A priority Critical patent/CN111935334B/en
Publication of CN111935334A publication Critical patent/CN111935334A/en
Application granted granted Critical
Publication of CN111935334B publication Critical patent/CN111935334B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Abstract

The invention discloses a method, a system, a server and a storage medium for intelligently allocating network addresses. The method comprises the following steps: acquiring network topology information of a switch; generating host address data of a host end; generating position mac data according to the port mac association relation and the network topology information; extracting a mac address of a requester from the dynamic host configuration request information; retrieving position mac data according to the mac address of the requester, and extracting a combination of a relative position code, a port code and a host mac address from the position mac data; the combination is unique, host address data is retrieved according to the relative position code and the port code, and a network address is extracted from the host address data; and encapsulating the network address and the mac address of the requester into a response frame, and sending the response frame to the requester. The method of the invention allocates the fixed network address for the host according to the relative position and the port of the switch under the condition of not manually interfering the switch and the host equipment, thereby greatly reducing the labor and time cost of maintenance.

Description

Method, system, server and readable storage medium for intelligently allocating network addresses
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a system, a server, and a computer-readable storage medium for intelligently allocating network addresses.
Background
The host device may be connected to a switch to enable the host device to connect to a local area network or the internet. To enable any two electronic devices connected to the internet or a local area network to communicate with each other, the two electronic devices must have their own network addresses.
The traditional DHCP server is based on a dynamic host configuration protocol, network address allocation is carried out on networked equipment, and the randomness of the allocated network address is strong. The network address of the host equipment is needed when the host equipment is remotely maintained, and the labor cost and the time cost of implementation and maintenance are greatly increased by the mode of randomly allocating the network address of the traditional DHCP server.
The patent application numbers are: 201811611933.9, it provides a method and system for IP address allocation, the patent is a static address allocation strategy using mac-IP, it needs to use and configure DHCP relay, and needs to manually configure DHCP relay information: the system comprises a machine room, a machine frame number, an input port list used for connecting equipment to be deployed, and a range for allocating IP addresses for the equipment to be deployed connected to the DHCP relay; obviously, this solution requires manual configuration of each DHCP relay, is inefficient in implementation and maintenance, and is prone to address assignment errors due to misconfiguration. The technical solution mentioned in this patent does not solve the technical problem of assigning fixed network addresses by a DHCP server without human intervention in the switches and host devices.
Patent application No.: 201610883801.6, an IP address allocation method and device is proposed, which needs to manually configure the rack identifier of the physical location information service server of the service server, the slot identifier of the service server on the rack, etc., and can not solve the problem of allocating fixed network addresses without manual intervention on the host equipment and the switch, when the number of service servers is large, the efficiency is low and the cost is high, and the manual configuration is easy to make mistakes.
Patent application No.: 201410675677.5, an IP address allocation method and device is provided, the technical proposal is that the position information of the host equipment is obtained from the dynamic host configuration request information, the position information is carried in the dynamic host configuration request information; the technical scheme can not solve the problem of allocating fixed network addresses.
Therefore, there is a need to provide a new method, system, server and computer readable storage medium for intelligently allocating network addresses to solve the above technical problems.
Disclosure of Invention
The invention mainly aims to provide a method for intelligently allocating network addresses, and aims to solve the technical problems that a DHCP server randomly allocates network addresses, and the labor cost and the time cost of network implementation and maintenance are too high.
In order to achieve the above object, the present invention provides a method for intelligently allocating network addresses, including:
acquiring network topology information of a switch; the network topology information comprises an identity identification code, a relative position code, a port code and port virtual local area network information corresponding to any switch;
generating host address data of each host end according to the network topology information and a preset address generation algorithm;
acquiring a port mac incidence relation, and generating position mac data according to the port mac incidence relation and the network topology information; wherein, the port mac association relationship is used for representing the association between the port code and the host mac address of the host end;
acquiring dynamic host configuration request information, and extracting a mac address of a requester from the dynamic host configuration request information;
when the matched position mac data is retrieved according to the requester mac address, extracting the combination of the relative position code, the port code and the corresponding host mac address of the switch from the position mac data;
specifically, the retrieving the matched location mac data according to the mac address of the requester means: a record exists in the position mac data that the address of the requester mac is equal to the address of the host in the position mac data;
when the combination is unique and the matched host address data is retrieved according to the relative position code and the port code, extracting the corresponding network address of the host end from the host address data;
and encapsulating the obtained network address and the corresponding mac address of the requester into a response frame, and sending the response frame to the requester.
Preferably, the step of obtaining the network topology information of the switch specifically includes the following steps:
acquiring network topology information of the switch and storing the network topology information to the local;
acquiring state information of a cascade port of the switch in real time, and judging whether the state information changes;
and when the state information of the cascade port is changed, the network topology information of the switch is obtained again and is updated and stored locally.
Preferably, the step of generating host address data of each host according to the network topology information and a preset address generation algorithm specifically includes the following steps:
judging whether a host network address allocation strategy is stored locally;
when a host network address allocation strategy is stored locally, extracting the network address from the host network address allocation strategy, and generating the host address data according to the network topology information and the network address;
or generating the host address data according to the network topology information and the host network address allocation strategy;
and when the host network address allocation strategy is not stored locally, calculating and generating the network address according to the network topology information, and generating the host address data according to the network topology information and the network address.
Preferably, the step of obtaining the port mac association relationship and generating the location mac data according to the port mac association relationship and the network topology information specifically includes the following steps:
acquiring the port mac incidence relation, and primarily generating the position mac data according to the port mac incidence relation and the network topology information;
storing the position mac data generated for the first time to the local;
acquiring state information of a direct connection port of the switch in real time, and judging whether the state information changes or not;
when the state information of the directly connected port changes, the port mac incidence relation is obtained again, and new position mac data are generated again according to the updated port mac incidence relation and the network topology information;
and updating and storing the position mac data to the local.
Preferably, the method further comprises the following steps:
and when the matched position mac data cannot be retrieved according to the mac address of the requester, entering a step of acquiring a port mac incidence relation and generating position mac data according to the port mac incidence relation and the network topology information.
Preferably, the method further comprises the following steps:
and when the combination is not unique, performing the step of reacquiring the port mac incidence relation and generating new position mac data again according to the updated port mac incidence relation and the network topology information.
Preferably, the method further comprises the following steps:
when the combination is unique and no matching host address data is retrieved according to the relative position code and the port code;
and entering the step of calculating and generating the network address according to the network topology information and generating the host address data according to the network topology information and the network address.
In order to solve the above technical problem, the present invention further provides a system for intelligently allocating network addresses, including a memory, a processor, and a computer program stored in the memory, wherein when the computer program is executed by the processor, the steps of the method for intelligently allocating network addresses are implemented.
In order to solve the above technical problem, the present invention further provides a server, where the server stores a computer program, and when the computer program is executed by a processor, the server implements the steps of the method for intelligently allocating network addresses.
In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method for intelligently allocating network addresses.
The method for intelligently allocating the network address obtains the network topology information of the switch; generating host address data of each host end according to the network topology information and a preset address generation algorithm; acquiring a port mac incidence relation, and generating position mac data according to the port mac incidence relation and the network topology information; acquiring dynamic host configuration request information, and extracting a mac address of a requester from the dynamic host configuration request information; retrieving the matched position mac data according to the request mac address, and extracting the combination of the relative position code and the port code of the switch and the host mac address from the position mac data; when the combination is unique and the matched host address data is retrieved according to the relative position code and the port code, extracting the network address of the corresponding requester from the host address data; and encapsulating the obtained network address and the corresponding mac address of the requester into a response frame, and sending the response frame to the requester.
Under the condition of not needing manual intervention switch and host computer equipment, can distribute the fixed network address according to switch relative position and port, expand the range of application of traditional DHCP, promote the adaptability of traditional DHCP, because need not any manual intervention host computer equipment and the switch that inserts simultaneously, effectively improve and implement maintenance efficiency, reduce and implement the maintenance cost.
The manual intervention switch and the host equipment refer to the following steps: manually configuring characteristic information such as positions and the like in a switch or host equipment;
because if the position characteristic information needs to be manually configured in the switch or the host device, the switch needs to be manually configured when being deployed, or the switch needs to be replaced when being replaced, or the position characteristic information needs to be configured in the host device, the host device needs to be manually configured when being deployed, or the switch needs to be replaced when being replaced, and when the number of the host devices or the switches is large, the labor cost is high and errors are easy to occur;
the technical scheme of the invention is applied, the exchange in the local area network is replaced and replaced, the replacement and replacement of the host equipment are increased, manual intervention is not needed, and the network address obtained by the host equipment accessed to a certain port in a certain position exchange through the DHCP client side is fixed and unchanged.
For example: a total of 6 switches are cascaded, and if the DHCP server applying the technical scheme mentioned in the present invention is connected to the switch 1, and the positions of the switches are sequentially 1, 2, 3, 4, 5, and 6, the network address of the host in the port 1 of the switch accessing the position 3 will not change with the replacement of the host device;
and the switch at location 3 is swapped with the switch at location 4, the network address of the host device accessing port 1 of the switch at location 3 will still not change.
Drawings
FIG. 1 is a schematic flow chart illustrating a preferred embodiment of a method for intelligently allocating network addresses according to the present invention;
FIG. 2 is a schematic flow chart of S10 shown in FIG. 1;
FIG. 3 is a schematic flow chart of S20 shown in FIG. 1;
FIG. 4 is a schematic flow chart of S30 shown in FIG. 1;
fig. 5 is an architecture diagram of a system for intelligently allocating network addresses according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a method for intelligently allocating network addresses.
Referring to fig. 1, the method for intelligently allocating network addresses includes:
s10, acquiring network topology information of each switch; the network topology information comprises an identity identification code, a relative position code, a port code and port virtual local area network information corresponding to any switch;
in this embodiment, the switches are generally managed switches, and the managed switches may be directly connected to the host device, may be connected to adjacent managed switches, and may be connected to unmanaged switches.
In this embodiment, the identification code is used to identify the unique identity of the switch, and the identification code may be a mac address of the switch or a management address of the switch.
The relative position code is used to identify the relative positions between the switches in a fixed order. For example, there are 6 switches arranged in the order from left to right, and the relative position codes of the 6 switches are 1, 2, 3, 4, 5, and 6, respectively.
The port code is a port code of the switch itself, and is used to identify a plurality of ports of the switch, for example, 6 ports are provided on a certain switch, and the port codes of the 6 ports are 1, 2, 3, 4, 5, and 6, respectively.
The port vlan information is used to identify a vlan to which a port of an exchange belongs, and in general, the same encoded ports of different exchanges may belong to the same vlan, or the same encoded ports of different exchanges may belong to different vlans.
Specifically, if the switch in the local area network supports the broadcast topology data technology, the broadcast data is received; or remotely accessing the switch; to obtain all neighbor switch information of the switch; and calculating and acquiring the relative position of the local area network;
if the switch in the local area network does not support the broadcast topological structure data technology, the switch is remotely accessed to acquire all neighbor switch information of the switch, and then the relative position of the switch in the local area network is calculated.
The method for remotely accessing the switch comprises the following steps:
if the switch is convenient to maintain daily, the management address of the switch is set as the only non-conflicting network address in the local area network, and then the management address is applied to remotely access the switch; and if the switch does not need daily maintenance, remotely accessing the switch by adopting a static arp technology.
Locally updating and storing the position data of all the switches in the local area network; the switch location data includes information including, but not limited to: the identity identification code of the switch and the relative position code of the switch are coded;
the switch identification code can be a switch mac address, a unique management address of the switch and the like and is used for distinguishing from the unique characteristics of other switches;
acquiring a port list of a switch and storing the port list into local switch port data; the local switch port data includes, but is not limited to: the identity identification code of the switch, the relative position code of the switch, the port code and the like;
under the condition that a plurality of virtual local area networks exist in the local area network, if a switch virtual local area network division strategy exists locally, port virtual local area network information is imported into port virtual local area network information of a local switch; or directly using the local switch virtual local area network division strategy as local port virtual local area network information;
otherwise, the port virtual local area network information is obtained from the exchanger through communication technologies such as remote access and the like, and the local port virtual local area network information is updated.
S20, generating host address data of each host end according to the network topology information and a preset address generation algorithm; s30, acquiring port mac incidence relation, and generating position mac data according to the port mac incidence relation and the network topology information; wherein the port mac association is used to indicate the association between the port code and the host mac address of the host end
In this embodiment, the port mac association relationship includes information: port number and host mac address of the switch; one port number may correspond to a plurality of the host mac addresses, or may correspond to only one of the host mac addresses;
the location mac data includes, but is not limited to: the identity identification code of the switch, the relative position code of the switch, the port code, the mac address of the host computer and the like;
s40, obtaining the request information of dynamic host configuration, and extracting the mac address of the requester from the request information of dynamic host configuration;
specifically, if the cross-vlan forwarding and dynamic host configuration proxy technology is adopted in the local area network, the forwarded dynamic host configuration request information sent by the host device is received;
if the local area network does not adopt the cross-vlan forwarding and dynamic host configuration proxy technology, directly receiving the dynamic host configuration request information sent by the host equipment;
the technical characteristics of the dynamic host configuration request information directly received from the host device include:
if a plurality of vlans exist in the local area network, receiving dynamic host configuration request information sent by the host equipment by adopting a virtual network card vlan identifier;
otherwise, the dynamic host configuration request information sent by the host equipment is directly received without solving the vlan identifier.
And extracting a requester mac address from the obtained dynamic host configuration request information according to a DHCP standard protocol or other protocols, wherein the requester mac address is a unique identity characteristic which uniquely identifies the host sending the dynamic host configuration request information.
S50, when the matched position mac data is retrieved according to the request mac address, extracting the combination of the relative position code, the port code and the corresponding host mac address of the switch from the position mac data;
specifically, the retrieving the matched location mac data according to the mac address of the requester means: there is a record in the location mac data that the requester mac address is equal to the host mac address in the location mac data.
S60, when the combination is unique and the matched host address data is retrieved according to the relative position code and the port code, extracting the corresponding network address of the host end from the host address data;
s70, packaging the obtained network address and the corresponding mac address of the requester into a response frame, and sending the response frame to the requester.
In this embodiment, the requesting party refers to a party that issues the dhcp configuration request information, and is a party that requests to acquire a network address.
It can be understood that, in this embodiment, the host address data, the location mac data, the virtual local area network information of the switch, the relative location data of the switch, and the port data of the switch are not limited to be in an expression form, and may be embodied in the form of 1 or more lists, linked lists, files, or database tables.
Referring to fig. 2, the step S10 specifically includes the following steps:
s101, acquiring network topology information of the switch and storing the network topology information to the local;
s102, acquiring state information of a cascade port of the switch in real time, and judging whether the state information changes;
in this embodiment, the cascade port is used for a switch port connected to a neighbor switch.
S103, when the state information of the cascade port changes, the network topology information of the switch is obtained again, and the network topology information is updated and stored locally.
The function of this step is to determine the relative position relation of the switchboard in the local area network intelligently; and storing, updating and storing local switch position data, and providing data basis for calculating or acquiring the network address of the host equipment in the local area network.
Referring to fig. 3, the step S20 specifically includes the following steps:
s201, judging whether a host network address allocation strategy is stored locally;
in this embodiment, the host network address allocation policy may be data including a network address of the host, or may be the network address of the host itself.
S202, when a host network address allocation strategy is stored locally, extracting the network address from the host network address allocation strategy, and generating the host address data according to the network topology information and the network address;
at this time, the host network address allocation policy is data containing a network address of the host.
Or generating the host address data according to the network topology information and the host network address allocation strategy;
at this time, the host network address allocation policy is the network address of the host itself.
S203, when the host network address allocation strategy is not stored locally, calculating and generating the network address according to the network topology information, and generating the host address data according to the network topology information and the network address.
The network address includes, but is not limited to, an IP address, a subnet mask.
Referring to fig. 4, the step S30 specifically includes the following steps:
s301, acquiring the port mac incidence relation, and primarily generating the position mac data according to the port mac incidence relation and the network topology information;
s302, storing the position mac data generated for the first time to the local;
s303, acquiring state information of a direct connection port of the switch in real time, and judging whether the state information changes;
the direct connection port is used for connecting a host device or a switch end of the unmanaged switch;
s304, when the state information of the directly connected port changes, the port forwarding mac address list is obtained again, and new position mac data are generated again according to the updated port forwarding mac address list and the network topology information;
specifically, the communication technology such as a remote access technology is used; acquiring a port forwarding mac address list of the switch with the changed power-on state of the directly connected port, updating and storing local position mac data, and dynamically constructing the association relationship between the switch position and the port and the mac address;
if the power-on state change information of the directly connected port is received; then, the feature of obtaining the port forwarding mac address list of the switch with the changed power-on state of the directly connected port by using the communication technologies such as the remote access technology is as follows:
if any one direct connection port of the switch is converted into a connection state from a disconnection state, a forwarding mac address list of the direct connection port is obtained again in a remote access mode, and mac data stored in a local position are updated;
if any one of the directly connected ports of the switch is converted into a disconnected state from a connected state, all forwarding mac address items of the directly connected ports are cleared through remotely accessing the switch; clearing the mac address association relation between the switch position and the port in the local position mac data, and avoiding the repeated mac address association relation between the switch position and the port in the local position mac data;
s305, updating and storing the position mac data to the local.
Specifically, comparing the obtained mac address association relationship between the switch position and the port with data in the mac data of the local position, which is the same as the switch position;
if the local position mac data does not exist, adding the obtained mac address association relation of the switch position and the port into the position mac data;
and if the correlation between the switch position and the mac address of the port in the local position mac data does not exist in the obtained correlation between the switch position and the mac address of the port, removing the correlation between the original switch position and the mac address of the port from the local position mac data, and updating the correlation between the switch position and the mac address of the port into a new correlation between the switch position and the mac address of the port.
The function of this step is to search the network address in the address data of the host computer according to the mac address of the host computer; or the switch position and the port code provide data correlation basis.
As a preferable mode of this embodiment, the method for intelligently allocating a network address further includes the following steps:
when the matching position mac data is not retrieved according to the requester mac address, designating all switches as target switches, and entering the step S30;
when the combination is not unique, the step S30 is entered;
appointing the switches identified by all the switch identification codes in the retrieved position mac data record as target switches;
preferably, after waiting for the port to forward mac address keep-alive time, designating the switches identified by all the switch identification codes in the retrieved location mac data record as target switches, and entering step S30;
when the combination is unique and the matched host address data cannot be retrieved according to the relative position code, the port code and the like;
the process proceeds to step S203.
The data required for calculating the network address at least includes the switch location, the port number, and the vlan number to which the port belongs (if all host devices are in the management vlan, the vlan number to which the port belongs is naturally the number of the management vlan);
the calculation of the network address and the update of the host address data saved locally may be performed in any step between S201 and S70.
The method for intelligently allocating the network address has the following advantages that:
(1) the DHCP server applying the technical scheme or the DHCP server applying the technical scheme can allocate a fixed network address associated with the position to the host equipment accessing any port of any position switch under the condition that personnel do not need to intervene the switch and the host equipment;
(2) the host equipment can apply the existing common DHCP client; the fixed network address associated with the position is obtained without secondary development of DHCP, so that the implementation cost of the patent technology is reduced, and the popularization and the application are facilitated;
(3) the adaptability of the DHCP server is effectively improved, the host equipment can be adapted to the condition that personnel is not needed to intervene the switch and the host equipment, the fixed network address associated with the position can be distributed to the host equipment of any port accessed to any position switch, and the application range of the DHCP server is expanded.
To further understand the method for intelligently allocating network addresses provided by the present invention, the following is specifically illustrated as an example:
implementation scenarios:
(1)6 switches are connected in a cascade mode to form a local area network;
(2) requiring that the local area network be divided into 3 port-based vlans;
switch port No. 13 is in vlan2, switch port No. 1 is in vlan 3;
switch port number 2 6 is in vlan 2;
switch port No. 3 7 is in vlan 3;
switch port No. 5 4 is in vlan 2;
vlan1 is a management vlan.
(3) The intelligent distribution network address system is connected with a port 5 of a number 1 switch in the local area network, wherein the port 5 is a tagged port;
(4) the host device 1 is connected to port 3 of switch No. 1;
the host device 2 is connected to port 7 of switch No. 1;
the host device 3 is connected to switch port number 2 6;
the host device 4 is connected to switch port No. 3 7;
the host device 5 is connected to switch port No. 5 4;
the first step is as follows: a network topology in a local area network is obtained.
Respectively acquiring neighbor information of the 6 switches by a remote access technology to obtain relative positions of all switches in the local area network, and respectively numbering according to the positions;
assuming that the number of the switch directly connected with the intelligent distribution network address system is 1, the number of the next neighbor switch is 2, and so on, and the numbers are 3, 4, 5 and 6 respectively;
if the network address of switch 1 is not 10.10.1.5, the management address of switch number 1 is set to 10.10.1.5 by remote access technology;
if the network address of switch 2 is not 10.10.2.5, the management address of switch number 2 is set to 10.10.2.5;
if the network address of switch 3 is not 10.10.3.5, the management address of switch number 3 is set to 10.10.3.5;
if the network address of switch 4 is not 10.10.4.5, the management address of switch No. 4 is set to 10.10.4.5;
if the network address of the switch 5 is not 10.10.5.5, the management address of the switch numbered 5 is set to 10.10.5.5;
if the network address of switch 6 is not 10.10.6.5, the management address of switch No. 6 is set to 10.10.6.5;
storing the relative position information of all the switches into a local host address list, wherein the host address list comprises the following fields: switch mac address, switch management address, relative position code, port code, vlan code, port forwarding mac address, host network address, etc.
And secondly, acquiring a port forwarding mac address list.
Acquiring port forwarding mac address lists of the switches 1, 2, 3, 4, 5 and 6 by a remote access technology;
updating and storing all port forwarding mac address lists in a local host address list;
calculating the network address of the host by the relative position code of the switch, the port code, the vlan to which the port belongs and other rules comprises the following addresses:
the network address of port 3 of access switch 1 is: 10.12.1.8, respectively;
the network address of port 7 of access switch 1 is: 10.13.1.12, respectively;
the network address of port 6 of access switch 2 is: 10.12.2.11, respectively;
the network address of port 7 of access switch 3 is: 10.13.3.12, respectively;
the network address of port 4 of access switch 5 is: 10.12.5.9, respectively;
the subnet masks are all 255.255.0.0;
and thirdly, acquiring the dynamic host configuration request information of the host equipment.
Monitoring the dynamic host configuration request information of the host equipment through the virtual network card, and successfully acquiring the dynamic host configuration request information of the host equipment 1, 2, 3, 4 or 5;
the fourth step: the requester mac address is extracted from the dynamic host configuration request message.
And extracting a requesting mac address from the acquired dynamic host configuration request information according to a DHCP standard protocol or other protocols, wherein the requesting mac address is a unique identity characteristic for uniquely identifying the requesting host.
The fifth step: a host network address is obtained.
Searching a position code and a port code in a host address list through the mac address of the requester, and turning to the second step if a corresponding record is not searched;
if the number of the searched records exceeds 1, after waiting for forwarding the mac address keep-alive time, designating all the switches in the repeated records as target switches, and turning to the second step;
if the number of the successfully searched records is only 1, acquiring the network address of the host from the records;
and a sixth step: sending a dynamic host configuration request response frame to a requester;
and packaging the network address of the host and the mac address of the requester into a dynamic host configuration request response frame according to a DHCP protocol or a private protocol, and sending the dynamic host configuration request response frame to the requester.
The switches in the above description are all referred to as managed switches if they are not specified as unmanaged switches;
the invention also provides a system for intelligently distributing the network address.
Referring to fig. 5, the system for intelligently allocating network addresses includes a memory, a processor, and a computer program stored in the memory, wherein the computer program, when executed by the processor, implements the steps of the method for intelligently allocating network addresses.
The invention also provides a server.
The server stores a computer program which, when executed by a processor, implements the steps of the method for intelligently allocating network addresses.
The server may be a DHCP server.
The invention also provides a computer readable storage medium.
The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the method for intelligently allocating network addresses.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for intelligently assigning network addresses, comprising:
acquiring network topology information of each switch; the network topology information comprises an identity identification code, a relative position code, a port code and port virtual local area network information corresponding to any switch;
generating host address data of each host end according to the network topology information and a preset address generation algorithm;
acquiring a port mac incidence relation, and generating position mac data according to the port mac incidence relation and the network topology information; wherein, the port mac association relationship is used for representing the association between the port code and the host mac address of the host end;
acquiring dynamic host configuration request information, and extracting a mac address of a requester from the dynamic host configuration request information;
when the matched position mac data is retrieved according to the requester mac address, extracting the combination of the relative position code, the port code and the corresponding host mac address of the switch from the position mac data;
when the combination is unique and the matched host address data is retrieved according to the relative position code and the port code, extracting the corresponding network address of the host end from the host address data;
and encapsulating the obtained network address and the corresponding mac address of the requester into a response frame, and sending the response frame to the requester.
2. The method for intelligently allocating network addresses according to claim 1, wherein the step of obtaining the network topology information of the switch specifically includes the following steps:
acquiring network topology information of the switch and storing the network topology information to the local;
acquiring state information of a cascade port of the switch in real time, and judging whether the state information changes;
and when the state information of the cascade port is changed, the network topology information of the switch is obtained again and is updated and stored locally.
3. The method according to claim 2, wherein the step of generating host address data of each host according to the network topology information and a preset address generation algorithm specifically includes the following steps:
judging whether a host network address allocation strategy is stored locally;
when a host network address allocation strategy is stored locally, extracting the network address from the host network address allocation strategy, and generating the host address data according to the network topology information and the network address;
or generating the host address data according to the network topology information and the host network address allocation strategy;
and when the host network address allocation strategy is not stored locally, calculating and generating the network address according to the network topology information, and generating the host address data according to the network topology information and the network address.
4. The method according to claim 3, wherein the step of obtaining the port mac association relationship and generating the location mac data according to the port mac association relationship and the network topology information specifically includes the following steps:
acquiring the port mac incidence relation, and primarily generating the position mac data according to the port mac incidence relation and the network topology information;
storing the position mac data generated for the first time to the local;
acquiring state information of a direct connection port of the switch in real time, and judging whether the state information changes or not;
when the state information of the directly connected port changes, the port mac incidence relation is obtained again, and new position mac data are generated again according to the updated port mac incidence relation and the network topology information;
and updating and storing the position mac data to the local.
5. The method for intelligently assigning network addresses according to claim 4, further comprising the steps of:
and when the matched position mac data cannot be retrieved according to the mac address of the requester, entering a step of acquiring a port mac incidence relation and generating position mac data according to the port mac incidence relation and the network topology information.
6. The method for intelligently assigning network addresses according to claim 5, further comprising the steps of:
and when the combination is not unique, performing the step of reacquiring the port mac incidence relation and generating new position mac data again according to the updated port mac incidence relation and the network topology information.
7. The method for intelligently assigning network addresses according to claim 6, further comprising the steps of:
when the combination is unique and no matching host address data is retrieved according to the relative position code and the port code;
and entering the step of calculating and generating the network address according to the network topology information and generating the host address data according to the network topology information and the network address.
8. A system for intelligent allocation of network addresses, comprising a memory, a processor and a computer program stored in said memory, which computer program, when executed by said processor, carries out the steps of the method for intelligent allocation of network addresses according to any one of claims 1 to 7.
9. A server, characterized in that a computer program is stored in the server, which computer program, when being executed by a processor, carries out the steps of the method for intelligently allocating network addresses according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method for intelligently allocating network addresses according to any one of claims 1-7.
CN202010819695.1A 2020-08-14 2020-08-14 Method, system, server and readable storage medium for intelligently allocating network addresses Active CN111935334B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010819695.1A CN111935334B (en) 2020-08-14 2020-08-14 Method, system, server and readable storage medium for intelligently allocating network addresses

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010819695.1A CN111935334B (en) 2020-08-14 2020-08-14 Method, system, server and readable storage medium for intelligently allocating network addresses

Publications (2)

Publication Number Publication Date
CN111935334A true CN111935334A (en) 2020-11-13
CN111935334B CN111935334B (en) 2022-09-20

Family

ID=73310354

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010819695.1A Active CN111935334B (en) 2020-08-14 2020-08-14 Method, system, server and readable storage medium for intelligently allocating network addresses

Country Status (1)

Country Link
CN (1) CN111935334B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113132508A (en) * 2021-04-12 2021-07-16 程剑飞 Address configuration method and device, computer equipment and embedded network system
CN114465984A (en) * 2022-04-12 2022-05-10 浙江中控研究院有限公司 Address allocation method, system, device and computer readable storage medium based on transmission path

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6771643B1 (en) * 2000-04-28 2004-08-03 Lucent Technologies Inc. Interconnecting packet switches
CN101083578A (en) * 2006-05-29 2007-12-05 中国移动通信集团公司 Method for distributing address for intelligent information household electronic equipments in household network
US20090172156A1 (en) * 2007-12-29 2009-07-02 Cisco Technology, Inc. Address security in a routed access network
US20150169351A1 (en) * 2012-08-31 2015-06-18 Hangzhou H3C Technologies Co., Ltd. Configuring virtual media access control addresses for virtual machines
CN106790741A (en) * 2016-11-24 2017-05-31 上海易杵行智能科技有限公司 A kind of method that cascade device based on link layer data communications distributes the network address automatically
US10142160B1 (en) * 2011-10-04 2018-11-27 Big Switch Networks, Inc. System and methods for managing network hardware address requests with a controller
CN109040332A (en) * 2018-07-05 2018-12-18 湖南铁路科技职业技术学院 train control Ethernet addressing method and system
CN110445772A (en) * 2019-07-22 2019-11-12 武汉安问科技发展有限责任公司 A kind of the internet host scan method and system of Intrusion Detection based on host relationship

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6771643B1 (en) * 2000-04-28 2004-08-03 Lucent Technologies Inc. Interconnecting packet switches
CN101083578A (en) * 2006-05-29 2007-12-05 中国移动通信集团公司 Method for distributing address for intelligent information household electronic equipments in household network
US20090172156A1 (en) * 2007-12-29 2009-07-02 Cisco Technology, Inc. Address security in a routed access network
US10142160B1 (en) * 2011-10-04 2018-11-27 Big Switch Networks, Inc. System and methods for managing network hardware address requests with a controller
US20150169351A1 (en) * 2012-08-31 2015-06-18 Hangzhou H3C Technologies Co., Ltd. Configuring virtual media access control addresses for virtual machines
CN106790741A (en) * 2016-11-24 2017-05-31 上海易杵行智能科技有限公司 A kind of method that cascade device based on link layer data communications distributes the network address automatically
CN109040332A (en) * 2018-07-05 2018-12-18 湖南铁路科技职业技术学院 train control Ethernet addressing method and system
CN110445772A (en) * 2019-07-22 2019-11-12 武汉安问科技发展有限责任公司 A kind of the internet host scan method and system of Intrusion Detection based on host relationship

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
周俊生: "异构IP网络的物理拓扑自动发现算法的研究与实现", 《计算机应用与软件》 *
陈旭: "一种基于SNMP的以太网拓扑自动发现算法", 《太原理工大学学报》 *
高强等: "基于MAC地址VLAN划分的实际应用", 《电脑知识与技术》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113132508A (en) * 2021-04-12 2021-07-16 程剑飞 Address configuration method and device, computer equipment and embedded network system
CN113132508B (en) * 2021-04-12 2023-06-30 程剑飞 Address configuration method, address configuration device, computer equipment and embedded network system
CN114465984A (en) * 2022-04-12 2022-05-10 浙江中控研究院有限公司 Address allocation method, system, device and computer readable storage medium based on transmission path

Also Published As

Publication number Publication date
CN111935334B (en) 2022-09-20

Similar Documents

Publication Publication Date Title
CN107733670B (en) Forwarding strategy configuration method and device
CN101199161B (en) Method and system for dynamic assignment of wireless LAN access point identity
US5991828A (en) System for automatically connecting portable device to network using network environment information including domain name of naming device and community name of network management protocol
CN105577420A (en) Method and system for automatic generation of server network topology
CN111935334B (en) Method, system, server and readable storage medium for intelligently allocating network addresses
WO2012157017A1 (en) Computer system for allocating ip address to communication apparatus in computer subsystem newly added and method for newly adding computer subsystem to computer system
CN114024880B (en) Network target range probe acquisition method and system based on proxy IP and flow table
CN105245629A (en) DHCP-based host communication method and device
CN104901825B (en) A kind of method and apparatus for realizing zero configuration starting
US9819641B2 (en) Method of and a processing device handling a protocol address in a network
CN108134856A (en) A kind of virtualization MAC Address anti-collision method and device based on network tree
CN104734930B (en) Method and device for realizing access of Virtual Local Area Network (VLAN) to Variable Frequency (VF) network and Fiber Channel Frequency (FCF)
WO2016202016A1 (en) Device management method, apparatus and system
CN110851238A (en) Implementation method of openstack fully-distributed dhcp service
CN104104749A (en) Method and device for allocating tunnel IP addresses
US20150229520A1 (en) Network monitoring system, communication device, network management method
CN105357332B (en) A kind of method for network address translation and device
CN111010425A (en) Server connection method, load balancing equipment and electronic equipment
CN116566832A (en) Method and device for generating network topology information, storage medium and processor
CN104683491B (en) A kind of method and system for the Internet Protocol address for obtaining virtual machine
WO2015196719A1 (en) Address configuration method, apparatus and device
CN102377830A (en) IP (Internet Protocol) address configuration method
CN111865749B (en) Port binding method and device
CN110868450B (en) Dual-computer room multi-entrance session keeping method, system, device and storage medium
CN112468400A (en) Fault positioning method, device, equipment and medium

Legal Events

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