Resource access method and device, electronic equipment and storage medium
By detecting changes in the actual network addresses of resource devices in real time and updating the mapping relationship, the problem of video distortion caused by changes in the IP addresses of resource devices is solved, ensuring the reliability and stability of resource access.
Patent Information
- Application Number
- CN202411250948.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, changes in the actual IP address of resource devices can cause address translation table entries under IPtables NAT to become uncorresponding, resulting in video distortion.
By using the physical address of the resource device and ARP reply packets within the broadcast domain, changes in the real network address of the resource device are detected in real time, and the mapping relationship between the virtual network address and the real network address is updated to ensure that the mapping relationship is updated as the real network address changes.
It ensures the reliability and stability of resource access, prevents resource devices from being spoofed through network addresses, and guarantees the correctness of video access.
Smart Images

Figure CN121644513A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data communication, and in particular to a resource access method and device, electronic equipment and storage medium. BACKGROUND
[0002] The social resource access scheme is used for accessing independent video monitoring resources built by various units in society to a public platform for unified management.
[0003] At present, the scheme for accessing resource equipment to a public platform mainly combines IPtables NAT (Network Address Translation) and VPN (Virtual Private Network) to realize. In this scheme, a VPN network channel is established between the access gateway client and the access gateway server, and the access gateway server distributes a unique virtual IP address for the resource equipment. Based on the mapping relationship between the real IP (Internet Protocol) address and the virtual IP address of the resource equipment, the access network client performs SNAT (Source Network Address Translation) and DNAT (Destination Network Address Translation) of IPtables after the resource equipment is accessed.
[0004] However, the implementation premise of the IPtables NAT technology is that the real IP address of the resource equipment is fixed and unchanged. Once the real IP address of the resource equipment changes, the address translation table item under the IPtables NAT cannot be corresponded, and the pulled video may be collected by other monitoring equipment, resulting in a picture disorder. SUMMARY
[0005] The present application provides a resource access method, device, electronic equipment and storage medium, to solve the defect that the resource equipment access does not support real IP address change in the related art, resulting in picture disorder.
[0006] The present application provides a resource access method, comprising: Based on the response message of the address resolution protocol ARP in the broadcast domain where the resource equipment is located and the physical address of the resource equipment, the change of the real network address of the resource equipment is detected in real time; In the case where the change of the real network address of the resource equipment is detected, the mapping relationship between the virtual network address and the real network address of the resource equipment is updated based on the changed real network address; Based on the updated mapping relationship, the resource device is accessed.
[0007] According to the resource access method provided by the application, the real network address of the resource device is detected in real time based on the ARP reply message in the broadcast domain where the resource device is located and the physical address of the resource device, and the method comprises the following steps: When the resource device is in the broadcast domain to which the local end belongs, an ARP request message is sent to the device in the broadcast domain, and an ARP reply message returned by the device is received; Based on the reply message and the physical address of the resource device, the change of the real network address of the resource device is monitored.
[0008] According to the resource access method provided by the application, the real network address of the resource device is detected in real time based on the ARP reply message in the broadcast domain where the resource device is located and the physical address of the resource device, and the method comprises the following steps: When the resource device is in the broadcast domain to which the local end belongs, an ARP request message is sent to the device in the broadcast domain, and an ARP reply message returned by the device is received; When the change of the real network address of the resource device is detected, the changed real network address sent by the switch is received.
[0009] According to the resource access method provided by the application, the real network address of the resource device is detected in real time based on the ARP reply message in the broadcast domain where the resource device is located and the physical address of the resource device, and the method comprises the following steps: Based on the network address of the switch and the user information logged in the switch, a connection with the switch is established.
[0010] According to the resource access method provided by the application, the physical address of the resource device is sent to the switch in the same broadcast domain as the resource device, which comprises the following steps: The mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device is established, and the physical address of the resource device is sent to the switch in the same broadcast domain as the resource device based on the mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device.
[0011] The resource access method provided by the application comprises the following steps: The mapping relationship between the virtual network address and the real network address of the resource device is updated based on the mapping relationship between the changed real network address and the physical address of the resource device and the mapping relationship between the physical address and the virtual network address of the resource device.
[0012] The resource access method provided by the application further comprises the following steps: The virtual network address of the resource device is applied to a server based on the physical address of the resource device, and the mapping relationship between the physical address and the virtual network address is obtained.
[0013] The application further provides a resource access method, which comprises the following steps: The physical address of a resource device is received from an access gateway client. The change of the real network address of the resource device is detected in real time based on the physical address of the resource device and the address resolution protocol (ARP) reply packet in the broadcast domain where the resource device is located. In the case that the change of the real network address of the resource device is detected, the changed real network address is returned to the access gateway client, and the changed real network address is used to update the mapping relationship between the virtual network address and the real network address of the resource device, and the mapping relationship is used for resource access of the resource device.
[0014] The resource access method provided by the application comprises the following steps: The mapping relationship between the physical address and the real network address in the ARP reply packet is obtained by analyzing the ARP reply packet. The change of the real network address of the resource device is detected in real time based on the mapping relationship between the physical address and the real network address of the resource device stored in advance and the mapping relationship between the physical address and the real network address in the ARP reply packet, and in the case that the change of the real network address of the resource device is detected, the mapping relationship between the physical address and the real network address of the resource device stored in advance is updated based on the mapping relationship between the physical address and the real network address in the ARP reply packet.
[0015] The resource access method provided by the application further comprises the following steps: receiving a connection request, the connection request being sent by the access gateway client based on a network address of the switch and user information logged on the switch; establishing a connection with the access network client based on the connection request.
[0016] The application further provides a resource access device, comprising: a detection unit, configured to detect a change of a real network address of a resource device in real time based on an address resolution protocol (ARP) reply message in a broadcast domain where the resource device is located and a physical address of the resource device; a mapping unit, configured to update a mapping relationship between a virtual network address and the real network address of the resource device based on the changed real network address when detecting that the real network address of the resource device changes; an access unit, configured to perform resource access on the resource device based on the updated mapping relationship.
[0017] The application further provides a resource access device, comprising: a receiving unit, configured to receive a physical address of a resource device sent by an access gateway client; a detection unit, configured to detect a change of a real network address of a resource device in real time based on the physical address of the resource device and an address resolution protocol (ARP) reply message in a broadcast domain where the resource device is located; a sending unit, configured to return the changed real network address to the access gateway client when detecting that the real network address of the resource device changes, the changed real network address being used to update a mapping relationship between a virtual network address and the real network address of the resource device, the mapping relationship being used for resource access on the resource device.
[0018] The application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the resource access method according to any one of the above when executing the program.
[0019] The application further provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the resource access method according to any one of the above.
[0020] The application further provides a computer program product, comprising a computer program, and the computer program is executable on a processor to implement the resource access method according to any one of the above.
[0021] The resource access method, device, electronic equipment and storage medium provided by the application detect the change of the real network address of the resource device in real time based on the unique and fixed physical address of the resource device, and update the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address when the change is detected, so that the mapping relationship can be updated correspondingly with the change of the real network address. The resource device is accessed based on the updated mapping relationship, so that the resource access can support the case where the real network address of the resource device changes, thereby ensuring the reliability and stability of the resource access.
[0022] Moreover, taking the physical address as the basis for detecting the change of the real network address and updating the mapping relationship can avoid the case where the resource device is replaced and then impersonated through the network address. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the application or the related art, the following will briefly introduce the drawings needed to be used in the embodiments or the related art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0024] Figure 1 is one of the flowcharts of the resource access method provided by the application.
[0025] Figure 2 is the second flowchart of the resource access method provided by the application.
[0026] Figure 3 is the third flowchart of the resource access method provided by the application.
[0027] Figure 4 is one of the structural diagrams of the resource access device provided by the application.
[0028] Figure 5 is the second structural diagram of the resource access device provided by the application.
[0029] Figure 6 is the structural diagram of the electronic equipment provided by the application. DETAILED DESCRIPTION
[0030] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0031] The social resource access scheme is used for accessing independent video monitoring resources built by various units in society to a public platform for unified management. The social resources refer to resource devices at the device level such as IP cameras (IP CAMERA) and network hard disk recorders (Network Video Recorder, NVR) in places such as Internet cafes, hotels, supermarkets and bus stations that need to be accessed to the public platform.
[0032] At present, the scheme for accessing resource devices to the public platform can be a UNP (Universal Network Passport) scheme. In the UNP scheme, IPtables NAT and VPN can be combined. Specifically, a VPN network channel can be established between the access gateway client and the access gateway server, the access gateway server can distribute a unique virtual IP address for the resource device, the access network client can establish SNAT table items and DNAT table items in Iptables based on the mapping relationship between the real IP address and the virtual IP address of the resource device, and then the SNAT table items and the DNAT table items can be applied to convert the real IP address and the virtual IP address after the resource device is accessed.
[0033] However, the implementation premise of the IPtables NAT technology is that the real IP address of the resource device is fixed and unchanged. Once the real IP address of the resource device changes, the SNAT table items and the DNAT table items in the IPtables will correspondingly appear errors, and the pulled video may be collected by other monitoring devices, resulting in a picture disorder.
[0034] In view of the above problems, the embodiment of the present application provides a resource access method. Figure 1 is one of the flowcharts of the resource access method provided by the present application, as shown in Figure 1 The method is applied to an access gateway client, and the method can include the following steps: Step 110, based on the address resolution protocol (ARP) response packet in the broadcast domain where the resource device is located and the physical address of the resource device, the real network address of the resource device is detected in real time.
[0035] Specifically, the resource device, i.e., a social resource device to be accessed, is used to record a monitoring video and access the monitoring video to the public platform for unified management. The access gateway client refers to a proxy device deployed on the resource device side, and is used to realize resource access of the resource device to the public platform. The access gateway client can be denoted as VPN Client.
[0036] The physical address of the resource device, i.e., the MAC (Media Access Control) address of the resource device, is also called a hardware address or a link layer address. The physical address is a set of unique sequences burned on the network card of the resource device when manufactured, and is used to uniquely identify a network interface in the data link layer. That is, the physical address of the resource device can be understood as the unique identifier of the resource device.
[0037] The real network address of the resource device is the IP address of the resource device when the resource device accesses the access gateway client through the DHCP (Dynamic Host Configuration Protocol), i.e., the real IP address of the resource device.
[0038] Considering that the real network address of the resource device may change in the resource access process, in order to be able to follow the change of the real network address of the resource device, the NAT entry in the Iptables is updated correspondingly. Real-time detection can be performed on whether the real network address of the resource device changes.
[0039] In the specific implementation, the real network address of the resource device can be detected in combination with the ARP (Address Resolution Protocol) response packet in the broadcast domain where the resource device is located and the physical address of the resource device.
[0040] The address resolution protocol (Address Resolution Protocol, ARP) is a protocol used to resolve network addresses (such as IPv4 addresses) to physical addresses in a network. For each network device in the same broadcast domain, an ARP request packet can be broadcasted, and an ARP response packet returned by each network device in response to the ARP request packet can be received. The ARP response packet is parsed to obtain the mapping relationship between the physical address and the real network address of the network device.
[0041] In the embodiment of the present application, in order to realize real-time detection of the change of the real network address of the resource device, the request message of ARP can be broadcast in the broadcast domain where the resource device is located every certain period of time, so that the resource device can return the response message of ARP carrying its own physical address and real network address after receiving the request message. Since the response message carries the physical address and real network address of the resource device itself, after the physical address of the resource device is parsed, the real network address corresponding to the physical address stored locally can be compared with the real network address parsed from the response message. If they are the same, it means that the real network address of the resource device has not changed, and if they are different, it means that the real network address of the resource device has changed. The real network address parsed from the response message is the real network address after the change.
[0042] For example, the access gateway client can maintain the IP_MAC table locally. The IP_MAC table is used to store the physical address (MAC) and real network address (IP) of each resource device, and can also be used to record the time when the real network address of each resource device changes. After the real network address is parsed from the response message of ARP, the parsed real network address can be compared with the real network address in the IP_MAC table maintained locally. If they are consistent, it means that the real network address of the resource device has not changed, and if they are different, it means that the real network address of the resource device has changed. The parsed real network address is updated to the IP_MAC table.
[0043] In the embodiment of the present application, considering that the physical address of the resource device is unique and fixed, the physical address of the resource device can be used as the unique identifier of the resource device, which is used as the basis to detect whether the real network address corresponding to the same physical address changes in real time, so as to realize real-time detection of the real network address of the resource device.
[0044] In addition, the change of the real network address of the resource device is detected through the response message of ARP of the resource device, so that the change of the real network address can be detected in time, thereby ensuring the reliability of resource access.
[0045] In step 120, in the case where the real network address of the resource device is detected to change, the mapping relationship between the virtual network address and the real network address of the resource device is updated based on the changed real network address.
[0046] Specifically, the virtual network address of the resource device refers to a virtual IP address established for accessing the resource device to the public platform, and specifically refers to a new IP address configured for the resource device by an access gateway server deployed on the public platform. It can be understood that the access gateway server here is a server that interfaces with the access gateway client, which can be denoted as VPN server for example.
[0047] The process of resource access can specifically be a process of SNAT and DNAT conversion of the virtual network address and the real network address of the resource device by the access gateway client, so as to transmit the video collected by the resource device to the public platform and transmit the instructions issued by the public platform to the resource device.
[0048] The detection of the change of the real network address of the resource device means that the mapping relationship for the network address conversion of the resource device also needs to be changed, so as to ensure the reliability of the resource access.
[0049] Therefore, in the case where the change of the real network address of the resource device is detected, the real network address after the change of the resource device can be applied to update the mapping relationship between the virtual network address and the real network address of the resource device. In the specific implementation, the changed real network address detected in step 110 corresponds to the physical address of the resource device, so in step 120, the physical address of the resource device is unique and fixed, and the mapping relationship between the virtual network address and the real network address of the resource device can be located by the physical address, and the real network address after the change can be applied to replace the original real network address in the mapping relationship, so as to update the mapping relationship.
[0050] In step 130, the resource access is performed on the resource device based on the updated mapping relationship.
[0051] Specifically, after the change of the real network address of the resource device is detected and the mapping relationship between the virtual network address and the real network address is updated based on the changed real network address, the updated mapping relationship can be obtained. It can be understood that the updated mapping relationship corresponds to the real-time detected real network address of the resource device, that is, the update of the mapping relationship follows the change of the real network address. Therefore, based on the updated mapping relationship, the resource access is performed on the resource device, which can avoid the problem of video pulling disorder caused by the change of the real network address in the related art.
[0052] The method provided by the embodiment of the application detects the change of the real network address of the resource device in real time based on the physical address of the unique and fixed resource device, and updates the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address when the change is detected, so that the mapping relationship can be updated correspondingly with the change of the real network address, and the resource device is accessed based on the updated mapping relationship, so that the resource access can support the case where the real network address of the resource device changes, thereby ensuring the reliability and stability of the resource access.
[0053] In the method, the physical address is used as the basis for detecting the change of the real network address and updating the mapping relationship, so that the case where the resource device is replaced and then impersonated through the network address can be avoided.
[0054] Based on any of the above embodiments, in step 110, the change of the real network address of the resource device is detected in real time based on the response message of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device, and the change of the real network address of the resource device is detected in real time based on the response message of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device. When the resource device is in the broadcast domain to which the local end belongs, a request message of the address resolution protocol (ARP) is sent to the devices in the broadcast domain, and a response message of the ARP returned by the devices is received. The change of the real network address of the resource device is monitored based on the response message and the physical address of the resource device.
[0055] Specifically, when the change of the real network address of the resource device is detected, it is necessary to determine whether the resource device and the access gateway client belong to the same broadcast domain, so as to determine whether the access network client itself can send a request message of the ARP to the resource device and receive a response message of the ARP returned by the resource device.
[0056] For the case where the resource device and the access gateway client belong to the same broadcast domain, that is, the case where the resource device is in the broadcast domain to which the local end belongs, the access gateway client can broadcast a request message of the ARP to all devices in the broadcast domain. Correspondingly, all devices in the broadcast domain will send a response message of the ARP containing their own physical address and real network address to the access gateway client after receiving the request message of the ARP. Therefore, the access gateway client can receive the response message of the ARP of each device in the broadcast domain.
[0057] Further, the access gateway client can parse the received reply packet to form an ARP table including the physical address and the real network address of each device. On this basis, the access gateway client can find the real network address corresponding to the physical address of the resource device from the ARP table according to the physical address of the resource device obtained in advance, and take the found real network address as the real network address of the resource device updated in real time. It can be understood that if the real network address of the resource device has been stored at the access gateway client before, the pre-stored real network address and the found real network address from the ARP table can be compared to monitor the change of the real network address of the resource device.
[0058] Further, the access gateway client can have one or more interfaces, and the network addresses of different interfaces can be adjusted according to resource in different broadcast domains. Thus, in the case that the access gateway client has multiple interfaces, the access gateway client itself can detect the change of the real network address of the resource device in different broadcast domains. If the interface of the access gateway client can cover all broadcast domains where the resource devices are located, the change detection of the real network address of all resource devices can be realized by the access gateway client itself, so that the change of the real network address does not need to be detected by the switch.
[0059] Based on any of the above embodiments, in step 110, the change of the real network address of the resource device is detected in real time based on the reply packet of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device, including: In the case that the resource device is outside the broadcast domain to which the access gateway client belongs, the physical address of the resource device is sent to the switch in the same broadcast domain as the resource device, and the change of the real network address of the resource device is detected in real time by the switch based on the reply packet of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device; The changed real network address sent by the switch in the case that the change of the real network address of the resource device is detected is received.
[0060] Specifically, in the case that the resource device and the access gateway client belong to different broadcast domains, that is, in the case that the resource device is outside the broadcast domain to which the access gateway client belongs, the access gateway client itself cannot send the request packet of ARP to the resource device, nor can it receive the reply packet of ARP returned by the resource device.
[0061] In this case, in order to achieve real-time detection of the real network address change of the resource device, a switch in the same broadcast domain as the resource device can be determined, the real network address change of the resource device is detected by the switch in real time, and the transformed real network address is sent to the access gateway client by the switch in the case of detecting that the real network address of the resource device has changed.
[0062] Among them, the switch refers to a switch with IP management function and capable of communicating with the access gateway client. For example, the switch can be a light management switch supporting lightweight management through the client, web, APP, and the light management switch has the functions of management IP, configurable VLAN, port mirroring, etc., and can synchronize the APR table to the access gateway client through a private protocol.
[0063] The access gateway client can establish a connection with the switch in advance, and in the connected state, the access gateway client can keep alive once every period of time, and if the keep-alive fails continuously for multiple times, it is determined that the switch is offline. For the case of the switch being offline, a connection request can be initiated to the switch every period of time until the connection state is re-entered.
[0064] In the process of real-time detection of the change of the real network address of the resource device, the access gateway client can determine a switch in the same broadcast domain as the resource device, and send the physical address of the resource device to the switch. After receiving the physical address of the resource device sent by the access gateway client, the switch lists the resource device as a resource device that needs to be detected for real network address change.
[0065] Subsequently, the switch can broadcast an ARP request message to all devices in the broadcast domain. Correspondingly, all devices in the broadcast domain including the resource device will send an ARP response message containing their own physical address and real network address to the switch after receiving the ARP request message. Thus, the switch can receive the ARP response messages of all devices in the broadcast domain.
[0066] And the switch can parse the received response message to form an ARP table including the physical address and real network address of each device. On this basis, the switch can find the real network address corresponding to the physical address of the resource device from the ARP table according to the physical address of the resource device received in advance, and take the found real network address as the real-time updated real network address of the resource device. It can be understood that if the real network address of the resource device has been stored at the switch before, the previously stored real network address and the found real network address from the ARP table can be compared, thereby monitoring the change of the real network address of the resource device.
[0067] And, when the switch detects that the real network address of the resource device changes, the switch can send the changed real network address to the access gateway client. Accordingly, the access gateway client can receive the changed real network address sent by the switch, i.e., the access gateway client learns that the real network address of the resource device changes, triggering the access gateway client to update the mapping relationship between the virtual network address and the real network address of the resource device.
[0068] In the method provided by the embodiment of the application, for the case that the resource device is in a broadcast domain other than the local one, i.e., the case that the resource device is in a different network segment from the access gateway client, the ARP detection is implemented through the switch, thereby ensuring that the access gateway client can still acquire the real network address of the resource device after the update in real time, realizing real-time detection of the real network address across network segments, and enabling the resource access to support the case that the real network address of the resource device changes, thereby ensuring the reliability and stability of the resource access.
[0069] Based on any of the above embodiments, before step 110, the method further comprises: Based on the network address of the switch and the user information logged in on the switch, a connection is established with the switch.
[0070] Specifically, in order to detect the real network address of the resource device belonging to a different broadcast domain from the access gateway client, the access gateway client needs to detect the change of the real network address of the resource device in real time with the help of the switch belonging to the same broadcast domain as the resource device. Before this, the access gateway client needs to establish a communication connection with the switch.
[0071] To implement the communication connection between the access gateway client and the switch, the access gateway client can acquire the network address of the switch to be connected and the user information required to be logged in on the switch. Here, the network address of the switch can be the IP address of the switch. The user information can be the username and password required to be logged in, etc. The network address and the user information can be input by an operator of the access gateway client or acquired from the configuration information of the access gateway client, and the embodiments of the application do not make a specific limitation in this regard.
[0072] After the network address of the switch to be connected and the user information required to be logged in on the switch are acquired, the access gateway client can establish a connection with the switch based thereon. Specifically, the access gateway client can carry the user information in a connection request and send the connection request to the network address of the switch, and the switch can establish a connection with the access gateway client after receiving the connection request and determining that the user information in the connection request is valid.
[0073] In addition, after the connection is established, the access gateway client can display the connection state of the switch on the interface, and detect the active state of the connection with the switch every certain period of time, i.e., performs a Keepalive every certain period of time, for example, a Keepalive every 60 seconds.
[0074] In addition, after the connection is established, the access gateway client can display the connection state of the switch on the interface, and detect the active state of the connection with the switch every certain period of time, i.e., performs a Keepalive every certain period of time, for example, a Keepalive every 60 seconds.
[0075] Based on any of the above embodiments, in step 110, the sending of the physical address of the resource device to the switch in the same broadcast domain as the resource device comprises: establishing a mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device, and sending the physical address of the resource device to the switch in the same broadcast domain as the resource device based on the mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device.
[0076] Specifically, for the case that the resource device and the access gateway client belong to different broadcast domains, the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device can be bound, i.e., a mapping relationship between the two can be constructed to realize the binding of the resource device and the switch in the same broadcast domain.
[0077] On this basis, in order to detect the real network address of the resource device that belongs to a different broadcast domain from the access gateway client, the physical address of the resource device can be sent to the switch in the same broadcast domain as the resource device based on the mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device, i.e., the physical address of the resource device is sent to the network address of the switch corresponding to the physical address in the mapping relationship. Thus, the access gateway client can send the physical address of the resource device to the switch, and the switch can list the resource device as a resource device that needs to be detected for real network address change, so as to realize the real network address change detection for the resource device.
[0078] For example, the access gateway client can maintain an IP_MAC table locally. The IP_MAC table is used to store the physical address (MAC) and real network address (IP) of each resource device, and can also be used to record the time when the real network address of each resource device changes. In addition, in the case where the resource device and the access gateway client belong to different broadcast domains, the IP_MAC table can also record the switch that belongs to the same broadcast domain as the resource device, i.e., establish a mapping relationship between the physical address of the resource device and the network address of the switch that belongs to the same broadcast domain as the resource device. After the switch resolves the response message of the ARP and obtains the real network address and judges that the real network address has changed, the changed real network address can be returned to the access gateway client, and the access gateway client can update the changed real network address in the IP_MAC table after receiving the changed real network address.
[0079] For example, the IP_MAC table maintained at the access gateway client can be represented in the form as shown below:
[0080] In the table, Res_MAC and Res_IP are the physical address and real network address of the resource device, respectively. SW_IP, SW_User, and SW_passwd are the network address of the switch that belongs to the same broadcast domain as the resource device, and the username and password for logging in on the switch, respectively. IP_Change_Time represents the time when the real network address changes. In the table, “XXX” represents any optional network address. It should be noted that for any resource device, if the real network address of the resource device cannot be queried, the real network address can be set to “0.0.0.0”.
[0081] Based on any of the above embodiments, in step 120, updating the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address comprises: updating the mapping relationship between the virtual network address and the real network address of the resource device based on the mapping relationship between the changed real network address and the physical address of the resource device, and the mapping relationship between the physical address of the resource device and the virtual network address.
[0082] Specifically, after the access gateway client determines that the real network address of the resource device has changed and obtains the changed real network address, the physical address of the resource device can be used as a basis for locating the mapping relationship between the virtual network address and the real network address of the resource device, thereby realizing the update of the mapping relationship between the virtual network address and the real network address of the resource device.
[0083] In a specific implementation, since the change of the real network address is detected based on the physical address of the resource device, the mapping relationship between the changed real network address and the physical address of the resource device can be obtained. In addition, considering that the virtual address of the resource device can be applied based on the physical address of the resource device, the mapping relationship between the physical address of the resource device and the virtual address of the resource device can also be obtained.
[0084] On this basis, the physical address of the resource device can be taken as a basis for determining the mapping relationship between the changed real network address and the virtual address of the resource device, that is, the mapping relationship between the virtual network address and the real network address of the resource device can be associated through the mapping relationship between the changed real network address and the physical address of the resource device, and the mapping relationship between the physical address of the resource device and the virtual network address, that is, the mapping relationship between the updated virtual network address and the real network address is obtained.
[0085] Based on any of the above embodiments, the method further comprises: applying, based on the physical address of the resource device, a virtual network address of the resource device to a server to obtain a mapping relationship between the physical address and the virtual network address.
[0086] Here, the server is an access gateway server. The access gateway server is a server deployed in a public platform, and the server is used to connect an access gateway client.
[0087] For the resource device to be accessed, the access gateway client can establish a VPN connection with the server and send the physical address of the resource device to the server, so as to apply for the virtual network address of the resource device from the server. Correspondingly, after receiving the physical address of the resource device, the server can distribute a new network address, i.e. a virtual network address, to the resource device according to the received physical address. It can be understood that the virtual network address distributed by the server is different for different resource devices.
[0088] The access gateway client can receive the virtual network address returned by the server, thereby establishing the mapping relationship between the physical address and the virtual network address of the resource device, so as to facilitate the application in subsequent updating of the mapping relationship between the virtual network address and the real network address of the resource device. In addition, the access gateway client can also establish a virtual network card for the resource device and configure the virtual network address on the virtual network card, so as to facilitate resource access.
[0089] For example, the access gateway client can record the virtual network address obtained through the server in the VPNIP_MAC table maintained locally. This VPNIP_MAC table records the physical address (MAC) and virtual network address (VPNIP) of each resource device; that is, the VPNIP_MAC table can maintain the mapping relationship between the physical address and virtual network address of each resource device.
[0090] In addition, the IP_MAC table maintained locally by the access gateway client can maintain the mapping relationship between the physical addresses and real network addresses of each resource device. Therefore, the access gateway client can read the real network address and virtual network address corresponding to the same MAC address through the IP_MAC table and VPN_MAC table, and perform NAT mapping on the real network address and virtual network address through IPtables, thereby generating the SNAT table and DNAT table.
[0091] Based on any of the above embodiments Figure 2 This is the second flowchart illustrating the resource access method provided by the present invention, as follows: Figure 2 As shown, this method is applied to a switch and may include the following steps: Step 210: Receive the physical address of the resource device sent by the access gateway client.
[0092] Here, "resource device" refers to the social resource device to be connected. This device is used to record surveillance video and then connect it to a public platform for unified management. The access gateway client is a proxy device deployed on the resource device side, used to enable resource access from the resource device to the public platform.
[0093] A switch is a switch that has IP management capabilities and can communicate with access gateway clients. For example, a switch can be a lightly managed switch that supports lightweight management through clients, web, and apps. Lightly managed switches have functions such as management IP, configurable VLANs, and port mirroring, and can synchronize APR tables to access gateway clients via proprietary protocols.
[0094] The physical address of a resource device is its MAC (Media Access Control) address, also known as the hardware address or data link layer address. A physical address is a unique sequence of characters burned into the network interface card (NIC) of the resource device by the manufacturer during production. It is used to uniquely identify a network interface at the data link layer. In other words, the physical address of a resource device can be understood as its unique identifier.
[0095] If the access gateway client and the resource device are in different broadcast domains, the access gateway client cannot send the request message of ARP to the resource device, and cannot receive the response message of ARP returned by the resource device.
[0096] In this case, in order to realize real-time detection of the change of the real network address of the resource device, the access gateway client can determine the switch in the same broadcast domain as the resource device, i.e., the switch as the execution subject in the embodiment of the application, and send the physical address of the resource device to the switch.
[0097] Correspondingly, the switch can receive the physical address of the resource device.
[0098] Step 220, based on the physical address of the resource device, and the response message of address resolution protocol (ARP) in the broadcast domain where the resource device is located, real-time detection of the change of the real network address of the resource device is performed.
[0099] Specifically, after receiving the physical address of the resource device, the switch can perform real-time detection on whether the real network address of the resource device changes.
[0100] In specific implementation, the change of the real network address of the resource device can be detected in combination with the response message of address resolution protocol (ARP) in the broadcast domain where the resource device is located, and the physical address of the resource device. It can be understood that the broadcast domain where the resource device is located is also the broadcast domain where the switch is located.
[0101] The address resolution protocol is a protocol used for resolving a network address (such as an IPv4 address) to a physical address in a network. For each network device in the same broadcast domain, the request message of ARP can be broadcasted, and the response message of ARP returned by each network device in response to the request message of ARP can be received, and the response message of ARP can be resolved to obtain the mapping relationship between the physical address and the real network address of the network device.
[0102] In the embodiment of the present application, in order to realize real-time detection of the change of the real network address of the resource device, the request message of ARP can be broadcast in the broadcast domain where the switch is located every certain period of time, so that the resource device can return the response message of ARP carrying its own physical address and real network address after receiving the request message. Since the response message carries the physical address and real network address of the resource device itself, after the physical address of the resource device is resolved, the real network address corresponding to the physical address stored locally can be compared with the real network address resolved from the response message. If the two are the same, it means that the real network address of the resource device has not changed, and if the two are different, it means that the real network address of the resource device has changed. The real network address resolved from the response message is the real network address after the change.
[0103] In the embodiment of the present application, considering that the physical address of the resource device is unique and fixed, the physical address of the resource device can be used as the unique identifier of the resource device, and based on this, real-time detection can be performed on whether the real network address corresponding to the same physical address changes, thereby realizing real-time detection of the real network address of the resource device.
[0104] Moreover, the change of the real network address of the resource device is detected through the response message of ARP of the resource device, so that the change of the real network address can be detected in time, thereby ensuring the reliability of resource access.
[0105] Step 230, in the case where the real network address of the resource device is detected to change, returning the changed real network address to the access gateway client, the changed real network address is used to update the mapping relationship between the virtual network address and the real network address of the resource device, and the mapping relationship is used for resource access of the resource device.
[0106] Specifically, the virtual network address of the source device refers to the virtual IP address established for resource device resource access to the public platform, and specifically refers to the new IP address configured for the resource device by the access gateway server deployed on the public platform side. It can be understood that the access gateway server here is the server that interfaces with the access gateway client, which can be denoted as VPN server for example.
[0107] The process of realizing resource access can be specifically the process of SNAT and DNAT conversion of the virtual network address and the real network address of the resource device by the access gateway client, so as to transmit the video collected by the resource device to the public platform and transmit the instructions issued by the public platform to the resource device.
[0108] If the real network address of the resource device is detected to change, it means that the mapping relationship for network address translation of the resource device also needs to change, thereby ensuring the reliability of resource access.
[0109] Therefore, in the case that the real network address of the resource device is detected to change, the switch can return the changed real network address to the access gateway client.
[0110] After receiving the changed real network address, the access gateway client can apply the real network address of the resource device after the change to update the mapping relationship between the virtual network address and the real network address of the resource device. In the specific implementation, the changed real network address detected in step 210 corresponds to the physical address of the resource device, so in step 220, the physical address of the resource device is also unique and fixed, and the mapping relationship between the virtual network address and the real network address of the resource device can be located through the physical address, and the changed real network address can replace the original real network address in the mapping relationship, thereby realizing the update of the mapping relationship. It can be understood that the updated mapping relationship corresponds to the real network address of the resource device detected in real time, that is, the update of the mapping relationship follows the change of the real network address. Therefore, based on the updated mapping relationship, resource access to the resource device can avoid the problem of video pulling disorder caused by the change of the real network address in the related art.
[0111] The method provided by the embodiment of the application detects the change of the real network address of the resource device in real time based on the unique and fixed physical address of the resource device, and in the case that the change is detected, updates the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address, thereby enabling the mapping relationship to be updated correspondingly with the change of the real network address, and enabling resource access to the resource device based on the updated mapping relationship, so that the resource access can support the case that the real network address of the resource device changes, thereby ensuring the reliability and stability of the resource access.
[0112] Based on any of the above embodiments, in step 220, the change of the real network address of the resource device is detected in real time based on the physical address of the resource device and the response packet of the address resolution protocol (ARP) in the broadcast domain where the resource device is located, and the method comprises the following steps: analyzing the response packet of the address resolution protocol (ARP) to obtain the mapping relationship between the physical address and the real network address in the response packet; Based on the pre-stored mapping relationship between the physical address and the real network address of the resource device, and the mapping relationship between the physical address and the real network address in the response message, changes in the real network address of the resource device are detected in real time. When a change in the real network address of the resource device is detected, the pre-stored mapping relationship between the physical address and the real network address of the resource device is updated based on the mapping relationship between the physical address and the real network address in the response message.
[0113] Specifically, after receiving the physical address of a resource device, the switch can establish and store the mapping relationship between the resource device's physical address and its real network address. For example, the switch can broadcast an ARP request message within its broadcast domain, allowing the resource device to return an ARP reply message carrying its own physical address and real network address upon receiving the request message. Since the reply message carries the resource device's own physical address and real network address, after resolving the resource device's physical address, the switch can construct the mapping relationship between the resource device's physical address and real network address based on the physical address and real network address carried in the reply message, thereby obtaining the pre-stored mapping relationship between the resource device's physical address and real network address.
[0114] Subsequently, every so often, the switch can broadcast an ARP request message within its broadcast domain, thereby enabling resource devices within the broadcast domain to return an ARP response message carrying their own physical address and real network address after receiving the request message.
[0115] Upon receiving the response message, it can be parsed to obtain the mapping relationship between the physical address and the real network address carried in the response message. This mapping relationship is crucial. Based on this, the pre-stored mapping relationship between the physical address and the real network address of the resource device can be compared with the mapping relationship in the response message. If they match, it means the real network address of the resource device has not changed, and the pre-stored mapping relationship remains unchanged. If they differ, it means the real network address of the resource device has changed, and the pre-stored mapping relationship can be updated to match the mapping relationship in the response message. This ensures that the pre-stored mapping relationship between the physical address and the real network address of the resource device is always up-to-date.
[0116] For example, a switch can maintain an IP_MAC_SW table locally. This table stores the physical addresses (MAC addresses) of the resource devices to be detected, as well as the actual network addresses of those devices. In other words, the IP_MAC_SW table reflects the pre-stored mapping between the physical addresses and actual network addresses of the resource devices. After receiving the physical address of a resource device, the switch can synchronize the received physical address to the IP_MAC_SW table and then query its own ARP table, which reflects the mapping between the physical address and the actual network address obtained from parsing the response packet.
[0117] If the same physical address is found, the corresponding real network address in the ARP table is written to the IP_MAC_SW table. If the physical address is not found, the real network address in the IP_MAC_SW table is recorded as 0.0.0.0. For example, the IP_MAC_SW table can be represented in the following form:
[0118] In the table, Res_MAC_SW and Res_IP_SW represent the physical address and real network address of the resource device, respectively. IP_Syn_Status_SW indicates the synchronization status of the real network address, with values of 0 and 1 representing no synchronization with the access gateway client and synchronized with the access gateway client, respectively. IP_Change_Time indicates the time when the real network address changed.
[0119] Furthermore, when writing the real network address corresponding to the physical address in the ARP table into the IP_MAC_SW table, if the real network address already exists in the IP_MAC_SW table, the real network address already existing in the IP_MAC_SW table is compared with the real network address in the ARP table. If they match, it means that the real network address has not changed; if they differ, it means that the real network address has changed.
[0120] Based on any of the above embodiments, in step 210, before receiving the physical address of the resource device sent by the access gateway client, the method further includes: Receive a connection request, which is sent by the access gateway client based on the network address of the switch and the user information logged in on the switch; Based on the connection request, a connection is established with the access network client.
[0121] Specifically, in order to detect the real network address of a resource device belonging to a different broadcast domain than the access gateway client, the access gateway client needs to use a switch belonging to the same broadcast domain as the resource device to detect changes in the resource device's real network address in real time. Before this, the access gateway client needs to establish a communication connection with the switch.
[0122] To establish a communication connection between the access gateway client and the switch, the access gateway client can obtain the network address of the switch to be connected, as well as the user information required for login on the switch. Here, the network address of the switch can be the switch's IP address. The user information can be the username and password required for login. Both the network address and user information can be entered by the operator of the access gateway client or obtained from the configuration information of the access gateway client; this embodiment of the invention does not impose specific limitations on this.
[0123] After obtaining the network address of the switch to be connected, as well as the user information required to log in to the switch, the access gateway client can send a connection request to the switch. Specifically, the access gateway client can include the user information in the connection request and send the connection request to the switch's network address.
[0124] Accordingly, upon receiving a connection request, the switch can establish a connection with the access gateway client. For example, after receiving a connection request and verifying the validity of the user information in the request, the switch can establish a connection with the access gateway client.
[0125] Based on any of the above embodiments Figure 3 This is the third flowchart of the resource access method provided by the present invention, as shown below. Figure 3 As shown, the resource access method includes the following steps: Step 1: Establish a communication connection between the access gateway client and the light management switch through the communication module of the access gateway client and the communication module of the light management switch.
[0126] The communication connection here can be used for user registration and communication connection persistence. For example, the IP address (SW_IP), username, password, and other information of the light-managed switch can be configured in the web interface of the access gateway client, and this information can be stored in the IP_MAC table maintained locally by the access gateway client. The communication module can then establish a communication connection with the light-managed switch using this information.
[0127] After a normal connection is established, the web interface of the access gateway client can display the connection status with the light management switch. During the communication connection, it can keep the switch active every 60 seconds. If the keep-alive fails three times in a row, the access gateway client will put the light management switch into offline mode. In offline mode, the access gateway client can send a connection request to the light management switch every 60 seconds.
[0128] Step 2: Configure the physical address of the resource device on the access gateway client. Furthermore, for cases where the resource device and the access gateway client are in different broadcast domains, bind the physical address of the resource device to a light-managed switch in the same broadcast domain on the access gateway client.
[0129] Specifically, when binding the physical address of a resource device to a lightly managed switch within the same broadcast domain, the physical address can be written into the row of the IP_MAC table containing the network address of the lightly managed switch. Furthermore, in this case, the actual network address of the added resource device in the IP_MAC table can be set to 0.0.0.0.
[0130] Furthermore, if the resource device and the access gateway client are in the same broadcast domain, there is no need to bind the resource device to a light management switch, and the access gateway client does not need to establish a communication connection with the light management switch. The access gateway client can directly query the real network address corresponding to the physical address in its own ARP table and fill the obtained real network address into the IP_MAC table.
[0131] Step 3: Real-time detection of changes in the actual network address of resource devices.
[0132] For resource devices located in different broadcast domains from the access gateway client, the access gateway client can send the physical address of the resource device to the MAC maintenance module of the light-managed switch through the MAC maintenance module, thus realizing the distribution of social resource MAC addresses. At the light-managed switch, the MAC maintenance module maintains a local IP_MAC_SW table. It can store received physical addresses in the IP_MAC_SW table and then sequentially read each physical address from the IP_MAC_SW table and query its own ARP table. If a matching physical address is found, the corresponding real network address from the ARP table is written to the IP_MAC_SW table. If the physical address is not found, the real network address in the IP_MAC_SW table is recorded as 0.0.0.0.
[0133] After completing the query, the lightweight management switch can return the obtained real network address to the access gateway client, thus realizing the uploading of social resource IP / MAC relationships. Subsequently, the lightweight management switch can monitor and analyze ARP reply packets within the broadcast domain in real time, and when the real network address corresponding to the physical address changes, it synchronizes the changed physical address and real network address to the access gateway client. During this process, the lightweight management switch can actively obtain the mapping between the physical address and real network address of resource devices within the same broadcast domain by sending ARP request packets every 5 minutes based on the physical address in the IP_MAC_SW table, and synchronize this mapping to the access gateway client. If no ARP reply packet is received from a resource device within a certain period, the real network address IP in the IP_MAC_SW table is set to 0.0.0.0 and synchronized to the access gateway client.
[0134] Accordingly, the access gateway client will write the mapping between the physical addresses and real network addresses of the resource devices synchronized by the light management switch into the IP_MAC table in real time.
[0135] For resource devices within the same broadcast domain as the access gateway client, the access gateway client can send ARP request packets every 5 minutes to each resource device in the IP_MAC table to actively obtain the mapping between the physical address and the real network address of the resource devices within the same broadcast domain, and write the mapping into the IP_MAC table in real time. If no ARP reply packet is received from the resource device within a certain period of time, the real network address of the resource device in the IP_MAC table is set to 0.0.0.0.
[0136] Step 4: The access gateway client establishes a VPN connection with the access gateway server's VPN connection module through the VPN connection module, and requests a virtual network address from the access gateway server based on the physical address of the resource device. That is, the access gateway client can upload the MAC address of social resources to the access gateway server via the Internet, and the access gateway server can distribute virtual network addresses to the access gateway client via the Internet.
[0137] In addition, the access gateway client can record the obtained virtual network address in the VPNIP_MAC table.
[0138] Step 5: The NAT maintenance module of the access gateway client can read the physical address in the VPNIP_MAC table, query the IP_MAC table for the real network address corresponding to the physical address, and perform NAT mapping between the real network address and the virtual network address in the VPNIP_MAC table through IPtables. At the same time, it generates SNAT and DNAT entries for IPtables rules.
[0139] Therefore, when a message sent by a resource device is forwarded by the access gateway client, the access gateway client replaces the source address of the original message with a virtual network address; when a message that needs to be sent to a resource device is forwarded by the access gateway client, the access gateway client replaces the destination address of the original message with the real network address of the social resource.
[0140] Subsequently, when the actual network address of the resource device changes, the NAT maintenance module of the access gateway client can update the new actual network address of the resource device to the SNAT and DNAT entries in IPtables, ensuring the correctness of the NAT entries.
[0141] Specifically, if the light-managed switch cannot connect to the access gateway client, the access gateway client, after obtaining a virtual network address for the resource device, will not generate a corresponding NAT entry because it cannot obtain the real network address corresponding to the physical address. When the light-managed switch comes online after the access gateway client, if it fails to keep up for three consecutive times, the access gateway client will set the light-managed switch to an offline state. The NAT maintenance module can then delete the NAT mapping relationship of the corresponding resource device based on the physical address bound to the light-managed switch. Subsequently, it will attempt to re-establish a connection with the light-managed switch every minute. After the light-managed switch comes back online, the access gateway client will repeat the above steps to update the NAT mapping relationship.
[0142] The resource access device provided by the present invention is described below. The resource access device described below and the resource access method described above can be referred to in correspondence.
[0143] Figure 4 This is one of the structural schematic diagrams of the resource access device provided by the present invention, such as... Figure 4 As shown, this device can be applied to an access gateway client, and the device includes: The detection unit 410 is used to detect changes in the real network address of the resource device in real time based on the Address Resolution Protocol (ARP) response messages in the broadcast domain where the resource device is located and the physical address of the resource device. The mapping unit 420 is used to update the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address when a change in the real network address of the resource device is detected. Access unit 430 is used to access the resource device based on the updated mapping relationship.
[0144] The apparatus provided in this invention detects changes in the real network address of a resource device in real time based on a unique and fixed physical address. When a change is detected, the mapping relationship between the virtual network address and the real network address of the resource device is updated based on the changed real network address. This allows the mapping relationship to be updated accordingly as the real network address changes. Resource access is then performed on the resource device based on the updated mapping relationship, enabling resource access to support changes in the real network address of the resource device, thereby ensuring the reliability and stability of resource access.
[0145] Furthermore, this device uses the physical address as the basis for detecting changes in the real network address and updating the mapping relationship, which can prevent the resource device from being spoofed through the network address after being replaced.
[0146] Based on any of the above embodiments, the detection unit is specifically used for: When the resource device is in the broadcast domain to which this end belongs, an Address Resolution Protocol (ARP) request message is sent to the devices in the broadcast domain, and an ARP response message is received from the devices. Based on the response message and the physical address of the resource device, monitor the changes in the real network address of the resource device.
[0147] Based on any of the above embodiments, the detection unit is specifically used for: When the resource device is outside the broadcast domain to which it belongs, the physical address of the resource device is sent to the switch in the same broadcast domain as the resource device. The switch then detects the changes in the real network address of the resource device in real time based on the Address Resolution Protocol (ARP) response message in the broadcast domain and the physical address of the resource device. Receive the changed real network address sent by the switch when it detects a change in the real network address of the resource device.
[0148] Based on any of the above embodiments, the detection unit is further configured to: A connection is established with the switch based on the switch's network address and the user information logged in on the switch.
[0149] Based on any of the above embodiments, the detection unit is specifically used for: Establish a mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device, and based on the mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device, send the physical address of the resource device to the switch in the same broadcast domain as the resource device.
[0150] Based on any of the above embodiments, the mapping unit is used for: Based on the mapping relationship between the changed real network address and the physical address of the resource device, and the mapping relationship between the physical address of the resource device and the virtual network address, update the mapping relationship between the virtual network address and the real network address of the resource device.
[0151] Based on any of the above embodiments, the mapping unit is further configured to: Based on the physical address of the resource device, a virtual network address for the resource device is requested from the server to obtain the mapping relationship between the physical address and the virtual network address.
[0152] Based on any of the above embodiments Figure 5 This is a second structural schematic diagram of the resource access device provided by the present invention, as shown below. Figure 5 As shown, the device includes: The receiving unit 510 is used to receive the physical address of the resource device sent by the access gateway client; The detection unit 520 is used to detect changes in the real network address of the resource device in real time based on the physical address of the resource device and the response packets of the Address Resolution Protocol (ARP) in the broadcast domain where the resource device is located. The sending unit 530 is configured to return the changed real network address to the access gateway client when a change in the real network address of the resource device is detected. The changed real network address is used to update the mapping relationship between the virtual network address and the real network address of the resource device, and the mapping relationship is used for the resource access of the resource device.
[0153] The apparatus provided in this invention detects changes in the real network address of a resource device in real time based on a unique and fixed physical address. When a change is detected, the mapping relationship between the virtual network address and the real network address of the resource device is updated based on the changed real network address. This allows the mapping relationship to be updated accordingly as the real network address changes. Resource access is then performed on the resource device based on the updated mapping relationship, enabling resource access to support changes in the real network address of the resource device, thereby ensuring the reliability and stability of resource access.
[0154] Furthermore, this device uses the physical address as the basis for detecting changes in the real network address and updating the mapping relationship, which can prevent the resource device from being spoofed through the network address after being replaced.
[0155] Based on any of the above embodiments, the detection unit is specifically used for: Parse the Address Resolution Protocol (ARP) response message to obtain the mapping relationship between the physical address and the real network address in the response message; Based on the pre-stored mapping relationship between the physical address and the real network address of the resource device, and the mapping relationship between the physical address and the real network address in the response message, changes in the real network address of the resource device are detected in real time. When a change in the real network address of the resource device is detected, the pre-stored mapping relationship between the physical address and the real network address of the resource device is updated based on the mapping relationship between the physical address and the real network address in the response message.
[0156] Based on any of the above embodiments, the detection unit is further configured to: Receive a connection request, which is sent by the access gateway client based on the network address of the switch and the user information logged in on the switch; Based on the connection request, a connection is established with the access network client.
[0157] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a resource access method, which includes: Based on the Address Resolution Protocol (ARP) response messages within the broadcast domain where the resource device is located, and the physical address of the resource device, the changes in the real network address of the resource device are detected in real time. If a change in the real network address of the resource device is detected, the mapping relationship between the virtual network address and the real network address of the resource device is updated based on the changed real network address. Based on the updated mapping relationship, resource access is performed on the resource devices.
[0158] Alternatively, the method includes: Receive the physical address of the resource device sent by the access gateway client; Based on the physical address of the resource device and the ARP response messages in the broadcast domain where the resource device is located, the changes in the real network address of the resource device are detected in real time. If a change in the real network address of the resource device is detected, the changed real network address is returned to the access gateway client. The changed real network address is used to update the mapping relationship between the virtual network address and the real network address of the resource device. The mapping relationship is used for the resource access of the resource device.
[0159] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to related technologies, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0160] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer being able to execute the resource access methods provided by the above methods, the method comprising: Based on the Address Resolution Protocol (ARP) response messages within the broadcast domain where the resource device is located, and the physical address of the resource device, the changes in the real network address of the resource device are detected in real time. If a change in the real network address of the resource device is detected, the mapping relationship between the virtual network address and the real network address of the resource device is updated based on the changed real network address. Based on the updated mapping relationship, resource access is performed on the resource devices.
[0161] Alternatively, the method includes: Receive the physical address of the resource device sent by the access gateway client; Based on the physical address of the resource device and the ARP response messages in the broadcast domain where the resource device is located, the changes in the real network address of the resource device are detected in real time. If a change in the real network address of the resource device is detected, the changed real network address is returned to the access gateway client. The changed real network address is used to update the mapping relationship between the virtual network address and the real network address of the resource device. The mapping relationship is used for the resource access of the resource device.
[0162] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the resource access methods provided by the methods described above, the method comprising: Based on the Address Resolution Protocol (ARP) response messages within the broadcast domain where the resource device is located, and the physical address of the resource device, the changes in the real network address of the resource device are detected in real time. If a change in the real network address of the resource device is detected, the mapping relationship between the virtual network address and the real network address of the resource device is updated based on the changed real network address. Based on the updated mapping relationship, resource access is performed on the resource devices.
[0163] Alternatively, the method includes: Receive the physical address of the resource device sent by the access gateway client; Based on the physical address of the resource device and the ARP response messages in the broadcast domain where the resource device is located, the changes in the real network address of the resource device are detected in real time. If a change in the real network address of the resource device is detected, the changed real network address is returned to the access gateway client. The changed real network address is used to update the mapping relationship between the virtual network address and the real network address of the resource device. The mapping relationship is used for the resource access of the resource device.
[0164] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0165] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A resource access method, characterized in that, The method comprises the following steps: Real-time detection of the change of the real network address of the resource device based on the reply message of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device; Updating the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address in the case of detecting the change of the real network address of the resource device; Resource access to the resource device based on the updated mapping relationship.
2. The method of claim 1, wherein, The real-time detection of the change of the real network address of the resource device based on the reply message of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device comprises the following steps: In the case that the resource device is in the broadcast domain to which the local end belongs, sending an address resolution protocol (ARP) request message to the devices in the broadcast domain and receiving the reply message of the ARP returned by the devices; Monitoring the change of the real network address of the resource device based on the reply message and the physical address of the resource device.
3. The method of claim 1, wherein, The real-time detection of the change of the real network address of the resource device based on the reply message of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device comprises the following steps: In the case that the resource device is in the broadcast domain to which the local end belongs, sending an address resolution protocol (ARP) request message to the devices in the broadcast domain and receiving the reply message of the ARP returned by the devices; Monitoring the change of the real network address of the resource device based on the reply message and the physical address of the resource device.
4. The method of claim 3, wherein, The real-time detection of the change of the real network address of the resource device based on the reply message of the address resolution protocol (ARP) in the broadcast domain where the resource device is located and the physical address of the resource device further comprises the following steps: Establishing a connection with the switch based on the network address of the switch and the user information logged in on the switch.
5. The method of claim 3, wherein, The sending of the physical address of the resource device to the switch in the same broadcast domain as the resource device comprises the following steps: Establishing a mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device, and sending the physical address of the resource device to the switch in the same broadcast domain as the resource device based on the mapping relationship between the physical address of the resource device and the network address of the switch in the same broadcast domain as the resource device.
6. The method of claim 1-5, wherein, The updating of the mapping relationship between the virtual network address and the real network address of the resource device based on the changed real network address comprises the following steps: Updating the mapping relationship between the virtual network address and the real network address of the resource device based on the mapping relationship between the changed real network address and the physical address of the resource device and the mapping relationship between the physical address of the resource device and the virtual network address.
7. The method of claim 6, wherein, The method further comprises the following steps: Applying, based on the physical address of the resource device, a virtual network address of the resource device to a server to obtain a mapping relationship between the physical address and the virtual network address.
8. A method for accessing a resource, the method comprising: Comprising: Receiving a physical address of a resource device sent by an access gateway client; Real-time detecting, based on the physical address of the resource device and a reply message of an address resolution protocol (ARP) within a broadcast domain where the resource device is located, a change of a real network address of the resource device; In a case where the change of the real network address of the resource device is detected, returning the changed real network address to the access gateway client, the changed real network address being used to update a mapping relationship between a virtual network address and the real network address of the resource device, the mapping relationship being used for resource access of the resource device.
9. The method of claim 8, wherein, The real-time detecting, based on the physical address of the resource device and the reply message of the address resolution protocol (ARP) within the broadcast domain where the resource device is located, the change of the real network address of the resource device, comprises: Analyzing the reply message of the address resolution protocol (ARP) to obtain a mapping relationship between a physical address and a real network address in the reply message; Based on a pre-stored mapping relationship between the physical address and the real network address of the resource device and the mapping relationship between the physical address and the real network address in the reply message, real-time detecting the change of the real network address of the resource device, and in a case where the change of the real network address of the resource device is detected, updating, based on the mapping relationship between the physical address and the real network address in the reply message, the pre-stored mapping relationship between the physical address and the real network address of the resource device.
10. The method of claim 8, wherein, The receiving a physical address of a resource device sent by an access gateway client further comprises: Receiving a connection request sent by the access gateway client based on a network address of a switch and user information logged in on the switch; Based on the connection request, establishing a connection with the access network client.
11. A resource access device, comprising: Comprising: A detecting unit configured to real-time detect, based on a reply message of an address resolution protocol (ARP) within a broadcast domain where a resource device is located and a physical address of the resource device, a change of a real network address of the resource device; A mapping unit configured to, in a case where the change of the real network address of the resource device is detected, update, based on the changed real network address, a mapping relationship between a virtual network address and the real network address of the resource device; An accessing unit configured to, based on the updated mapping relationship, perform resource access on the resource device.
12. A resource access device, comprising: Comprising: A receiving unit configured to receive a physical address of a resource device sent by an access gateway client; A detecting unit configured to real-time detect, based on the physical address of the resource device and a reply message of an address resolution protocol (ARP) within a broadcast domain where the resource device is located, a change of a real network address of the resource device; a sending unit, configured to return a changed real network address to the access gateway client in a case where it is detected that the real network address of the resource device is changed, the changed real network address being used to update a mapping relationship between the virtual network address and the real network address of the resource device, the mapping relationship being used for resource access of the resource device.
13. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the resource access method according to any one of claims 1 to 10 when executing the program.
14. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the resource access method according to any one of claims 1 to 10 when executed by the processor.