CN108183978B - Communication equipment IP address configuration method and communication equipment - Google Patents

Communication equipment IP address configuration method and communication equipment Download PDF

Info

Publication number
CN108183978B
CN108183978B CN201810273298.1A CN201810273298A CN108183978B CN 108183978 B CN108183978 B CN 108183978B CN 201810273298 A CN201810273298 A CN 201810273298A CN 108183978 B CN108183978 B CN 108183978B
Authority
CN
China
Prior art keywords
address
upper computer
communication equipment
module
storage module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810273298.1A
Other languages
Chinese (zh)
Other versions
CN108183978A (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.)
Beijing Institute of Environmental Features
Original Assignee
Beijing Institute of Environmental Features
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 Beijing Institute of Environmental Features filed Critical Beijing Institute of Environmental Features
Priority to CN201810273298.1A priority Critical patent/CN108183978B/en
Publication of CN108183978A publication Critical patent/CN108183978A/en
Application granted granted Critical
Publication of CN108183978B publication Critical patent/CN108183978B/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/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames

Abstract

The invention relates to the technical field of communication, and provides a communication equipment IP address configuration method and communication equipment, wherein the method comprises the following steps: after detecting that the communication equipment is started, reading a first IP address from a storage module of the communication equipment; establishing network connection between the communication equipment and an upper computer by utilizing the first IP address; receiving an IP address resetting instruction sent by the upper computer; according to the IP address resetting instruction, storing a second IP address carried by the IP address resetting instruction into the storage module, and covering the first IP address originally stored in the storage module; after detecting that the communication equipment is restarted, reading the second IP address from the storage module; configuring the second IP address as an IP address of the communication device. The scheme can realize the configuration of the IP address of the communication equipment.

Description

Communication equipment IP address configuration method and communication equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method for configuring an IP address of a communications device and a communications device.
Background
The IP Address (Internet Protocol Address) is a same Address format provided by the IP Protocol, and it allocates a logical Address to each network and each host on the Internet, so as to shield the difference of physical addresses, so that the networks and the hosts can be interconnected and intercommunicated. For the current network communication system, an IP address is assigned to each communication device in the design process of the network communication system, and the IP address of the communication device cannot be changed after the design of the network communication system is finished. Because the same communication device may need to communicate with different upper computers, if the IP address of the communication device and the IP address of the upper computer belong to different network segments, the communication between the communication device and the upper computer may be abnormal, but the upper computer and the communication device may normally communicate by reconfiguring the IP address of the communication device, which results in poor user experience.
Therefore, in view of the above disadvantages, it is desirable to provide a technical solution that can configure the IP address of the communication device.
Disclosure of Invention
The technical problem to be solved by the invention is that the IP address of the communication equipment can not be changed after the network communication system is developed, and a technical scheme capable of configuring the IP address of the communication equipment is provided aiming at the defects in the prior art.
In order to solve the above technical problem, the present invention provides a method for configuring an IP address of a communication device, including:
after detecting that the communication equipment is started, reading a first IP address from a storage module of the communication equipment;
establishing network connection between the communication equipment and an upper computer by utilizing the first IP address;
receiving an IP address resetting instruction sent by the upper computer;
according to the IP address resetting instruction, storing a second IP address carried by the IP address resetting instruction into the storage module, and covering the first IP address originally stored in the storage module;
after detecting that the communication equipment is restarted, reading the second IP address from the storage module;
configuring the second IP address as an IP address of the communication device.
Alternatively,
the establishing of the network connection between the communication device and the upper computer by using the first IP address includes:
receiving an Address Resolution Protocol (ARP) request sent by the upper computer;
acquiring a target IP address carried by the ARP request;
judging whether the target IP address is the same as the first IP address or not;
if so, sending the first MAC address of the communication equipment to the upper computer so that the upper computer creates a mapping relation between the first IP address and the first MAC address, and sending information to the communication equipment according to the first MAC address.
Alternatively,
after the determining whether the target IP address is the same as the first IP address, further comprising:
and if the target IP address is the same as the first IP address, acquiring a third IP address and a second MAC address of the upper computer from the ARP request, and storing the mapping relation between the third IP address and the second MAC address so as to send information to the upper computer according to the mapping relation between the third IP address and the second MAC address.
Alternatively,
after the storing the second IP address carried by the IP address resetting instruction into the storage module, the method further includes:
acquiring a first subnet mask of the first IP address and acquiring a second subnet mask of the second IP address;
respectively converting the first IP address, the first subnet mask, the second IP address and the second subnet mask into corresponding binary sequences;
performing binary AND operation on the binary sequence corresponding to the first IP address and the binary sequence corresponding to the first subnet mask to obtain a first verification sequence;
performing binary AND operation on the binary sequence corresponding to the second IP address and the binary sequence corresponding to the second subnet mask to obtain a second verification sequence;
determining whether the first authentication sequence is the same as the second authentication sequence;
if so, sending prompt information for prompting that the first IP address and the second IP address are located in the same network segment to the upper computer.
An embodiment of the present invention further provides a communication device, including: the FPGA comprises a Field Programmable Gate Array (FPGA) and a storage module;
the storage module is used for storing a first IP address;
the FPGA is used for reading the first IP address from the storage module after detecting that the communication equipment is started, receiving an IP address resetting instruction sent by an upper computer after establishing network connection with the upper computer by using the first IP address, storing a second IP address carried by the IP address resetting instruction into the storage module, covering the first IP address in the storage module, reading the second IP address from the storage module after detecting that the communication equipment is restarted, and configuring the second IP address as the IP address of the communication equipment.
Alternatively,
the FPGA comprises: an ARP handshake module;
the ARP handshake module is used for receiving an ARP request sent by the upper computer, acquiring a target IP address carried by the ARP request, judging whether the target IP address is the same as the first IP address, if so, sending the first MAC address of the communication equipment to the upper computer, so that the upper computer establishes a mapping relation between the first IP address and the first MAC address, and sending information to the communication equipment according to the first MAC address.
Alternatively,
and the ARP handshake module is further used for acquiring a third IP address and a second MAC address of the upper computer from the ARP request after the target IP address is judged to be the same as the first IP address, and storing the mapping relation between the third IP address and the second MAC address so that the FPGA sends information to the upper computer according to the mapping relation between the third IP address and the second MAC address.
Alternatively,
the communication device further includes: a flash memory array;
the FPGA further comprises: the data receiving module and the data sending module;
the flash memory array is used for storing data sent to the FPGA by an external data source;
the data receiving module is used for receiving the data sent by the upper computer and storing the received data in the flash memory array;
and the data sending module is used for reading corresponding data from the flash memory array according to a data request instruction sent by the upper computer and sending the corresponding data to the upper computer.
Alternatively,
any one or more of the data receiving module, the data sending module and the ARP handshake module are developed through a hardware description language.
Alternatively,
the FPGA is further used for executing the following operations:
acquiring a first subnet mask of the first IP address and acquiring a second subnet mask of the second IP address;
respectively converting the first IP address, the first subnet mask, the second IP address and the second subnet mask into corresponding binary sequences;
performing binary AND operation on the binary sequence corresponding to the first IP address and the binary sequence corresponding to the first subnet mask to obtain a first verification sequence;
performing binary AND operation on the binary sequence corresponding to the second IP address and the binary sequence corresponding to the second subnet mask to obtain a second verification sequence;
determining whether the first authentication sequence is the same as the second authentication sequence;
if so, sending prompt information for prompting that the first IP address and the second IP address are located in the same network segment to the upper computer.
The communication equipment IP address configuration method and the communication equipment provided by the embodiment of the invention at least have the following beneficial effects:
1. the storage module of the communication equipment stores a first IP address, when the communication equipment is started, the first IP address stored in the storage module can be used for establishing network connection with an upper computer, after the network connection is established, an IP address resetting instruction sent by the upper computer can be used for storing a second IP address carried by the IP address resetting instruction into the storage module to cover the first IP address, and therefore when the communication module is restarted, the second IP address can be read from the storage module and configured as the IP address of the communication equipment. Therefore, after the communication equipment is restarted each time, the IP address is read from the storage module to establish communication connection with the upper computer, so that the IP address stored in the storage module can be updated according to the IP address resetting instruction sent by the upper computer, the IP address of the communication equipment is configured, and the use experience of a user is improved.
2. After receiving an ARP (address resolution protocol) request sent by an upper computer, whether the communication equipment required to be communicated by the upper computer is the current communication equipment or not can be determined, and when the communication equipment required to be communicated by the upper computer is determined to be the current communication equipment, the MAC address of the current communication equipment is sent to the upper computer, so that the upper computer can send information to the current communication equipment according to the received MAC address, the upper computer can be ensured to be communicated with a plurality of communication equipment, and the use experience of a user is improved.
3. The upper computer can establish the mapping relation between the MAC address and the target IP address after receiving the MAC address, so that when the upper computer needs to send information to the same communication equipment again, the upper computer can directly obtain the MAC address according to the mapping relation and send the information to the corresponding communication equipment, an ARP request does not need to be sent again, and the communication speed is improved.
4. By storing the mapping relation between the IP address and the MAC address of the upper computer, the communication equipment can receive information sent by the upper computer and also can send information to the upper computer, so that the two-way communication between the upper computer and the communication equipment is realized, and the applicability of the IP address configuration method of the communication equipment is improved.
5. And after the second IP address and the first IP address are determined to be in the same network segment, sending prompt information to the upper computer to prompt the upper computer that the second IP address and the first IP address are in the same network segment. Therefore, if the IP address resetting instruction received by the communication equipment is not sent by the upper computer or is sent by the upper computer in a clamped state, a user of the upper computer can find and adopt corresponding measures in time, and the safety of communication between the upper computer and the communication equipment is improved.
6. The ARP handshake module, the data receiving module and the data sending module which are included in the FPGA can be described in a hardware description language mode, so that the developed ARP handshake module, the developed data receiving module and the developed data sending module do not depend on the support of the FPGA hardware function module, the communication equipment provided by the embodiment of the invention can be realized through various types of FPGAs, on one hand, the applicability of the communication equipment can be improved, on the other hand, the communication equipment provided by the embodiment of the invention can be realized by adopting a lower-end FPGA, and the communication equipment is ensured to have lower cost.
Drawings
Fig. 1 is a flowchart of a method for configuring an IP address of a communication device according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a communication device according to a fifth embodiment of the present invention;
fig. 3 is a schematic diagram of a communication device according to a sixth embodiment of the present invention;
fig. 4 is a schematic diagram of a communication device according to an eighth embodiment of the present invention;
fig. 5 is a flowchart of a method for configuring an IP address of a communication device according to an eleventh embodiment of the present invention.
In the figure: 201: an FPGA; 202: a storage module; 2011: an ARP handshake module; 2012: a data receiving module; 2013: a data transmission module; 403: a flash memory array.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Example one
As shown in fig. 1, the method for configuring an IP address of a communication device according to an embodiment of the present invention may include the following steps:
step 101: after detecting that the communication equipment is started, reading a first IP address from a storage module of the communication equipment;
step 102: establishing network connection between the communication equipment and the upper computer by utilizing the first IP address;
step 103: receiving an IP address resetting instruction sent by an upper computer;
step 104: according to the IP address resetting instruction, storing a second IP address carried by the IP address resetting instruction into the storage module, and covering a first IP address originally stored in the storage module;
step 105: after detecting that the communication equipment is restarted, reading a second IP address from the storage module;
step 106: the second IP address is configured as an IP address of the communication device.
According to the method for configuring the IP address of the communication equipment provided by the embodiment of the invention, the first IP address is stored in the storage module of the communication equipment, the network connection between the communication equipment and the upper computer can be established by utilizing the first IP address stored in the storage module when the communication equipment is started, the IP address resetting instruction sent by the upper computer can be used after the network connection is established, and the second IP address carried by the IP address resetting instruction is stored in the storage module to cover the first IP address, so that when the communication module is restarted, the second IP address can be read from the storage module, and the second IP address is configured as the IP address of the communication equipment. Therefore, after the communication equipment is restarted each time, the IP address is read from the storage module to establish communication connection with the upper computer, so that the IP address stored in the storage module can be updated according to the IP address resetting instruction sent by the upper computer, the IP address of the communication equipment is configured, and the use experience of a user is improved.
Example two
On the basis of the method for configuring the IP address of the communication device provided in the first embodiment, when the step 102 establishes the network connection between the communication device and the upper computer by using the first IP address, the method may specifically be implemented as follows:
a1: receiving an Address Resolution Protocol (ARP) request sent by an upper computer;
a2: acquiring a target IP address carried by the ARP request;
a3: judging whether the target IP address is the same as the first IP address or not, if so, executing A4, otherwise, ending the current process;
a4: and sending the first MAC address of the communication equipment to the upper computer so that the upper computer establishes a mapping relation between the first IP address and the first MAC address, and the upper computer can send information to the communication equipment according to the first MAC address.
After reading the first IP address from the storage module of the communication equipment, receiving an ARP request sent by the upper computer in a broadcast mode in real time, wherein the ARP request carries a target IP address of the communication equipment which needs to be communicated by the upper computer. And after receiving the ARP request, acquiring a target IP address carried by the ARP request, comparing the acquired target IP address with the read first IP address, and judging whether the target IP address is the same as the first IP address. If the target IP address is the same as the first IP address, the communication equipment which needs to be communicated by the upper computer is indicated to be current communication equipment, and the first MAC address of the current communication equipment is sent to the upper computer. And if the target IP address is different from the first IP address, the communication equipment which needs to be communicated by the upper computer is not the current communication equipment, and the received ARP request is discarded. After receiving the first MAC address, the upper computer creates a mapping relationship between the first MAC address and a target IP address (first IP address), and then the upper computer can obtain the first MAC address of the target communication device according to the mapping relationship, and can send information such as an IP address resetting instruction to the target communication device according to the first MAC address.
Whether the communication equipment required to be communicated by the upper computer is the current communication equipment or not can be determined by receiving the ARP request sent by the upper computer, and when the communication equipment required to be communicated by the upper computer is determined to be the current communication equipment, the MAC address of the current communication equipment is sent to the upper computer, so that the upper computer can send information to the current communication equipment according to the received MAC address, the upper computer can be ensured to be communicated with a plurality of communication equipment, and the use experience of a user is improved. In addition, the upper computer can establish the mapping relation between the MAC address and the target IP address after receiving the MAC address, so that when the upper computer needs to send information to the same communication equipment again, the upper computer can directly obtain the MAC address according to the mapping relation and send the information to the corresponding communication equipment, an ARP request does not need to be sent again, and the communication speed is improved.
EXAMPLE III
On the basis of the method for configuring the IP address of the communication device provided in the second embodiment, after determining whether the target IP address is the same as the first IP address, if it is determined that the target IP address is the same as the first IP address, the third IP address and the second MAC address of the upper computer may be obtained from the received ARP request, and a mapping relationship between the third IP address and the second MAC address is stored.
After the target IP address carried by the ARP request is determined to be the same as the first IP address, the IP address and the MAC address of the upper computer carried by the ARP request are further obtained, a mapping relation between the IP address and the MAC address of the upper computer is established and stored, if the communication equipment needs to send information to the upper computer, the MAC address of the upper computer can be obtained according to the mapping relation between the IP address and the MAC address of the upper computer, and then the information is sent to the upper computer according to the MAC address of the upper computer. Therefore, by storing the mapping relation between the IP address and the MAC address of the upper computer, the communication equipment can receive the information sent by the upper computer and also can send the information to the upper computer, so that the two-way communication between the upper computer and the communication equipment is realized, and the applicability of the IP address configuration method of the communication equipment is improved.
Example four
On the basis of the method for configuring an IP address of a communication device provided in any one of the first to third embodiments, after the second IP address is stored in the storage module, it may be further detected whether the second IP address and the first IP address are located in the same network segment, and the specific process may be implemented by:
b1: acquiring a first subnet mask of the first IP address and acquiring a second subnet mask of the second IP address;
b2: respectively converting the first IP address, the first subnet mask, the second IP address and the second subnet mask into corresponding binary sequences;
b3: performing binary AND operation on a binary sequence corresponding to the first IP address and a binary sequence corresponding to the first subnet mask to obtain a first verification sequence;
b4: performing binary AND operation on a binary sequence corresponding to the second IP address and a secondary system sequence corresponding to the second subnet mask to obtain a second verification sequence;
b5: judging whether the first verification sequence is the same as the second verification sequence, if so, executing B6, otherwise, ending the current flow;
b6: and sending prompt information for prompting that the first IP address and the second IP address are located in the same network segment to the upper computer.
For example, after the communication device is powered on, the first IP address read from the storage module is 211.95.165.24, the second IP address obtained from the IP address reset command is 211.95.164.78, the first subnet mask of the first IP address is 255.255.254.0, and the second subnet mask of the second IP address is 255.255.254.0. After the first IP address, the second IP address, the first subnet mask and the second subnet mask are respectively converted into the second-level system sequence, the corresponding relation between the second-level system sequence and the first-level IP address is as follows:
first IP address: 11010011010111111010010100011000, respectively;
first subnet mask: 111111111111111111111111000000000, respectively;
second IP address: 11010011010111111010010001001110, respectively;
second subnet mask: 111111111111111111111111000000000.
the binary and operation is performed on the binary sequence corresponding to the first IP address and the first subnet mask to obtain a first verification sequence 11010011010111111010010000000000. And performing binary and operation on the binary sequence corresponding to the second IP address and the second subnet mask to obtain a second verification sequence 11010011010111111010010000000000.
And because the first verification sequence is the same as the second verification sequence, sending simultaneous information to the upper computer to prompt that the first IP address and the second IP address belong to the same network segment.
Under normal conditions, the reason that the IP addresses of the communication equipment are reset is that the IP addresses of the upper computer and the communication equipment are not in the same network segment, if the second IP address obtained from the IP address resetting instruction and the first IP address stored in the storage module are in the same network segment, the network segment where the communication equipment is located cannot be changed by replacing the first IP address with the second IP address, and at the moment, the IP address resetting instruction may be an illegal instruction and is intended to perform behaviors such as illegally reading information stored in the communication equipment. And after the second IP address and the first IP address are determined to be in the same network segment, sending prompt information to the upper computer to prompt the upper computer that the second IP address and the first IP address are in the same network segment. Therefore, if the IP address resetting instruction received by the communication equipment is not sent by the upper computer or is sent by the upper computer in a clamped state, a user of the upper computer can find and adopt corresponding measures in time, and the safety of communication between the upper computer and the communication equipment is improved.
It should be noted that, when performing binary and operation on the first IP address and the first subnet mask, and the second IP address and the second subnet mask, for two binary numbers of the two binary numbers, if both the two binary numbers are 1, the and operation result is 1, and if one of the two binary numbers is 0, the and operation result is 0.
EXAMPLE five
As shown in fig. 2, a communication device provided in an embodiment of the present invention includes: an FPGA (Field-Programmable Gate Array) 201 and a memory module 202;
the storage module 202 is configured to store the first IP address;
the FPGA201 is configured to read a first IP address from the storage module 202 after detecting that the communication device is started, receive an IP address resetting instruction sent by the upper computer after establishing a network connection with the upper computer support by using the first IP address, store a second IP address carried by the IP address resetting instruction in the storage module 202, cover the first IP address in the storage module 202, read the second IP address from the storage module 202 after detecting that the communication device is restarted, and configure the second IP address as the IP address of the communication device.
In the communication device provided by the embodiment of the invention, the storage module stores the first IP address, and the FPGA can read the first IP address from the storage module when the communication device is powered on and started up, and establish network connection between the upper computers by using the first IP address. And after the FPGA obtains a second IP address from an IP address resetting instruction sent by the upper computer, the FPGA stores the second IP address into the storage module to cover the first IP address. When the communication device is restarted, the FPGA can read the second IP address from the storage module, configure the second IP address as the IP address of the communication device, and communicate with the upper computer by using the second IP address. Therefore, the FPGA can update the IP address stored in the storage module according to the IP address resetting instruction sent by the upper computer, and the IP address stored in the storage module can be set as the IP address of the communication equipment when the communication equipment is restarted every time, so that the IP address of the communication equipment can be configured according to the requirement, and the use experience of a user is improved.
In the embodiment of the present invention, the storage module may be an EEPROM (Electrically Erasable and Programmable read only memory), the EEPROM may still ensure that the stored data is not lost after power failure, and may write new data into the EEPROM after erasing the stored data, ensure that the upper computer may reset the IP address of the communication device for many times, and ensure that the communication device may always use the reset IP address after each reset.
EXAMPLE six
On the basis of the communication device provided in the fifth embodiment, as shown in fig. 3, the FPGA201 may include an ARP handshake module 2011;
the ARP handshake module 2011 is configured to receive an ARP request sent by the upper computer, obtain a target IP address carried in the ARP request, determine whether the target IP address is the same as the first IP address, and if so, send the first MAC address of the communication device to the upper computer, so that the upper computer creates a mapping relationship between the first IP address and the first MAC address, and can send information to the communication device according to the first MAC address.
EXAMPLE seven
On the basis of the communication device provided in the sixth embodiment, as shown in fig. 3, the ARP handshake module 2011 is further configured to, after determining that the target IP address is the same as the first IP address, obtain the third IP address and the second MAC address of the upper computer from the ARP request, and store the mapping relationship between the third IP address and the second MAC address, so that the FPGA201 can send information to the upper computer according to the mapping relationship between the third IP address and the second MAC address.
Example eight
On the basis of the communication device provided in the sixth embodiment, as shown in fig. 4, the communication device may further include a flash memory array 403;
the FPGA201 further includes: a data receiving module 2012 and a data sending module 2013;
a flash memory array 403 for storing data sent from an external data source to the FPGA 201;
the data receiving module 2012 is configured to receive data sent by the upper computer, and store the received data in the flash memory array 403;
and the data sending module 2013 is configured to read corresponding data from the flash memory array 403 according to a data request instruction sent by the upper computer, and send the data to the upper computer.
The communication equipment can comprise a flash memory array, correspondingly, the FPGA comprises a data sending module and a data receiving module, the data receiving module can receive data sent by the upper computer and store the received data in the large flash memory array, and the data sending module can receive a data request instruction sent by the upper computer, read corresponding data from the flash memory array according to the data request instruction and send the corresponding data to the upper computer. In addition, the FPGA can also be connected with an external data source, when the data source has data input, the FPGA stores the data input by the data source into the flash memory array, wherein the data source can be information acquisition equipment such as a camera and a microphone.
When the communication equipment comprises the flash memory array, the communication equipment can be used as storage equipment, data are obtained from a data source to be stored, the data are added, deleted, changed and checked according to instructions sent by the upper computer, and the IP address can be reset according to the instructions of the upper computer, so that communication with a plurality of upper computers in different network segments is realized.
Example nine
On the basis of the communication device provided in the eighth embodiment, as shown in fig. 4, any one or more of the ARP handshake module 2011, the data receiving module 2012 and the data sending module 2013 may be obtained through hardware description language development.
The ARP handshake module, the data receiving module and the data sending module which are included in the FPGA can be described in a hardware description language mode, so that the developed ARP handshake module, the developed data receiving module and the developed data sending module do not depend on the support of the FPGA hardware function module, the communication equipment provided by the embodiment of the invention can be realized through various types of FPGAs, on one hand, the applicability of the communication equipment can be improved, on the other hand, the communication equipment provided by the embodiment of the invention can be realized by adopting a lower-end FPGA, and the communication equipment is ensured to have lower cost.
Example ten
On the basis of any one of the communication devices provided in the fifth to ninth embodiments, the FPGA201 may be further configured to perform the following operations:
acquiring a first subnet mask of a first IP address and a second subnet mask of a second IP address;
respectively converting the first IP address, the first subnet mask, the second IP address and the second subnet mask into corresponding binary sequences;
performing binary AND operation on a binary sequence corresponding to the first IP address and a binary sequence corresponding to the first subnet mask to obtain a first verification sequence;
performing binary AND operation on the binary sequence corresponding to the second IP address and the binary sequence corresponding to the second subnet mask to obtain a second verification sequence;
judging whether the first verification sequence is the same as the second verification sequence;
if so, sending prompt information for prompting that the first IP address and the second IP address are located in the same network segment to the upper computer.
It should be noted that, because the content of information interaction, execution process, and the like between the modules in the communication device provided in the foregoing embodiments is based on the same concept as that of the method embodiment of the present invention, specific content may refer to the description in the method embodiment of the present invention, and is not described herein again.
EXAMPLE eleven
The following describes in further detail a method for configuring an IP address of a communication device according to an embodiment of the present invention with reference to the communication device shown in fig. 4, where as shown in fig. 5, the method may include the following steps:
step 501: the first IP address is read from a memory module of the communication device.
In the embodiment of the invention, after the communication equipment is powered on, the FPGA reads the first IP address stored in the storage module. Specifically, the FPGA includes an IP configuration module, and when the communication device is powered on and started, the IP configuration module reads the first IP address from the storage module. The IP configuration module can be developed through a hardware description language.
For example, after the communication device is powered on and started, the first IP address 211.95.165.24 is read from a memory module of the communication device.
Step 502: and receiving an ARP request sent by the upper computer through an ARP handshake module, and obtaining a target IP address from the ARP request.
In the embodiment of the invention, after the communication equipment is started, the ARP handshake module included in the FPGA receives the ARP request sent by the upper computer in real time, and after the ARP request sent by the upper computer is received, the ARP handshake module analyzes the ARP request to obtain the target IP address carried by the ARP request.
Step 503: and judging whether the target IP address is the same as the first IP address or not by using the ARP handshake module, if so, executing step 504, and otherwise, executing step 502.
In the embodiment of the invention, after the ARP handshake module acquires the target IP address carried by the ARP request, the ARP handshake module further determines whether the acquired target IP addresses are the same as the first IP address read by the IP configuration module. If yes, the communication device to be communicated by the upper computer is the current communication device, and step 504 is executed correspondingly. If not, the communication equipment to be communicated by the upper computer is not the current communication equipment, correspondingly executing the step 502, and continuing to receive the ARP request sent by the upper computer by using the ARP handshake module.
For example, the target IP address obtained by the ARP handshake module from the ARP request is 211.95.165.24, and step 504 is performed because the target IP address is the same as the first IP address.
Step 504: and the ARP handshake module sends the MAC address of the communication equipment to the upper computer, and establishes network connection between the communication equipment and the upper computer.
In the embodiment of the invention, the ARP handshake module sends the MAC address of the communication equipment to the upper computer after determining that the target IP address is the same as the first IP address. The upper computer establishes a mapping relation between the MAC address and the target IP address after receiving the MAC address sent by the communication equipment, and can determine the MAC address of the communication equipment according to the mapping relation when the upper computer needs to send information to the communication equipment corresponding to the target IP address, and then sends the information to the communication equipment according to the MAC address.
Step 505: the ARP handshake module acquires the IP address and the MAC address of the upper computer and stores the mapping relation between the IP address and the MAC address of the upper computer.
In the embodiment of the invention, after the ARP handshake module sends the first IP address to the upper computer, the IP address and the MAC address of the upper computer can be obtained from the received ARP request, and after the mapping relation between the IP address and the MAC address of the upper computer is established, the mapping relation is stored in the local of the communication equipment. And then, the data sending module of the communication equipment can determine the MAC address of the upper computer according to the mapping relation and further send data to the upper computer according to the MAC address.
Step 506: and receiving an IP address resetting instruction sent by the upper computer, and acquiring a second IP address from the IP address resetting instruction.
In the embodiment of the invention, after the network connection between the upper computer and the communication equipment is established by using the first IP address, the IP address resetting instruction sent by the upper computer is received, and after the received IP address resetting instruction is determined to be specific to the current communication equipment, the IP configuration module analyzes the IP address resetting instruction to obtain the second IP address carried by the IP address resetting instruction.
For example, the second IP address obtained from the IP address reset instruction is 211.95.164.78.
Step 507: and storing the second IP address into the storage module, and covering the first IP address originally stored in the storage module.
In the embodiment of the present invention, after acquiring the second IP address, the IP configuration module stores the second IP address in the storage module, and covers the first IP address originally stored in the storage module. In addition, the IP configuration module can detect whether the second IP address and the first IP address are located in the same network segment, and prompt the upper computer of prompt information that the first IP address and the second IP address are located in the same network segment if the second IP address and the first IP address are located in the same network segment.
Step 508: and after the communication equipment communicates, reading the second IP address from the storage module.
In the embodiment of the invention, after the communication equipment is reset or restarted, the IP configuration module reads the second IP address from the storage module.
For example, after the communication device is restarted, the second IP address 211.95.164.78 is read from the memory module of the communication device.
Step 509: and setting the second IP address as the IP address of the communication equipment, and establishing network connection between the communication equipment and the upper computer.
In this embodiment of the present invention, after the IP configuration module reads the second IP address from the storage module, the second IP address is used to establish the network connection between the communication device and the upper computer, and the specific process is similar to the process of establishing the network connection between the communication device and the upper computer by using the first IP address, which may refer to steps 502 to 504, and is not described herein again.
In summary, according to the method for configuring an IP address of a communication device and the communication device provided in the embodiments of the present invention, a storage module of the communication device stores a first IP address, when the communication device is started, a network connection between the communication device and an upper computer can be established by using the first IP address stored in the storage module, after the network connection is established, an IP address resetting instruction sent by the upper computer can be used, and a second IP address carried by the IP address resetting instruction is stored in the storage module to cover the first IP address, so that when the communication module is restarted, the second IP address can be read from the storage module, and the second IP address is configured as the IP address of the communication device. Therefore, after the communication equipment is restarted each time, the IP address is read from the storage module to establish communication connection with the upper computer, so that the IP address stored in the storage module can be updated according to the IP address resetting instruction sent by the upper computer, the IP address of the communication equipment is configured, and the use experience of a user is improved.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (2)

1. A method for configuring an IP address of a communication device is characterized by comprising the following steps:
after detecting that the communication equipment is started, reading a first IP address from a storage module of the communication equipment;
establishing network connection between the communication equipment and an upper computer by utilizing the first IP address;
receiving an IP address resetting instruction sent by the upper computer;
according to the IP address resetting instruction, storing a second IP address carried by the IP address resetting instruction into the storage module, and covering the first IP address originally stored in the storage module;
after detecting that the communication equipment is restarted, reading the second IP address from the storage module;
configuring the second IP address as an IP address of the communication device;
the establishing of the network connection between the communication device and the upper computer by using the first IP address includes:
receiving an Address Resolution Protocol (ARP) request sent by the upper computer;
acquiring a target IP address carried by the ARP request;
judging whether the target IP address is the same as the first IP address or not;
if so, sending the first MAC address of the communication equipment to the upper computer so that the upper computer creates a mapping relation between the first IP address and the first MAC address and can send information to the communication equipment according to the first MAC address;
after the determining whether the target IP address is the same as the first IP address, further comprising:
if the target IP address is the same as the first IP address, acquiring a third IP address and a second MAC address of the upper computer from the ARP request, and storing the mapping relation between the third IP address and the second MAC address so as to send information to the upper computer according to the mapping relation between the third IP address and the second MAC address;
after the storing the second IP address carried by the IP address resetting instruction into the storage module, the method further includes:
acquiring a first subnet mask of the first IP address and acquiring a second subnet mask of the second IP address;
respectively converting the first IP address, the first subnet mask, the second IP address and the second subnet mask into corresponding binary sequences;
performing binary AND operation on the binary sequence corresponding to the first IP address and the binary sequence corresponding to the first subnet mask to obtain a first verification sequence;
performing binary AND operation on the binary sequence corresponding to the second IP address and the binary sequence corresponding to the second subnet mask to obtain a second verification sequence;
determining whether the first authentication sequence is the same as the second authentication sequence;
if so, sending prompt information for prompting that the first IP address and the second IP address are located in the same network segment to the upper computer.
2. A communication device, comprising: the FPGA comprises a Field Programmable Gate Array (FPGA) and a storage module;
the storage module is used for storing a first IP address;
the FPGA is used for reading the first IP address from the storage module after detecting that the communication equipment is started, receiving an IP address resetting instruction sent by an upper computer after establishing network connection with the upper computer by using the first IP address, storing a second IP address carried by the IP address resetting instruction into the storage module, covering the first IP address in the storage module, reading the second IP address from the storage module after detecting that the communication equipment is restarted, and configuring the second IP address as the IP address of the communication equipment;
the FPGA comprises: an ARP handshake module;
the ARP handshake module is used for receiving an ARP request sent by the upper computer, acquiring a target IP address carried by the ARP request, judging whether the target IP address is the same as the first IP address, if so, sending a first MAC address of the communication equipment to the upper computer, so that the upper computer establishes a mapping relation between the first IP address and the first MAC address, and sending information to the communication equipment according to the first MAC address;
the ARP handshake module is further used for acquiring a third IP address and a second MAC address of the upper computer from the ARP request after the target IP address is judged to be the same as the first IP address, and storing the mapping relation between the third IP address and the second MAC address, so that the FPGA sends information to the upper computer according to the mapping relation between the third IP address and the second MAC address
Further comprising: a flash memory array;
the FPGA further comprises: the data receiving module and the data sending module;
the flash memory array is used for storing data sent to the FPGA by an external data source;
the data receiving module is used for receiving the data sent by the upper computer and storing the received data in the flash memory array;
the data sending module is used for reading corresponding data from the flash memory array according to a data request instruction sent by the upper computer and sending the corresponding data to the upper computer;
any one or more of the data receiving module, the data sending module and the ARP handshake module are developed through a hardware description language;
the FPGA is further used for executing the following operations:
acquiring a first subnet mask of the first IP address and acquiring a second subnet mask of the second IP address;
respectively converting the first IP address, the first subnet mask, the second IP address and the second subnet mask into corresponding binary sequences;
performing binary AND operation on the binary sequence corresponding to the first IP address and the binary sequence corresponding to the first subnet mask to obtain a first verification sequence;
performing binary AND operation on the binary sequence corresponding to the second IP address and the binary sequence corresponding to the second subnet mask to obtain a second verification sequence;
determining whether the first authentication sequence is the same as the second authentication sequence;
if so, sending prompt information for prompting that the first IP address and the second IP address are located in the same network segment to the upper computer.
CN201810273298.1A 2018-03-29 2018-03-29 Communication equipment IP address configuration method and communication equipment Active CN108183978B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810273298.1A CN108183978B (en) 2018-03-29 2018-03-29 Communication equipment IP address configuration method and communication equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810273298.1A CN108183978B (en) 2018-03-29 2018-03-29 Communication equipment IP address configuration method and communication equipment

Publications (2)

Publication Number Publication Date
CN108183978A CN108183978A (en) 2018-06-19
CN108183978B true CN108183978B (en) 2021-01-22

Family

ID=62553848

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810273298.1A Active CN108183978B (en) 2018-03-29 2018-03-29 Communication equipment IP address configuration method and communication equipment

Country Status (1)

Country Link
CN (1) CN108183978B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110662197A (en) * 2019-09-02 2020-01-07 京信通信系统(中国)有限公司 Parameter configuration method, device, communication equipment and storage medium
CN111063283A (en) * 2020-01-19 2020-04-24 苏州华兴源创科技股份有限公司 Liquid crystal module aging testing equipment
TWI825923B (en) * 2022-08-16 2023-12-11 皓德盛科技有限公司 Field programmable logic gate array for financial transactions

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101577722A (en) * 2009-06-03 2009-11-11 中兴通讯股份有限公司 Method for realizing MAC forced forwarding function and device
CN103957288A (en) * 2014-04-28 2014-07-30 福建星网锐捷网络有限公司 Method, device and equipment for IP address dynamic allocation
CN104301451A (en) * 2014-10-17 2015-01-21 福建星网锐捷网络有限公司 Cross-network-segment host communication method, device and system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102158565B (en) * 2011-04-07 2016-12-07 瑞斯康达科技发展股份有限公司 A kind of method and system for remote equipment configuration of IP address
US8824299B1 (en) * 2014-02-28 2014-09-02 tw telecom holdings, inc. Selecting network services based on hostname
CN105704206B (en) * 2015-12-31 2019-01-18 西安诺瓦电子科技有限公司 The implementation method of ethernet communication is carried out with LED display control card
CN106254571B (en) * 2016-08-05 2020-12-18 新华三技术有限公司 Client IP address allocation method and device
CN106506720B (en) * 2016-11-16 2020-02-14 西安诺瓦星云科技股份有限公司 Automatic network IP address allocation method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101577722A (en) * 2009-06-03 2009-11-11 中兴通讯股份有限公司 Method for realizing MAC forced forwarding function and device
CN103957288A (en) * 2014-04-28 2014-07-30 福建星网锐捷网络有限公司 Method, device and equipment for IP address dynamic allocation
CN104301451A (en) * 2014-10-17 2015-01-21 福建星网锐捷网络有限公司 Cross-network-segment host communication method, device and system

Also Published As

Publication number Publication date
CN108183978A (en) 2018-06-19

Similar Documents

Publication Publication Date Title
CN105703938B (en) Equipment configuration method, configuration device and management equipment
CN108183978B (en) Communication equipment IP address configuration method and communication equipment
CN108347351B (en) Method, device and system for compatibility of dual Ethernet cards of equipment
US10425537B2 (en) Method, apparatus, and system for allocating phone number
CN109284140B (en) Configuration method and related equipment
CN112272246A (en) Out-of-band network IP automatic configuration method and device, electronic equipment and storage medium
CN108702395B (en) Wireless mesh network formation
CN107294910B (en) Login method and server
KR102310027B1 (en) Determination method and corresponding terminal, computer program product and storage medium
CN113098722A (en) Multi-network card management method, device and computer readable storage medium
CN111953508A (en) Equipment control method and device, switch and electronic equipment
US11411797B2 (en) Device management method and related device
CN107911494B (en) Method, device, computer equipment and storage medium for accessing IPv6 network
EP3297254B1 (en) Domain name system (dns) resolution processing method and device
CN106919836B (en) Application port detection method and device
US20180295017A1 (en) Dynamic interface identification and configuration
JP6052876B2 (en) Relay device, control method thereof, and control program thereof
CN107465554B (en) Route switching method and system for wireless networking and single network application
CN105577464A (en) Dual stack user network detection method, apparatus and system thereof
CN113014679B (en) Communication method, device and system
CN115037664B (en) Network connection testing method and device, repeater and storage medium
CN111858300B (en) Automatic testing method, device and system for embedded equipment and storage medium
KR101094000B1 (en) Mobile communication apparatus for providing auto-connection to access point, control method thereof
CN108600402B (en) Internet access method and device, intelligent terminal and storage medium
CN117453131A (en) Detection method and related 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