CN106850876B - Network equipment access method and device based on same IP address - Google Patents

Network equipment access method and device based on same IP address Download PDF

Info

Publication number
CN106850876B
CN106850876B CN201710113168.7A CN201710113168A CN106850876B CN 106850876 B CN106850876 B CN 106850876B CN 201710113168 A CN201710113168 A CN 201710113168A CN 106850876 B CN106850876 B CN 106850876B
Authority
CN
China
Prior art keywords
address
network equipment
network device
access
client
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
CN201710113168.7A
Other languages
Chinese (zh)
Other versions
CN106850876A (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.)
Xi'an Yu Vision Mdt Infotech Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201710113168.7A priority Critical patent/CN106850876B/en
Publication of CN106850876A publication Critical patent/CN106850876A/en
Application granted granted Critical
Publication of CN106850876B publication Critical patent/CN106850876B/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/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses

Abstract

The invention provides a network equipment access method and device based on the same IP address. The method is applied to the server which is in communication connection with the client and a plurality of network devices with the same IP address. By receiving an access message sent by a client. And replacing the access destination IP address (the virtual IP address of the network equipment) in the access message by the real IP address of the network equipment based on the access corresponding relation of the network equipment, and sending the replaced access message to the network equipment through the physical address of the network equipment. Therefore, the client can simultaneously access a plurality of network devices with the same IP address in the same network without frequently modifying access configuration, and the access and test efficiency can be greatly improved.

Description

Network equipment access method and device based on same IP address
Technical Field
The invention relates to the technical field of communication access, in particular to a network equipment access method and device based on the same IP address.
Background
Network equipment (such as NVR-Network Video Recorder) is configured with a default factory address when the equipment leaves a factory, and the equipment needs to be subjected to batch early-stage factory test before being used in a market-oriented manner, so that defects of products can be found and optimized in time, and requirements of customers can be better met.
In the prior art, network devices (e.g., NVRs) are connected to the same switch and then connected to a PC, and each network device is accessed through a PC Telnet to test whether there is an abnormality in the function of each network device. When the PC accesses one network device, the switch interface connected with the network device and the switch interface connected with the PC are assigned to the same VLAN on the switch, and when the PC wants to access another network device, the VLAN configuration on the switch is modified according to the same method. In this way, the PC can only access one network device at a time (because the IP addresses are all the same), and the switch configuration needs to be modified frequently, which is inefficient.
Disclosure of Invention
In order to overcome the defects in the prior art, the invention provides the network equipment access method and the network equipment access device based on the same IP address, which can enable a client to simultaneously access a plurality of network equipment with the same IP address in the same network, and greatly improve the efficiency of the client in accessing and testing the network equipment.
A first object of the present invention is to provide a network device access method based on the same IP address, the method is applied to a server communicatively connected to a client and a plurality of network devices with the same IP address, the server stores a corresponding relationship between a real IP address of a network device, a virtual IP address of a network device, and a physical address of a network device, wherein the virtual IP address of each network device is different, and the virtual IP address of a network device is defined by a server interface connected to the network device, the method includes:
receiving an access message sent by the client, wherein the access message comprises an access destination IP address and a destination physical address, the access destination IP address is a virtual IP address of target network equipment, and the destination physical address is a physical address of the target network equipment;
and replacing the access destination IP address in the access message with the real IP address of the target network equipment according to the corresponding relation among the real IP address of the network equipment, the virtual IP address of the network equipment and the physical address of the network equipment, and sending the replaced access message to the target network equipment through the physical address of the target network equipment.
A second object of the present invention is to provide a network device access apparatus, which is applied to a server communicatively connected to a client and a plurality of network devices having the same IP address, the server storing a correspondence relationship between real IP addresses of the network devices, virtual IP addresses of the network devices, and physical addresses of the network devices, wherein the virtual IP addresses of the network devices are different, and the virtual IP addresses of the network devices are defined by server interfaces connected to the network devices, the apparatus comprising:
a receiving access module, configured to receive an access packet sent by the client, where the access packet includes an access destination IP address and a destination physical address, the access destination IP address is a virtual IP address of a target network device, and the destination physical address is a physical address of the target network device;
and the address replacing module is used for replacing the access destination IP address in the access message with the real IP address of the target network equipment according to the corresponding relation among the real IP address of the network equipment, the virtual IP address of the network equipment and the physical address of the network equipment, and sending the replaced access message to the target network equipment through the physical address of the target network equipment.
Compared with the prior art, the invention has the following beneficial effects:
and the server receives the access message sent by the client. According to the corresponding relation among the real IP address, the virtual IP address and the physical address of the network equipment, replacing the access destination IP address (the virtual IP address of the target network equipment) in the access message with the real IP address of the target network equipment, and sending the replaced access message to the target network equipment through the physical address of the target network equipment. Therefore, the client can simultaneously access a plurality of network devices with the same IP address in the same network without frequently modifying access configuration, and the access and test efficiency can be greatly improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a block diagram of a network device access system according to a preferred embodiment of the present invention.
Fig. 2 is a block diagram of the server shown in fig. 1 according to the preferred embodiment of the present invention.
Fig. 3 is one of the flow charts of the steps of the network device accessing method based on the same IP address according to the first embodiment of the present invention.
Fig. 4 is a second flowchart illustrating steps of a network device accessing method based on the same IP address according to the first embodiment of the present invention.
Fig. 5 is a third flowchart illustrating steps of a network device accessing method based on the same IP address according to the first embodiment of the present invention.
Fig. 6 is a flowchart illustrating sub-steps of step S110 shown in fig. 5 according to a first embodiment of the present invention.
Fig. 7 is a flowchart illustrating sub-steps of step S120 shown in fig. 5 according to a first embodiment of the present invention.
Fig. 8 is a flowchart illustrating a fourth step of the method for accessing network devices based on the same IP address according to the first embodiment of the present invention.
Fig. 9 is a functional block diagram of a network device access apparatus according to a second embodiment of the present invention.
Fig. 10 is a sub-functional block diagram of the initialization module shown in fig. 9 according to a second embodiment of the present invention.
Fig. 11 is a sub-function block diagram of the address definition module shown in fig. 9 according to the second embodiment of the present invention.
Icon: 10-network device access system; 100-a server; 110-a memory; 120-a processor; 130-a network module; 140-an interface; 142-a client interface; 144-device-side interface; 200-a client; 300-a network device; 400-network device access means; 410-an initialization module; 412-partition sub-module; 414-interface definition submodule; 420-an address definition module; 421-a receiving submodule; 422-obtaining a submodule; 423-redefine sub-module; 430-a learning module; 440-a relationship establishing module; 450-receive access module; 460-address replacement module; 470-receive reply module.
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. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Furthermore, the terms "first," "second," and the like are used merely to distinguish one description from another, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a block diagram of a network device access system 10 according to a preferred embodiment of the present invention. The network device access system 10 includes a server 100, a client 200, and a plurality of network devices 300 communicatively connected to each other.
In this embodiment, the Network device 300, such as a Network Video Recorder (NVR), has a main function of receiving, storing and managing digital Video streams transmitted by devices such as an IPC (internet camera) and a DVS (Video encoder) through a Network, so as to realize a distributed architecture advantage brought by networking. In short, the network device 300 can simultaneously view, browse, playback, manage and store a plurality of network cameras, so that the involvement of computer hardware is eliminated, and the complicated process of installing software is not required. All network devices 300 are configured with a default factory IP address (e.g., 192.168.0.30) at the time of factory shipment.
In this embodiment, the client 200 is a Personal Computer (PC), but the client 200 may be, but is not limited to, a single chip microcomputer, a mobile terminal, or other devices that are installed with software for logging in and testing the network device 300 by Telnet.
Referring to fig. 2, fig. 2 is a block diagram of the server 100 shown in fig. 1 according to a preferred embodiment of the present invention. The network access server 100 includes a memory 110, a network device access apparatus 400, a processor 120, a network module 130, and a plurality of interfaces 140.
The memory 110, the processor 120, the network module 130 and the plurality of interfaces 140 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The memory 110 stores therein a network device access apparatus 400, the network device access apparatus 400 includes at least one software function module which can be stored in the memory 110 in the form of software or firmware (firmware), and the processor 120 executes various function applications and data processing by running the software programs and modules stored in the memory 110.
The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 110 is used for storing a program, and the processor 120 executes the program after receiving an execution instruction. Further, the software programs and modules within the memory 110 may also include an operating system, which may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.
The processor 120 may be an integrated circuit chip having signal processing capabilities. The Processor 120 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The network module 130 is used for establishing communication connections between the server 100 and the client 200 and the network device 300 through a network.
Referring again to FIG. 2, the interface 140 includes a client interface 142 and a device interface 144. The client 200 accesses the server 100 through the client interface 142, and the network device 300 accesses the server 100 through the device-side interface 144.
It will be appreciated that the configuration depicted in fig. 2 is merely illustrative and that server 100 may include more or fewer components than shown in fig. 2 or have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
First embodiment
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for accessing a network device 300 based on the same IP address according to a first embodiment of the present invention. The method is applied to the server 100 which is in communication connection with the client 200 and a plurality of network devices 300 with the same IP address.
In this embodiment, the server 100 stores a corresponding relationship between a real IP address of the network device 300, a virtual IP address of the network device 300, and a physical address of the network device 300, where the virtual IP address of each network device 300 is different, and the virtual IP address of the network device 300 is defined by an interface of the server 100 connected to the network device 300.
In the present embodiment, an IP Address (Internet Protocol Address) is an abbreviation of IPAddress. The IP address is a uniform 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 mask the difference of physical addresses.
In this embodiment, the physical address refers to a Media Access Control (MAC) address, or a hardware address, and is used to define the location of the device. In the OSI model, a third layer network layer is responsible for IP addresses and a second layer data link layer is responsible for MAC addresses. Thus, a host will have a MAC address and each network location will have an IP address specific to it.
The following describes a specific flow of the access method of the network device 300 based on the same IP address in detail.
Step S160, receiving the access packet sent by the client 200.
In this embodiment, the client 200 sends Telnet access to each network device 300. The Telnet protocol is a member of the TCP/IP protocol suite, and is the standard protocol and the main mode for Internet remote login service. It provides the user with the ability to do remote host work on the local computer. The Telnet program is used on the end user's computer and is used to connect to the server 100. The end user may enter commands in the Telnet program that will run on the server 100 as if entered directly on the console of the server 100. To start a Telnet session, a user name and password must be entered to log into the server 100. Telnet is a commonly used method of remotely controlling a Web server.
In this embodiment, the access packet includes a packet header and a packet content, where the packet header includes an access source physical address (a physical address of the client 200), an access destination physical address (a physical address of the network device 300), an access source IP address (an IP address of the client 200), and an access destination IP address (a virtual IP address of the network device 300). The message content includes relevant access data information.
In this embodiment, since the real IP addresses (i.e., default IP addresses configured in the factory) of the network devices 300 are the same, in order to facilitate the client 200 to distinguish the network devices 300, the destination IP address in the access message is the redefined virtual IP address of the network device 300.
Step S170, according to the corresponding relationship between the real IP address of the network device 300, the virtual IP address of the network device 300, and the physical address of the network device 300, replacing the access destination IP address in the access packet with the real IP address of the target network device 300, and sending the replaced access packet to the target network device 300 through the physical address of the target network device 300.
In this embodiment, the correspondence between the real IP address of the network device 300, the virtual IP address of the network device 300, and the physical address of the network device 300 may be stored through an access table. The access table stores the real IP address, the virtual IP address, and the physical address of the network device 300, and the IP address and the physical address of the client 200.
In this embodiment, after the access packet reaches the server 100, the server 100 checks the access table according to the access destination IP address (the virtual IP address of the network device 300) of the packet, obtains the device port number corresponding to the target network device 300, finds the physical address of the target network device 300, and can forward the access request packet from the correct interface 140. Before the access message is forwarded, the server 100 replaces the access destination IP address (the virtual IP address of the network device 300) with the real IP address (e.g., 192.168.0.30) of the target network device 300, so that the network device 300 will not respond when the message reaches the network device 300.
Referring to fig. 4, fig. 4 is a second flowchart illustrating a method for accessing a network device 300 based on the same IP address according to a first embodiment of the present invention. In addition to the above steps, the method may further include step S180, step S190.
Step S180, receives the reply message sent by the target network device 300.
In this embodiment, the message information composition of the reply message is similar to that of the access message, the reply source physical address of the reply message is the same as the access destination physical address of the access message, and the reply destination physical address of the reply message is the same as the access source physical address of the access message. The reply destination IP address is the IP address of the client 200, and the reply source IP address is the real IP address of the target network device 300.
Step S190, according to the real IP address of the network device 300, the virtual IP address of the network device 300, the correspondence between the physical addresses of the network device 300 and the correspondence between the IP address of the client 200 and the physical address of the client 200, the reply source IP address in the reply message is replaced with the virtual IP address of the target network device 300, and the replaced reply message is sent to the client 200 through the physical address of the client 200.
In this embodiment, the correspondence between the IP address of the client 200 and the physical address of the client 200 is also stored in the access table.
In this embodiment, after the reply message reaches the server 100, the reply source IP addresses of all reply messages received by the server 100 are the same real IP address (e.g., 192.168.0.30) of the target network device 300. The server 100 obtains the device port number corresponding to the target network device 300 according to the access table, finds the virtual IP address corresponding to each target network device 300, and replaces the reply source IP address in the reply message with the virtual IP address of the target network device 300, so that the client 200 can distinguish the network devices 300.
Referring to fig. 5, fig. 5 is a third flowchart illustrating a method for accessing a network device 300 based on the same IP address according to a first embodiment of the present invention. In addition to the above steps, the method may further include step S110, step S120.
In step S110, the plurality of interfaces 140 are initialized.
Referring to fig. 6, fig. 6 is a flowchart illustrating sub-steps of step S110 shown in fig. 5 according to a first embodiment of the present invention. The step S110 includes a substep S112 and a substep S114.
In the substep S112, the plurality of interfaces 140 are divided into a client interface 142 for connecting to the client 200 and a device interface 144 for connecting to the network device 300.
And a substep S114, defining the client interface 142 and the device interface 144 to obtain a client interface number and a device interface number, and performing port isolation on the device interface 144.
In the present embodiment, there are multiple interfaces 140 on the server 100, and the server 100 defines an interface number (port-id) for each interface 140 according to the type of the interface 140. The client interface number may preferably be defined as 0. The device port number may preferably be defined to be sequentially incremented from 1. The definition method of the client interface number and the device interface number can be defined according to actual conditions, and the definition method provided above is only a preferred embodiment and does not limit the definition of the interface number.
In this embodiment, since the real IP addresses of the network devices 300 are the same, after one network device 300 accesses, IP address collision occurs when the subsequent network devices 300 with the same IP access again, and access abnormality occurs. To ensure proper communication access between the server 100 and the plurality of network devices 300, all the device-side interfaces 144 are added to an isolation group for port isolation. Through the port isolation technology, a user can add ports/interfaces to be controlled into one isolation group, so that two-layer and three-layer data isolation among the ports in the isolation group is realized, and the ports/interfaces in the same isolation group can be ensured to carry out communication access and data transmission respectively without mutual interference.
Step S120, defining a virtual IP address of the network device 300 according to the server 100 interface connected to the network device 300.
Referring to fig. 7, fig. 7 is a flowchart illustrating sub-steps of step S120 shown in fig. 5 according to a first embodiment of the present invention. The step S120 includes a substep S121, a substep S122, a substep S123, a substep S124, a substep S125, and a substep S126.
Substep S121 receives the arp packet sent by the network device 300.
In this embodiment, an Address Resolution Protocol (ARP) is a TCP/IP Protocol that acquires a physical Address according to an IP Address. When the host sends information, it broadcasts the ARP request containing the target IP address to all hosts on the network and receives the return message, so as to determine the physical address of the target. After receiving the return message, the IP address and the physical address are stored in the local ARP cache and are kept for a certain time, and the ARP cache is directly inquired when the next request is made so as to save resources.
And a substep S122, obtaining the address information of the network device 300 based on the arp packet.
In this embodiment, the address information includes the real IP address of the network device 300. After the network device 300 connects to the server 100, it sends an ARP to verify whether there is a conflict between the IP addresses of other devices in the network and itself. At this time, the server 100 may automatically learn the real IP address (e.g., 192.168.0.30) of the network device 300 using ARP.
Substep S123, redefining the IP address of the network device 300 based on the obtained address information of the network device 300, to obtain the virtual IP address of the network device 300.
In this embodiment, the IP address of the network device 300 is redefined based on the real IP address of the network device 300 included in the address information of the network device 300, the device interface number corresponding to the connection of the network device 300, and a preset address definition rule, so as to obtain the virtual IP address of the network device 300.
In this embodiment, the preset address definition rule may be set as: the last digit of the real IP address (192.168.0.30) of network device 300 + port-id. For example:
connecting to the network device 300 with device port number 1, the virtual IP address is 192.168.0.30+1, i.e. 192.168.0.31;
connecting to the network device 300 with device port number 2, the virtual IP address is 192.168.0.30+2, i.e. 192.168.0.32;
……
at the network device 300 with device port number 10, the virtual IP address is 192.168.0.30+10, i.e., 192.168.0.40.
Thus, the server 100 redefines the IP address of the network device 300 according to the device-side interface number to which the network device 300 is connected, so that a plurality of network devices 300 having the same IP address can be distinguished. When the client 200 tests the network devices 300, if the default IP address of the device (e.g., 192.168.0.30) is known, it can also know that the network device 300 is connected to the device-side interface 144 of the server 100, i.e., it can know what the IP address of the device to be accessed is. For example, to test the network devices 300 connected to the first 5 device-side interfaces 144, the IP to be accessed is: 192.168.0.31, 192.168.0.32, 192.168.0.33, 192.168.0.34, 192.168.0.35.
Referring to fig. 8, fig. 8 is a flowchart illustrating a fourth step of the method for accessing the network device 300 based on the same IP address according to the first embodiment of the present invention. In addition to the above steps, the method may further include step S130, step S140, and step S150.
In step S130, physical address learning is performed.
In this embodiment, the server 100 may perform automatic learning by using the ARP sent by the network device 300 to obtain the physical address of the network device 300, and store the physical address in the access table.
In this embodiment, the client 200 sends an ARP request to find the physical address of the network device 300 before accessing the network device 300. After receiving the ARP sent by the client 200, the server 100 may obtain the physical address of the client 200 by using the ARP request sent by the client 200, and store the physical address in an access table.
In this embodiment, after receiving the ARP request message sent by the client 200, the server 100 checks the access table to obtain the physical address of each network device 300, and the server 100 can respond to the ARP request of the client 200.
Step S140, establishing a corresponding relationship between the real IP address of the network device 300, the virtual IP address of the network device 300, and the physical address of the network device 300.
In this embodiment, the server 100 establishes a corresponding relationship between the virtual IP address of the network device 300, the real IP address of the network device 300, the physical address, and the device port number connected to the network device 300, and generates an access table entry record corresponding to the network device 300, where each access table entry record includes the device port number, the physical address, the real IP address, and the virtual IP address corresponding to the network device 300. And integrating all the access table entry records corresponding to the network device 300 to obtain an access table.
Step S150, establishing a corresponding relationship between the IP address of the client 200 and the physical address of the client 200.
In this embodiment, the server 100 establishes a corresponding relationship between the IP address of the client 200 and the physical address of the client 200, generates an access table entry record corresponding to the client 200, and adds the access table entry record to the access table. The access table entry record corresponding to the client 200 includes a client interface number, a physical address, and an IP address corresponding to the client 200.
The following describes the procedure of the above-described access method for the network devices 300 based on the same IP address, taking 4 network devices 300 as an example. At this time, the server 100 generates an access table as follows:
table 1 access table
Figure BDA0001235002440000141
1. Before sending out the Telnet access request message, the client 200 needs to complete the encapsulation of the access request message, and the destination MAC address in the message is unknown, so the client 200 will first send an ARP request to the server 100 to request the MAC addresses of the four network devices 300.
2. After the ARP request arrives at the server 100, the server 100 looks up the access table and responds to the ARP request of the client 200. The source MAC in the response message is 00:00:00:01, 00:00:00:00:00:02, 00:00:00:00:00:03, 00:00:00:04, respectively, which is the hardware address to be transmitted. The destination MAC is 00:11:22:33:44: 55.
3. If the client 200 knows the MAC addresses of four network devices 300 and also knows the virtual IP addresses of the network devices 300, the encapsulation of the Telnet request packet can be easily completed, as shown in table 2:
table 2 access message table
Figure BDA0001235002440000151
4. When the access packet request reaches the server 100, the server 100 checks the access table according to the destination MAC in the Telnet request packet, and then forwards the packet to the corresponding device-side interface 144, i.e., Port1, Port2, Port3, and Port4, respectively, and before formal forwarding, changes the destination IP in the Telnet request packet to 192.168.0.30 (the real IP address of the network device 300), so that the network device 300 can successfully respond after the packet reaches the network device 300. The replaced access packet is shown in table 3:
table 3 access message table
Figure BDA0001235002440000152
5. After receiving the request access message, the network device 300 replies to the request access message, and the reply message is sent to the server 100 and forwarded by the server 100 to the client 200. The reply message is shown in table 4:
TABLE 4 reply messages table
Figure BDA0001235002440000161
6. After receiving the reply message from the network device 300, the server 100 queries the access table according to the port-id to obtain a virtual IP address, and replaces the source IP address of the reply message with the virtual IP address. After the message information is updated, the server 100 will forward the reply message to the client 200 according to the access table.
The replaced reply message is shown in table 5:
table 5 reply messages table
Figure BDA0001235002440000162
7. When the four reply messages reach the client 200, the client 200 can complete the simultaneous access to the four network devices 300.
Second embodiment
Referring to fig. 9, fig. 9 is a functional block diagram of a network device access apparatus 400 according to a second embodiment of the present invention. The device is applied to a server 100 which is in communication connection with a client 200 and a plurality of network devices 300 with the same IP address. The network device access apparatus 400 includes: an initialization module 410, an address definition module 420, a learning module 430, a relationship establishment module 440, a receive access module 450, an address replacement module 460, and a receive reply module 470.
An initialization module 410, configured to perform initialization processing on the plurality of interfaces 140.
Referring to fig. 10, fig. 10 is a sub-functional block diagram of the initialization module 410 shown in fig. 9 according to a second embodiment of the present invention. The initialization module 410 includes:
the partitioning submodule 412 is configured to partition the interfaces 140 into a client interface 142 for connecting with the client 200 and an equipment interface 144 for connecting with the network equipment 300.
The interface definition sub-module 414 is configured to define the client interface 142 and the device interface 144 to obtain a client interface number and a device interface number, and perform port isolation on the device interface 144.
In this embodiment, the sub-modules included in the initialization module 410 are used to perform the sub-steps in fig. 6, and specific descriptions about the sub-modules included in the initialization module 410 may refer to the descriptions about the sub-steps in fig. 6.
An address definition module 420, configured to define a virtual IP address of the network device 300 according to a server 100 interface connected to the network device 300.
Referring to fig. 11, fig. 11 is a functional block diagram of the address definition module 420 shown in fig. 9 according to a second embodiment of the present invention. The address definition module 420 includes:
the receiving submodule 421 is configured to receive an address resolution protocol packet sent by the network device 300.
The obtaining sub-module 422 is configured to obtain address information of the network device 300 based on the arp packet.
A redefining sub-module 423, configured to redefine the IP address of the network device 300 based on the obtained address information of the network device 300, so as to obtain a virtual IP address of the network device 300.
In this embodiment, the sub-modules included in the address definition module 420 are used to perform the sub-steps in fig. 7, and specific descriptions about the sub-modules included in the address definition module 420 may refer to the descriptions about the sub-steps in fig. 7.
And a learning module 430, configured to perform physical address learning.
In the present embodiment, the learning module 430 is used to execute step S130 in fig. 8, and the detailed description about the learning module 430 may refer to the description of step S130 in fig. 8.
The relationship establishing module 440 is configured to establish a corresponding relationship between the real IP address of the network device 300, the virtual IP address of the network device 300, and the physical address of the network device 300.
The relationship establishing module 440 is further configured to establish a corresponding relationship between the IP address of the client 200 and the physical address of the client 200.
In the present embodiment, the relationship establishing module 440 is configured to execute the steps S140 and S150 in fig. 8, and the detailed description about the relationship establishing module 440 may refer to the description of the steps S140 and S150 in fig. 8.
The receiving access module 450 is configured to receive an access packet sent by the client 200.
In this embodiment, the receiving access module 450 is configured to execute step S160 in fig. 3, and the detailed description about the receiving access module 450 may refer to the description of step S160 in fig. 3.
The address replacing module 460 is configured to replace the access destination IP address in the access packet with the real IP address of the target network device 300 according to the corresponding relationship between the real IP address of the network device 300, the virtual IP address of the network device 300, and the physical address of the network device 300, and send the replaced access packet to the target network device 300 through the physical address of the target network device 300.
In this embodiment, the address replacing module 460 is configured to execute step S170 in fig. 3, and the detailed description about the address replacing module 460 may refer to the description of step S170 in fig. 3.
The reply receiving module 470 is configured to receive a reply message sent by the target network device 300.
In this embodiment, the receiving and replying module 470 is configured to execute step S180 in fig. 4, and the detailed description about the receiving and replying module 470 may refer to the description of step S180 in fig. 4.
The address replacing module 460 is further configured to replace the reply source IP address in the reply message with the virtual IP address of the target network device 300 according to the real IP address of the network device 300, the virtual IP address of the network device 300, the correspondence between the physical addresses of the network device 300 and the correspondence between the IP address of the client 200 and the physical address of the client 200, and send the replaced reply message to the client 200 through the physical address of the client 200.
In this embodiment, the address replacing module 460 is further configured to execute step S190 in fig. 4, and the operation of the address replacing module 460 on the reply packet may refer to the description of step S190 in fig. 4.
In summary, the present invention provides a method and an apparatus for accessing network devices based on the same IP address. By receiving an access message sent by a client. And replacing the access destination IP address (the virtual IP address of the target network equipment) in the access message by the real IP address of the target network equipment based on the access corresponding relation of the network equipment, and sending the replaced access message to the target network equipment through the physical address of the target network equipment. Therefore, the client can simultaneously access a plurality of network devices with the same IP address in the same network without frequently modifying access configuration, and the access and test efficiency can be greatly improved.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A network device access method based on the same IP address is applied to a server which is in communication connection with a client and a plurality of network devices with the same real IP address, wherein the server stores the corresponding relation among the real IP address of each network device, the virtual IP address of each network device and the physical address of each network device, the virtual IP address of each network device is different, and the virtual IP address of each network device is defined by a server interface connected with the network device, and the method comprises the following steps:
receiving an access message sent by the client, wherein the access message comprises access destination IP addresses and destination physical addresses of a plurality of target network devices, the access destination IP addresses are virtual IP addresses of the target network devices, and the destination physical addresses are physical addresses of the target network devices;
and according to the corresponding relation among the real IP address of the network equipment, the virtual IP address of the network equipment and the physical address of the network equipment, sending the access message to an equipment end interface, replacing the access destination IP address of each target network equipment in the access message with the real IP address of the target network equipment, and sending the replaced access message to the corresponding target network equipment through the physical address of the target network equipment.
2. The network device access method according to claim 1, wherein the server further stores a correspondence between an IP address of a client and a physical address of the client, the method further comprising:
receiving a reply message sent by target network equipment, wherein the reply message comprises a reply source IP address, a reply destination IP address and a reply destination physical address, the reply source IP address is a real IP address of the target network equipment, the reply destination IP address is an IP address of the client, and the reply destination physical address is a physical address of the client;
and replacing the reply source IP address in the reply message with the virtual IP address of the target network equipment according to the real IP address of the network equipment, the virtual IP address of the network equipment, the corresponding relation between the physical addresses of the network equipment and the corresponding relation between the IP address of the client and the physical address of the client, and sending the replaced reply message to the client through the physical address of the client.
3. The network device access method of any of claims 1-2, wherein the method further comprises:
defining a virtual IP address of the network equipment according to a server interface connected with the network equipment;
the step of defining the virtual IP address of the network device according to the server interface connected to the network device comprises:
receiving an address resolution protocol message sent by network equipment;
acquiring address information of the network equipment based on the address resolution protocol message, wherein the address information comprises a real IP address of the network equipment;
redefining the IP address of the network equipment based on the acquired address information of the network equipment to obtain the virtual IP address of the network equipment.
4. The network device accessing method according to claim 3, wherein the step of redefining the IP address of the network device based on the obtained address information of the network device to obtain the virtual IP address of the network device comprises:
redefining the IP address of the network equipment based on the real IP address of the network equipment, the interface number corresponding to the server interface connected with the network equipment and a preset address definition rule, wherein the real IP address of the network equipment is included in the address information of the network equipment, and the virtual IP address of the network equipment is obtained.
5. The network device access method of claim 4, wherein the method further comprises:
performing physical address learning;
establishing a corresponding relation among a real IP address of the network equipment, a virtual IP address of the network equipment and a physical address of the network equipment; and
and establishing a corresponding relation between the IP address of the client and the physical address of the client.
6. A network device access apparatus, which is applied to a server communicatively connected to a client and a plurality of network devices having the same real IP address, the server storing a correspondence relationship between real IP addresses of the network devices, virtual IP addresses of the network devices, and physical addresses of the network devices, wherein a virtual IP address of each of the network devices is different, and the virtual IP address of the network device is defined by a server interface connected to the network device, the apparatus comprising:
a receiving access module, configured to receive an access packet sent by the client, where the access packet includes access destination IP addresses and destination physical addresses of multiple target network devices, the access destination IP address is a virtual IP address of a target network device, and the destination physical address is a physical address of the target network device;
and the address replacement module is used for sending the access message to the equipment end interface according to the corresponding relation among the real IP address of the network equipment, the virtual IP address of the network equipment and the physical address of the network equipment, replacing the access destination IP address of each target network equipment in the access message with the real IP address of the target network equipment, and sending the replaced access message to the corresponding target network equipment through the physical address of the target network equipment.
7. The apparatus of claim 6, further comprising:
a reply receiving module, configured to receive a reply message sent by a target network device, where the reply message includes a reply source IP address, a reply destination IP address, and a reply destination physical address, the reply source IP address is a real IP address of the target network device, the reply destination IP address is an IP address of the client, and the reply destination physical address is a physical address of the client;
and the address replacement module is further configured to replace the reply source IP address in the reply message with the virtual IP address of the target network device according to the real IP address of the network device, the virtual IP address of the network device, the correspondence between the physical addresses of the network device and the correspondence between the IP address of the client and the physical address of the client, and send the replaced reply message to the client through the physical address of the client.
8. The network device access apparatus of any of claims 6-7, wherein the apparatus further comprises:
the address definition module is used for defining the virtual IP address of the network equipment according to a server interface connected with the network equipment;
the address definition module includes:
the receiving submodule is used for receiving an address resolution protocol message sent by the network equipment;
the obtaining submodule is used for obtaining the address information of the network equipment based on the address resolution protocol message, wherein the address information comprises the real IP address of the network equipment;
and the redefinition sub-module is used for redefining the IP address of the network equipment based on the acquired address information of the network equipment to obtain the virtual IP address of the network equipment.
9. The apparatus according to claim 8, wherein the redefining sub-module redefines the IP address of the network device based on the obtained address information of the network device, and the obtaining the virtual IP address of the network device comprises:
redefining the IP address of the network equipment based on the real IP address of the network equipment, the interface number corresponding to the server interface connected with the network equipment and a preset address definition rule, wherein the real IP address of the network equipment is included in the address information of the network equipment, and the virtual IP address of the network equipment is obtained.
10. The network device access apparatus of claim 9, wherein the apparatus further comprises:
the learning module is used for learning the physical address;
the relation establishing module is used for establishing the corresponding relation among the real IP address of the network equipment, the virtual IP address of the network equipment and the physical address of the network equipment; and
and the relationship establishing module is also used for establishing the corresponding relationship between the IP address of the client and the physical address of the client.
CN201710113168.7A 2017-02-28 2017-02-28 Network equipment access method and device based on same IP address Active CN106850876B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710113168.7A CN106850876B (en) 2017-02-28 2017-02-28 Network equipment access method and device based on same IP address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710113168.7A CN106850876B (en) 2017-02-28 2017-02-28 Network equipment access method and device based on same IP address

Publications (2)

Publication Number Publication Date
CN106850876A CN106850876A (en) 2017-06-13
CN106850876B true CN106850876B (en) 2020-05-19

Family

ID=59137691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710113168.7A Active CN106850876B (en) 2017-02-28 2017-02-28 Network equipment access method and device based on same IP address

Country Status (1)

Country Link
CN (1) CN106850876B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108111422B (en) * 2017-12-29 2020-11-27 北京明朝万达科技股份有限公司 DPDK-based data high-speed multi-path forwarding method and device
CN108521337A (en) * 2018-03-07 2018-09-11 广州芯德通信科技股份有限公司 A kind of more same type ONU are carried out at the same time the implementation method of default setting
CN108650182B (en) 2018-04-20 2020-09-25 腾讯科技(深圳)有限公司 Network communication method, system, device, equipment and storage medium
CN109729190B (en) * 2019-03-15 2024-02-09 深圳前海微众银行股份有限公司 Network access method, system, device and computer readable storage medium
CN110381178B (en) * 2019-08-02 2022-04-01 杭州巨峰科技有限公司 NVR module and drawing method thereof and POE-NVR module
CN112738074B (en) * 2020-12-25 2023-02-24 成都鼎安华智慧物联网股份有限公司 Method for realizing Telnet communication in network isolation
CN112953790A (en) * 2021-01-27 2021-06-11 武汉虹信科技发展有限责任公司 Test system and method for devices with same IP address
CN114157632B (en) * 2021-10-12 2023-11-21 北京华耀科技有限公司 Network isolation method, device, equipment and storage medium
CN114244701B (en) * 2021-12-24 2024-04-12 四川天邑康和通信股份有限公司 Large-scale production and test method for wireless router equipment
CN114650471B (en) * 2022-03-28 2023-12-26 洛阳萃泽信息科技有限公司 Numerical control machine tool acquisition system, centralized acquisition module and machine tool data acquisition method
CN116760756B (en) * 2023-08-15 2023-12-01 湖南天冠电子信息技术有限公司 Method for testing terminal equipment by test switch and test switch networking system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257447A (en) * 2008-03-14 2008-09-03 华为技术有限公司 Method, system and routing apparatus of load sharing
CN101552697A (en) * 2009-05-06 2009-10-07 深圳市普联技术有限公司 Network access apparatus upgrade system and network access apparatus upgrade method
CN102647487A (en) * 2012-05-11 2012-08-22 浙江宇视科技有限公司 Method for saving Internet protocol (IP) addresses and access proxy equipment
CN102710527A (en) * 2012-06-21 2012-10-03 浙江宇视科技有限公司 Switch and management server supporting flexible expansion of services
CN103533103A (en) * 2013-10-31 2014-01-22 成都西加云杉科技有限公司 Communication method and device based on network address translation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257447A (en) * 2008-03-14 2008-09-03 华为技术有限公司 Method, system and routing apparatus of load sharing
CN101552697A (en) * 2009-05-06 2009-10-07 深圳市普联技术有限公司 Network access apparatus upgrade system and network access apparatus upgrade method
CN102647487A (en) * 2012-05-11 2012-08-22 浙江宇视科技有限公司 Method for saving Internet protocol (IP) addresses and access proxy equipment
CN102710527A (en) * 2012-06-21 2012-10-03 浙江宇视科技有限公司 Switch and management server supporting flexible expansion of services
CN103533103A (en) * 2013-10-31 2014-01-22 成都西加云杉科技有限公司 Communication method and device based on network address translation

Also Published As

Publication number Publication date
CN106850876A (en) 2017-06-13

Similar Documents

Publication Publication Date Title
CN106850876B (en) Network equipment access method and device based on same IP address
EP3471375B1 (en) Method and apparatus for managing field device based on cloud server
US6701377B2 (en) Automation system and connecting apparatus for communication between two networks that use two different protocols with conversion between TCP/IP and PCP
US6249814B1 (en) Method and apparatus for identifying devices on a network
EP2297648B1 (en) Network controller based pass-through communication mechanism between local host and management controller
US7542466B2 (en) System and method of information communication, information processing apparatus and information processing method, program and recording medium
US20040071148A1 (en) Information device, gateway device and control method
US20070041388A1 (en) Device having an embedded Ethernet networking automated link for facilitating configuration of the device and connection of the device to a network
US9596178B2 (en) Relay server and relay communication system
US7599393B1 (en) Architecture for emulating an ethernet network interface card
CN112714027B (en) Method and system for accessing terminal equipment of Internet of things to gateway
TWI638553B (en) Method for detecting internet protocol address and media access control address
KR100953676B1 (en) Architecture for emulating an ethernet network interface card
US9344399B2 (en) Relay server and relay communication system
CN114070723A (en) Virtual network configuration method and system of bare metal server and intelligent network card
CN105991679B (en) A kind of implementation method and device of network sharing
CN110768862B (en) Cloud platform physical link connectivity detection device, method and system
US9385990B2 (en) Relay server and relay communication system
CN114189492A (en) Network card pressure testing method and system based on network address translation technology
US20080301273A1 (en) Centrally assigning branch specific network addresses
US9197557B2 (en) Relay server and relay communication system
JP4676320B2 (en) Switching hub apparatus and duplicate IP address automatic conversion method
CN112789565A (en) Aggregator device for standardized access to multiple network segments of a field bus system
CN108141480B (en) Method and apparatus for addressing in a system of interconnected cells
EP3340542A1 (en) Method for configuring a device connected to a field bus

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
TR01 Transfer of patent right

Effective date of registration: 20221108

Address after: 15 / F, Zhongchuang Plaza, 385 Hangtian Middle Road, national civil aerospace industrial base, Xi'an City, Shaanxi Province 710100

Patentee after: Xi'an Yu vision Mdt InfoTech Ltd.

Address before: 310000 1-11 / F, South Block, building 10, No. 88, Jiangling Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: ZHEJIANG UNIVIEW TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right