CN110460687A - Recognition methods, device and the storage medium of a kind of IP address distribution port - Google Patents
Recognition methods, device and the storage medium of a kind of IP address distribution port Download PDFInfo
- Publication number
- CN110460687A CN110460687A CN201910751822.6A CN201910751822A CN110460687A CN 110460687 A CN110460687 A CN 110460687A CN 201910751822 A CN201910751822 A CN 201910751822A CN 110460687 A CN110460687 A CN 110460687A
- Authority
- CN
- China
- Prior art keywords
- address
- port
- internet
- mac address
- things terminal
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/10—Mapping addresses of different types
- H04L61/103—Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
- H04L61/5014—Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5053—Lease time; Renewal aspects
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
Abstract
The present invention provides recognition methods, device and the storage mediums of a kind of IP address distribution port, which comprises receives the IP packet that internet-of-things terminal is sent, the MAC Address and IP address of the internet-of-things terminal are parsed from the IP packet;According to parse MAC Address, IP address, corresponding relationship between the MAC Address of each port internet-of-things terminal connected to it obtained in advance identifies port corresponding with the IP address.The present invention from the IP packet received by parsing the MAC Address and IP address of internet-of-things terminal, and the MAC Address parsed, IP address are matched with the corresponding relationship between the MAC Address of each port internet-of-things terminal connected to it obtained in advance, determine the IP address of each port assignment and its internet-of-things terminal of connection, convenient maintenance and replacement to internet-of-things terminal.
Description
Technical field
The present invention relates to network communication technology field more particularly to a kind of IP address distribution port recognition methods,
Device and storage medium.
Background technique
Existing routing device, as shown in Fig. 2, being made of master cpu and exchange chip, master cpu provides router association
Discuss and support dhcp server functionality, exchange chip to have a uplink port P8 and four downlink port P0~P3, uplink port
P8 is connect with CPU network interface eth0, and four downlink port P0~P3 can be directly connected to downstream plant, the message that downstream plant is sent
It is forwarded to CPU network interface eth0 by exchange chip, and respective handling is carried out to message by CPU protocol stack.
But existing routing device only has message forwarding capability, and the IP address of distribution cannot be identified in which downstream end
Mouth or the specific equipment of each downlink port connection.When a certain equipment message forwarding when something goes wrong, need to be traversed for routing
All downlink ports of equipment come determine the equipment connection specific downlink port, it is cumbersome.
Therefore, the existing technology needs further improvement.
Summary of the invention
In view of the above shortcomings in the prior art, the purpose of the present invention is to provide a kind of IP address distribution ports
Recognition methods, device and storage medium, overcome in the prior art routing device only have message forwarding capability, and cannot identify point
The specific equipment of specific downlink port or the connection of each downlink port with IP address, occurs when a certain equipment message forwards
When problem, all downlink ports of routing device are needed to be traversed for determine the specific downlink port of equipment connection, are operated numerous
Trivial defect.
First embodiment disclosed in this invention is the recognition methods that a kind of IP address distributes port, wherein including following
Step:
The IP packet that internet-of-things terminal is sent is received, the MAC of the internet-of-things terminal is parsed from the IP packet
Location and IP address;
According to parse MAC Address, IP address, from each port internet-of-things terminal connected to it obtained in advance
Corresponding relationship between MAC Address identifies port corresponding with the IP address.
The recognition methods of the IP address distribution port, wherein the IP packet for receiving internet-of-things terminal and sending, from
Include: before the step of parsing the MAC Address and IP address of the internet-of-things terminal in the IP packet
The MAC Address for obtaining the internet-of-things terminal of each port connection, it is connected to it to establish each port
Should be related between the MAC Address of internet-of-things terminal, and the corresponding relationship is stored in address register.
The recognition methods of the IP address distribution port, wherein the Internet of Things for obtaining each port connection
The MAC Address of terminal establishes the corresponding relationship between the MAC Address of each port internet-of-things terminal connected to it, and
The corresponding relationship is stored in after the step in address register and includes:
Each port is scanned every preset time, obtains the internet-of-things terminal of each port connection
MAC Address;
The corresponding MAC in each port for judging to store in the MAC Address and the address register that get
Whether address is consistent, if inconsistent, updates each port internet-of-things terminal connected to it in the address register
MAC Address between corresponding relationship.
The recognition methods of the IP address distribution port, wherein the IP packet for receiving internet-of-things terminal transmission
Include: before step
It is promiscuous mode by the mode setting for receiving message, creation raw socket receives message;
Judge whether the message received is IP packet, if it is not, then abandoning the message.
The recognition methods of the IP address distribution port, wherein described to judge whether the message received is IP
The step of message includes:
Judge whether include the protocol number of IP packet in the message received, if so, judging that the message is
IP packet.
The recognition methods of the IP address distribution port, wherein the IP packet for receiving internet-of-things terminal and sending, from
The step of MAC Address and IP address of the internet-of-things terminal are parsed in the IP packet include:
The IP packet that internet-of-things terminal is sent is received, function is obtained by address and parses the object from the IP packet
The MAC Address and IP address of networked terminals.
The recognition methods of described IP address distribution port, wherein MAC Address that the basis parses, IP address, from
Corresponding relationship between the MAC Address of each port internet-of-things terminal connected to it obtained in advance identifies and the IP
The step of corresponding port in address includes:
By the MAC Address parsed, the MAC of IP address and each port internet-of-things terminal connected to it obtained in advance
Corresponding relationship between address is compared, and judges that the MAC Address parsed and the MAC Address in the corresponding relationship are
It is no identical;
Using the port in the corresponding relationship identical with the MAC Address parsed as corresponding with the IP address
Port.
The recognition methods of the IP address distribution port, wherein the preset time is 1 second.
The identification device of a kind of IP address distribution port, wherein include: processor, the storage that is connect with processor communication
Medium, the storage medium are suitable for storing a plurality of instruction;The processor is suitable for calling the instruction in the storage medium, to hold
Row realizes the step of recognition methods of IP address distribution described in any of the above embodiments port.
A kind of storage medium, wherein the control of the recognition methods of IP address distribution port is stored on the storage medium
The control program of program, the recognition methods of IP address distribution port realizes the IP address distribution when being executed by processor
The step of recognition methods of port.
Beneficial effect, the present invention provides recognition methods, device and the storage mediums of a kind of IP address distribution port, receive
The IP packet that internet-of-things terminal is sent, parses the MAC Address and IP address of the internet-of-things terminal from the IP packet;Root
According to parse MAC Address, IP address, from the MAC Address of each port internet-of-things terminal connected to it obtained in advance it
Between corresponding relationship, identify port corresponding with the IP address.Method, apparatus of the present invention and storage medium,
By parsing the MAC Address and IP address of internet-of-things terminal from the IP packet received, and by the MAC Address parsed,
Corresponding relationship progress between IP address and the MAC Address of each port internet-of-things terminal connected to it obtained in advance
Match, determines the IP address of each port assignment and its internet-of-things terminal of connection, convenient maintenance and replacement to internet-of-things terminal.
Detailed description of the invention
Fig. 1 is the flow chart of the preferred embodiment of the recognition methods of IP address distribution provided by the present invention port;
Fig. 2 is the structure chart of existing route equipment;
Fig. 3 is the flow chart of the concrete application embodiment of the recognition methods of IP address distribution provided by the present invention port;
Fig. 4 is the schematic diagram of the function of the device of the invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer and more explicit, right as follows in conjunction with drawings and embodiments
The present invention is further described.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and do not have to
It is of the invention in limiting.
Only have message forwarding capability to solve existing route equipment, and cannot identify the specific downlink of distribution IP address
Port or each downlink port connection specific equipment, when a certain equipment message forwarding when something goes wrong, need to be traversed for road
The specific downlink port of equipment connection, cumbersome problem are determined by all downlink ports of equipment.The present invention mentions
A kind of recognition methods of IP address distribution port is supplied.
Fig. 1 is please referred to, Fig. 1 is a kind of preferred embodiment of the recognition methods of IP address distribution port provided by the invention
Flow chart.
In example 1, the recognition methods of IP address distribution port has two steps:
S100, the IP packet that internet-of-things terminal is sent is received, the internet-of-things terminal is parsed from the IP packet
MAC Address and IP address;
S200, the MAC Address according to parsing, IP address, from each port Internet of Things connected to it obtained in advance
Corresponding relationship between the MAC Address of terminal identifies port corresponding with the IP address.
When it is implemented, being carried out when routing device distributes IP address by Dynamic Host Configuration Protocol server according to the principle first distributed first
Distribution, after distributing IP address, before lease does not expire in current address, is connected to the internet-of-things terminal on port
MAC Address and the IP address of distribution just establish binding relationship, and no matter the internet-of-things terminal is connected to which port, routing device
Still IP address before can be again assigned to the internet-of-things terminal.Such as shown in Fig. 2, internet-of-things terminal PC1 is connected to end
When mouth P3, the IP address 192.168.100.1 in address pool is distributed to internet-of-things terminal PC1 by routing device, and writes down PC1's
MAC Address, such MAC Address 00:25:d0:11:22:23 and IP address 192.168.100.1 just establish corresponding relationship.In
Before address lease is not yet due, which port no matter PC1 be inserted in, and routing device all distributes to IP address 192.168.100.1
PC1。
The IP packet sent in the present embodiment by receiving internet-of-things terminal, due in the IP packet of internet-of-things terminal transmission
Comprising its MAC Address and IP address, with can be parsed out MAC Address and the IP of the internet-of-things terminal from the IP packet
Location.By the MAC Address parsed, the MAC Address of IP address and each port internet-of-things terminal connected to it obtained in advance
Between corresponding relationship matched, so that it may identify the IP address of each port assignment, and IP address is and Internet of Things is whole
The MAC Address binding at end, the MAC Address of each internet-of-things terminal is unique, it is determined that the IP address of each port assignment,
Also the internet-of-things terminal of each port connection has been determined that.Fig. 2 is continued back at, the IP of internet-of-things terminal PC1 transmission is such as received
Message, the MAC Address that the internet-of-things terminal PC1 can be parsed from the IP packet is 00:25:d0:11:22:33, IP
Location is 192.168.100.1.And there are corresponding relationships between the MAC Address of each port internet-of-things terminal connected to it, such as
Internet-of-things terminal PC1 is connected to the port P3, then there are corresponding relationships for the MAC Address of the port P3 and PC1, by the PC1's parsed
MAC Address, IP address are matched with the corresponding relationship of the port of PC1 connection, so that it may which the IP address for determining the port P3 is
192.168.100.1, i.e., the port P3 connect internet-of-things terminal PC1, when internet-of-things terminal PC1 send message when something goes wrong, just
Whether the port P3 that its connection can be directly viewable is problematic, easy to operate.
In the present embodiment, it is further comprised the steps of: before the step S100
S10, the MAC Address for obtaining the internet-of-things terminal that each port connects, establish each port and connect with it
Should be related between the MAC Address of the internet-of-things terminal connect, and the corresponding relationship is stored in address register;
When it is implemented, the Internet of Things that can learn connection is whole when the downlink port of exchange chip connects internet-of-things terminal
The MAC Address at end, and the MAC Address is stored in address register (ARL register), routing device is read by CPU
ARL register it is known that the internet-of-things terminal that each port learns MAC Address.Such as when PC1 is connected to the port P3
When, the port P3 study to MAC Address is 00:25:d0:11:22:33, and saves it in ARL register;PC2 is connected to the end P0
Mouthful, the port P0 study to MAC Address is 00:25:d0:11:22:44, routing device is known that by reading ARL register
The MAC Address for the internet-of-things terminal that the port P0 and the port P3 learn.
In the present embodiment, it is further comprised the steps of: after the step S10
S20, each port is scanned every preset time, the Internet of Things for obtaining each port connection is whole
The MAC Address at end;
The each port stored in the MAC Address and the address register that S30, judgement are got is corresponding
Whether MAC Address is consistent, if inconsistent, it is whole to update each port Internet of Things connected to it in the address register
Corresponding relationship between the MAC Address at end.
In view of in real process, the corresponding internet-of-things terminal in each port and MAC Address are not fixed and invariable, I
Internet-of-things terminal PC1 can be connect with port P3, internet-of-things terminal PC1 can also be connect with other ports.Therefore, originally
Setting is scanned every each terminal of the preset time to the routing device in embodiment, obtains each terminal connection
Internet-of-things terminal MAC Address.And judge to rescan each end stored in the MAC Address and address register got
Whether the corresponding MAC Address of mouth is consistent.If consistent, no change has taken place for the internet of things equipment of each port connection;It is no
Then, each port internet-of-things terminal connected to it in address register is updated according to rescaning the MAC Address got
Corresponding relationship between MAC Address.As shown in Fig. 2, starting the corresponding MAC Address in the port P3 when scanning is 00:25:d0:11:
The corresponding MAC Address in the port 22:33, P0 be 00:25:d0:11:22:44, and P1 and P2 due to do not have connect internet-of-things terminal and
There is no corresponding MAC Address.Each port is rescaned every preset time, the corresponding MAC Address of port P2 is arrived in scanning
For 00:25:d0:11:22:33, and P3 does not have corresponding MAC Address, illustrates that PC1 is connected to port P2, then deposits address
The corresponding MAC Address of device middle port P3 is deleted, and P2 corresponding MAC Address in port is updated to 00:25:d0:11:22:33.Specifically
When implementation, the default sweep time in the present embodiment can set according to user, it is preferable that described in the present embodiment
Preset time is 1 second.When replacing the connectivity port of internet-of-things terminal, due to every 1 second will each port of multiple scanning it is corresponding
MAC Address, therefore that each port Internet of Things connected to it can be updated after most 1 seconds is whole for internet of things equipment replacement connectivity port
Hold the corresponding relationship between MAC Address.
When it is implemented, being further comprised the steps of: before step S100 described in the present embodiment
It S40, is promiscuous mode by the mode setting for receiving message, creation raw socket receives message;
Whether the message that S50, judgement receive is IP packet, if it is not, then abandoning the message.
When it is implemented, raw socket (raw socket) can be pre-created in the present embodiment to receive message, pass through
Raw socket, which can receive, is sent to the machine but IP packet that TCP/IP stack can not be handled, or for sending some oneself formulate
The IP packet of the special effects such as source address.Then promiscuous mode is set by the network interface of routing device, routing device is connect
Receive all messages.The CPU network interface eth0 of routing device carries out packet capturing to the message received after receiving message, judges to receive
To message whether be IP packet.Since the MAC Address and IP address of internet-of-things terminal could be obtained only from IP packet, this
In embodiment before being parsed to the message got, the message got is filtered in advance, filters out IP packet
It is parsed again, if not IP packet then directly abandons, reduces the workload of equipment.
When it is implemented, judge in the present embodiment the message received whether be IP packet method judgement receive
In message whether include IP packet protocol number.It include protocol number 0x0800 in message if message is IP packet, this
It whether include that protocol number 0x0800 can determine whether the message is IP packet in the message received in embodiment by judgement.
In the present embodiment, the step S100 specifically includes step:
S110, the IP packet that internet-of-things terminal is sent is received, function is obtained by address and is parsed from the IP packet
The MAC Address and IP address of the internet-of-things terminal;
When it is implemented, being sent eventually when the message for judging to receive is IP packet due to carrying message in IP packet
The MAC Address and IP address at end, by the MAC for parsing the available internet-of-things terminal for sending the IP packet of the IP packet
Address and IP address.The MAC Address of internet-of-things terminal is parsed from the IP packet in the present embodiment and the method for IP address is
The MAC Address and IP address that function, that is, recvfrom function obtains internet-of-things terminal from the IP packet are obtained by address,
Recvfrom function can receive data from socket, and capture the address of data transmission source.Such as the IP report received
Text is what internet-of-things terminal PC2 was sent, then can be parsed out MAC Address by recvfrom function is 00:25:d0:11:22:
44, IP address 192.168.100.2 establish the first corresponding relationship between the MAC Address got and IP address, with after an action of the bowels
The corresponding relationship of port and the IP address is determined in continuous step.
In the present embodiment, the step S200 specifically includes step:
S210, by the MAC Address parsed, IP address and each port internet-of-things terminal connected to it in advance obtained
MAC Address between corresponding relationship be compared, judge the MAC in the MAC Address parsed and the corresponding relationship
Whether address is identical;
S220, using the port in the corresponding relationship identical with the MAC Address parsed as with the IP
The corresponding port in location.
When it is implemented, will further be parsed in the present embodiment after parsing MAC Address and IP address in IP packet
Between the MAC Address of each port internet-of-things terminal connected to it got in MAC Address and IP address and abovementioned steps
Corresponding relationship be compared, judge whether the MAC Address parsed and the MAC Address in the corresponding relationship identical.
By abovementioned steps it is found that internet terminal need by routing device send message, then its be necessarily required to routing device certain
One specific port connection, then certainly existed in the corresponding relationship send the MAC Address of the internet terminal of IP packet with it is a certain
The corresponding relationship of specific port, by the way that port and MAC Address in MAC Address and IP address and the corresponding relationship will be parsed
It is compared, identifies that the port in the second corresponding relationship identical with the MAC Address parsed is transmission IP packet
The corresponding port of internet terminal and the corresponding port of the IP address.For example, being mentioned from IP packet in abovementioned steps
Parse MAC Address be 00:25:d0:11:22:44, IP address 192.168.100.2, and in the corresponding relationship with MAC
The corresponding port address 00:25:d0:11:22:44 is the port P0, by comparing it is known that PC2 is connected to the port P0, the end P0
The IP address of mouth distribution is 192.168.100.2.
Technology for a better understanding of the present invention, the present invention also provides a kind of specific Application Examples, such as institute in Fig. 3
Show, specifically comprises the following steps:
Step 301 obtains corresponding relationship between the MAC Address of each port internet-of-things terminal connected to it;
Step 302 receives message;
Step 303 judges whether message is IP packet, if it is not, thening follow the steps 302;If so, thening follow the steps 304;
Step 304 parses MAC Address and IP address from message;
Step 305 compares the MAC Address in the MAC Address and corresponding relationship that parse;
Whether the MAC Address in MAC Address and corresponding relationship that step 306, judgement parse is identical, if it is not, then executing
Step 305;If so, thening follow the steps 307;
Step 307 identifies port in corresponding relationship as the corresponding port of IP address.
Based on the above embodiment, the present invention also provides a kind of identification device of IP address distribution port, functional block diagrams
It can be as shown in Figure 4.The device includes processor, memory, network interface, display screen and the temperature connected by system bus
Sensor.Wherein, the processor of the device is for providing calculating and control ability.The memory of the device includes non-volatile deposits
Storage media, built-in storage.The non-volatile memory medium is stored with operating system and computer program.The built-in storage is non-easy
The operation of operating system and computer program in the property lost storage medium provides environment.The network interface of the device is used for and outside
Terminal by network connection communication.The identification side of IP address distribution port is realized when the computer program is executed by processor
Method.The display screen of the device can be liquid crystal display or electric ink display screen, and the temperature sensor of the device is preparatory
Portion is arranged in the device, for detecting the current running temperature of internal unit.
It will be understood by those skilled in the art that functional block diagram shown in Fig. 4, only portion relevant to the present invention program
The block diagram of separation structure does not constitute the restriction for the device that the system described in the present invention program is applied thereon, and specific device can
To include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of identification device of IP address distribution port, including memory and processor are provided,
Computer program is stored in memory, which at least may be implemented following steps when executing computer program:
The IP packet that internet-of-things terminal is sent is received, the MAC of the internet-of-things terminal is parsed from the IP packet
Location and IP address;
According to parse MAC Address, IP address, from each port internet-of-things terminal connected to it obtained in advance
Corresponding relationship between MAC Address identifies port corresponding with the IP address.
In one of them embodiment, which can also realize when executing computer program: obtain each described
Port connection internet-of-things terminal MAC Address, establish each port internet-of-things terminal connected to it MAC Address it
Between should be related to, and the corresponding relationship is stored in address register.
In one of them embodiment, which can also realize when executing computer program: every preset time
Each port is scanned, the MAC Address of the internet-of-things terminal of each port connection is obtained;What judgement was got
Whether the corresponding MAC Address in each port stored in the MAC Address and the address register is consistent, if different
It causes, then updates the correspondence in the address register between the MAC Address of each port internet-of-things terminal connected to it
Relationship.
In one of them embodiment, which can also realize when executing computer program: will receive message
Mode setting is promiscuous mode, and creation raw socket receives message;Judge whether the message received is IP packet, if
It is no, then abandon the message.
In one of them embodiment, which can also realize when executing computer program: judge to receive
Whether include the protocol number of IP packet in the message, if so, judging the message for IP packet.
In one of them embodiment, which can also realize when executing computer program: it is whole to receive Internet of Things
Hold send IP packet, by address obtain function parsed from the IP packet internet-of-things terminal MAC Address and
IP address.
In one of them embodiment, which can also realize when executing computer program: the MAC that will be parsed
Corresponding relationship between address, IP address and the MAC Address of each port internet-of-things terminal connected to it obtained in advance into
Row compares, and judges whether the MAC Address parsed and the MAC Address in the corresponding relationship are identical;By with parse
Port in the identical corresponding relationship of the MAC Address is as port corresponding with the IP address.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer
In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,
To any reference of memory, storage, database or other media used in each embodiment provided by the present invention,
Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM
(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include
Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms,
Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing
Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
In conclusion the present invention provides recognition methods, device and the storage medium of a kind of IP address distribution port, it is described
Method includes: the IP packet for receiving internet-of-things terminal and sending, the MAC of the internet-of-things terminal is parsed from the IP packet
Location and IP address;According to parse MAC Address, IP address, from each port for obtaining in advance, Internet of Things connected to it is whole
Corresponding relationship between the MAC Address at end identifies port corresponding with the IP address.The present invention is by from receiving
The MAC Address and IP address of internet-of-things terminal are parsed in IP packet, and are obtained the MAC Address parsed, IP address and in advance
Corresponding relationship between the MAC Address of each port internet-of-things terminal connected to it taken is matched, and determines each port
The IP address of distribution and its internet-of-things terminal of connection, convenient maintenance and replacement to internet-of-things terminal.
It should be understood that system application of the invention is not limited to above-mentioned citing, those of ordinary skill in the art are come
It says, it can be modified or changed according to the above description, and all these modifications and variations all should belong to right appended by the present invention and want
The protection scope asked.
Claims (10)
1. a kind of recognition methods of IP address distribution port, which comprises the following steps:
Receive internet-of-things terminal send IP packet, parsed from the IP packet internet-of-things terminal MAC Address and
IP address;
According to parse MAC Address, IP address, from the MAC of each port internet-of-things terminal connected to it obtained in advance
Corresponding relationship between address identifies port corresponding with the IP address.
2. the recognition methods of IP address distribution according to claim 1 port, which is characterized in that the reception Internet of Things is whole
Hold the IP packet sent, the step of from the MAC Address and IP address for parsing the internet-of-things terminal in the IP packet before
Include:
The MAC Address for obtaining the internet-of-things terminal of each port connection, establishes each port Internet of Things connected to it
Should be related between the MAC Address of network termination, and the corresponding relationship is stored in address register.
3. the recognition methods of IP address distribution according to claim 2 port, which is characterized in that the acquisition is each described
Port connection internet-of-things terminal MAC Address, establish each port internet-of-things terminal connected to it MAC Address it
Between corresponding relationship, and the corresponding relationship is stored in after the step in address register and includes:
Each port is scanned every preset time, obtains the MAC of the internet-of-things terminal of each port connection
Address;
The corresponding MAC Address in each port for judging to store in the MAC Address and the address register that get
It is whether consistent, if inconsistent, update the MAC of each port internet-of-things terminal connected to it in the address register
Corresponding relationship between address.
4. the recognition methods of IP address distribution according to claim 1 port, which is characterized in that the reception Internet of Things is whole
Include: before the step of holding the IP packet sent
It is promiscuous mode by the mode setting for receiving message, creation raw socket receives message;
Judge whether the message received is IP packet, if it is not, then abandoning the message.
5. the recognition methods of IP address distribution according to claim 4 port, which is characterized in that the judgement received
The step of whether message is IP packet include:
Judge whether include the protocol number of IP packet in the message received, if so, judging the message for IP report
Text.
6. the recognition methods of IP address distribution according to claim 1 port, which is characterized in that the reception Internet of Things is whole
The IP packet sent is held, the step of MAC Address and IP address of the internet-of-things terminal are parsed from the IP packet includes:
The IP packet that internet-of-things terminal is sent is received, function is obtained by address and parses the Internet of Things from the IP packet
The MAC Address and IP address of terminal.
7. the recognition methods of IP address distribution according to claim 1 port, which is characterized in that the basis parsed
MAC Address, IP address, from the corresponding pass between the MAC Address of each port internet-of-things terminal connected to it obtained in advance
System, the step of identifying port corresponding with the IP address include:
By the MAC Address parsed, the MAC Address of IP address and each port internet-of-things terminal connected to it obtained in advance
Between corresponding relationship be compared, judge the MAC Address parsed and the MAC Address in the corresponding relationship whether phase
Together;
Using and the identical corresponding relationship of the MAC Address that parses in port as end corresponding with the IP address
Mouthful.
8. the recognition methods of IP address distribution according to claim 3 port, which is characterized in that the preset time is 1
Second.
9. a kind of identification device of IP address distribution port characterized by comprising processor is connect with processor communication
Storage medium, the storage medium are suitable for storing a plurality of instruction;The processor is suitable for calling the instruction in the storage medium,
To execute the step of recognition methods for realizing the claims 1-8 described in any item IP address distribution port.
10. a kind of storage medium, which is characterized in that be stored with the recognition methods of IP address distribution port on the storage medium
Program is controlled, the control program of the recognition methods of IP address distribution port realizes such as claim 1- when being executed by processor
IP address described in any one of 8 distributes the step of recognition methods of port.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910751822.6A CN110460687B (en) | 2019-08-15 | 2019-08-15 | Method, device and storage medium for identifying IP address allocation port |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910751822.6A CN110460687B (en) | 2019-08-15 | 2019-08-15 | Method, device and storage medium for identifying IP address allocation port |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110460687A true CN110460687A (en) | 2019-11-15 |
CN110460687B CN110460687B (en) | 2022-04-19 |
Family
ID=68486742
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910751822.6A Active CN110460687B (en) | 2019-08-15 | 2019-08-15 | Method, device and storage medium for identifying IP address allocation port |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110460687B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112261171A (en) * | 2020-10-19 | 2021-01-22 | 天津津航计算技术研究所 | Method for determining IP camera position based on Ethernet protocol |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060195900A1 (en) * | 2005-02-28 | 2006-08-31 | Yao-Chih Yeh | Network apparatus with secure IPSec mechanism and method for operating the same |
CN106209642A (en) * | 2016-06-30 | 2016-12-07 | 杭州迪普科技有限公司 | A kind of method and device turning transmitting IP packet |
CN107276901A (en) * | 2017-05-27 | 2017-10-20 | 上海斐讯数据通信技术有限公司 | The system and method and wireless router and terminal of integration application |
CN107342940A (en) * | 2016-04-29 | 2017-11-10 | 新华三技术有限公司 | The generation method and device and message processing method and device of a kind of control information |
CN107689881A (en) * | 2016-08-04 | 2018-02-13 | 新华三技术有限公司 | Message processing method and device |
US20180287938A1 (en) * | 2017-03-30 | 2018-10-04 | Nicira, Inc. | Identifier-based virtual networking |
US20190020580A1 (en) * | 2017-07-14 | 2019-01-17 | Nicira, Inc. | Asymmetric network elements sharing an anycast address |
-
2019
- 2019-08-15 CN CN201910751822.6A patent/CN110460687B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060195900A1 (en) * | 2005-02-28 | 2006-08-31 | Yao-Chih Yeh | Network apparatus with secure IPSec mechanism and method for operating the same |
CN107342940A (en) * | 2016-04-29 | 2017-11-10 | 新华三技术有限公司 | The generation method and device and message processing method and device of a kind of control information |
CN106209642A (en) * | 2016-06-30 | 2016-12-07 | 杭州迪普科技有限公司 | A kind of method and device turning transmitting IP packet |
CN107689881A (en) * | 2016-08-04 | 2018-02-13 | 新华三技术有限公司 | Message processing method and device |
US20180287938A1 (en) * | 2017-03-30 | 2018-10-04 | Nicira, Inc. | Identifier-based virtual networking |
CN107276901A (en) * | 2017-05-27 | 2017-10-20 | 上海斐讯数据通信技术有限公司 | The system and method and wireless router and terminal of integration application |
US20190020580A1 (en) * | 2017-07-14 | 2019-01-17 | Nicira, Inc. | Asymmetric network elements sharing an anycast address |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112261171A (en) * | 2020-10-19 | 2021-01-22 | 天津津航计算技术研究所 | Method for determining IP camera position based on Ethernet protocol |
Also Published As
Publication number | Publication date |
---|---|
CN110460687B (en) | 2022-04-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108833163B (en) | Linux virtual server creating method and device, computer equipment and storage medium | |
US10813156B2 (en) | Method and apparatus for processing network connection | |
CN103139157B (en) | A kind of based on the network communication method of socket, Apparatus and system | |
US8478869B2 (en) | Information processing device and program | |
WO2020248375A1 (en) | Method and system for synchronizing data between databases, computer device and storage medium | |
JP2006217094A (en) | Network, network terminal device, ip address management method using for the same, and program thereof | |
CN109076022B (en) | Network address conversion device, setting request device, communication system, communication method, and storage medium storing program | |
CN112714027A (en) | Method and system for accessing terminal equipment of Internet of things to gateway | |
CN104509072A (en) | Method and apparatus for configuring dhcp client | |
CN104754070A (en) | Method and device for learning address resolution protocol table entries and network device | |
CN110460687A (en) | Recognition methods, device and the storage medium of a kind of IP address distribution port | |
CN105391612A (en) | Virtual extensible local area network (VXLAN) tunnel end point (VTEP) adjacency learning method and VXLAN VTEP adjacency learning device | |
CN105827496A (en) | Method and apparatus for managing PE device | |
CN107819599B (en) | Message processing method and device | |
CN105939344A (en) | TCP (Transmission Control Protocol) connection establishing method and device | |
CN104506405A (en) | Method and device for cross-domain access | |
CN115086276B (en) | Address management method, device, equipment and system | |
CN106506236A (en) | The methods, devices and systems that a kind of WAP is declared automatically | |
CN106161249A (en) | The processing method and processing device of PPPoE message | |
CN104243591A (en) | Method and device for synchronizing session information of security cluster | |
CN115190167A (en) | Proxy system and method based on shared memory communication | |
CN106302838B (en) | Domain name system DNS resolution processing method and device | |
WO2017219777A1 (en) | Packet processing method and device | |
CN104954187B (en) | A kind of method and apparatus of determining user side equipment state | |
CN108337299B (en) | NAT information synchronization method and device |
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 |