Access method, configuration method and device of NAS (Network Attached Storage) server and electronic equipment
By configuring virtual network cards and flow table rules in physical machines, network isolation and traffic transfer between users are achieved, which solves the resource occupation and cost problems of NAS file sharing services in cloud computing, and improves transfer efficiency and security.
Patent Information
- Application Number
- CN202410735171.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-07
AI Technical Summary
In a cloud computing environment, while providing users with NAS file sharing services, it is necessary to ensure network isolation between different users. However, existing technology cannot share transit virtual machines, resulting in the need to create a transit virtual machine for each NAS shared disk created. , increasing computing resource usage and cost, and deploying a virtualization layer limits network IO efficiency.
By pre-configuring the virtual network card associated with each user in the physical machine and using flow table rules to forward client requests, network isolation and traffic transfer between different users are achieved, avoiding restrictions on the virtualization layer and improving transfer efficiency.
It achieves network isolation between different users, reduces the computing power and storage costs of NAS file sharing services, improves transfer efficiency, and ensures the security of the NAS file system.
Smart Images

Figure CN118611933A
Abstract
Description
Technical Field
[0001] The present disclosure relates to cloud computing technology, and specifically to an access method, configuration method, device and electronic device of a NAS (Network Attached Storage) server. Background Art
[0002] In a cloud computing environment, while providing NAS file sharing services to users, network isolation between different users must also be ensured. In order to achieve the above functions, a transit virtual machine is generally used to forward data requests. However, a transit virtual machine cannot be shared between different users. Therefore, every time a NAS shared disk is created, a transit virtual machine needs to be created in the cloud environment. The more NAS shared disks a user uses, the more computing resources are occupied, increasing the cost of NAS file sharing services. Therefore, a more efficient resource management design is urgently needed to optimize computing power costs and storage costs. Summary of the invention
[0003] The present invention provides a method, device, electronic device and storage medium for accessing a NAS server.
[0004] According to a first aspect of the present disclosure, a method for accessing a NAS server is provided, which is applied to a first physical machine, wherein a virtual network card associated with each of N users is pre-configured in the first physical machine, wherein different users are associated with different virtual network cards, and N is an integer greater than or equal to 1; the method comprises:
[0005] Receive a first request sent by a client of a first user; wherein the target address in the first request is a first address of a first virtual network card associated with the first user in a first physical machine;
[0006] Determine a second address of a NAS server associated with the first user based on a preconfigured flow table rule associated with the first virtual network card;
[0007] Based on the second address, the first request is forwarded to the NAS server.
[0008] According to a second aspect of the present disclosure, there is provided a configuration method, comprising:
[0009] In response to receiving the NAS shared disk creation command, creating a NAS shared disk associated with the second user in a NAS server in the cloud environment;
[0010] A transfer creation command is sent to the first physical machine; wherein the transfer creation command carries the address information of the NAS server associated with the second user; the transfer creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure a second virtual network card associated with the second user in the network isolation module, and to create a flow table rule in the virtual machine switching component of the first physical machine based on the second virtual network card and the address information of the NAS server.
[0011] According to a third aspect of the present disclosure, there is provided an access device for a NAS server, which is applied to a first physical machine, wherein the first physical machine is pre-configured with a virtual network card associated with each of N users, wherein different users are associated with different virtual network cards, and N is an integer greater than or equal to 1; the device comprises:
[0012] A first receiving module, configured to receive a first request sent by a client of a first user; wherein a target address in the first request is a first address of a first virtual network card associated with the first user in a first physical machine;
[0013] A determination module, configured to determine a second address of a NAS server associated with the first user based on a pre-configured flow table rule associated with the first virtual network card;
[0014] The forwarding module is used to forward the first request to the NAS server based on the second address.
[0015] According to a fourth aspect of the present disclosure, there is provided a configuration device, including:
[0016] a third creation module, configured to create a NAS shared disk associated with the second user in a NAS server in the cloud environment in response to receiving a NAS shared disk creation command;
[0017] The third sending module is used to send a transit creation command to the first physical machine; wherein the transit creation command carries the address information of the NAS server associated with the second user; the transit creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure the second virtual network card associated with the second user in the network isolation module, and to create a flow table rule in the virtual machine switching component of the first physical machine based on the second virtual network card and the address information of the NAS server.
[0018] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:
[0019] at least one processor;
[0020] a memory communicatively coupled to the at least one processor;
[0021] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the NAS server access method provided in the first aspect and / or the configuration method provided in the second aspect.
[0022] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the NAS server access method provided in the first aspect and / or the configuration method provided in the second aspect.
[0023] According to a seventh aspect of the present disclosure, a computer program product is provided, including a computer program stored on a storage medium, and when the computer program is executed by a processor, the computer program implements the NAS server access method provided in the first aspect and / or the configuration method provided in the second aspect.
[0024] The solution disclosed in the present invention uses a physical machine to forward requests from the user's client. The physical machine is configured with virtual network cards associated with different users, so that requests from different users are forwarded through different virtual network cards, which can achieve traffic forwarding for different users on the same physical machine and isolation between different users. On the one hand, the computing and storage resources in the physical machine do not need to be specifically allocated to specific users, but multiple users can share resources while being isolated from each other; and by utilizing the physical machine's own scheduling, it is possible to occupy computing power resources and storage resources only when there is a forwarding business. Therefore, while ensuring the security of the NAS file system, it is possible to reduce the computing power cost and storage cost of the NAS file sharing service. On the other hand, the deployment of a physical machine does not require the configuration of a virtualization layer, and will not be subject to network IO (Input / Output) restrictions similar to virtual machines, which can improve the transfer efficiency and achieve high-speed forwarding.
[0025] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0027] Figure 1 is a flowchart of a method for accessing a NAS server according to an embodiment of the present disclosure;
[0028] Figure 2 is a scenario diagram of a method for accessing a NAS server according to an embodiment of the present disclosure;
[0029] Figure 3 is a flowchart of a configuration method according to an embodiment of the present disclosure;
[0030] Figure 4 is a flow chart of traffic forwarding of NAS according to an embodiment of the present disclosure;
[0031] Figure 5 is a schematic diagram of the structure of an access device of a NAS server according to an embodiment of the present disclosure;
[0032] Figure 6 is a schematic diagram of the structure of a configuration device according to an embodiment of the present disclosure;
[0033] Figure 7 It is a structural diagram of an electronic device used to implement the access method and / or configuration method of the NAS server of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] The present disclosure will be further described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0035] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.
[0036] The term "and / or" herein means that there may be three relationships. For example, A and / or B may mean: A exists alone, A and B exist at the same time, and B exists alone. The term "at least one" herein means any combination of at least two of any one or more of a plurality of. For example, at least one of A, B, and C may mean any one or more elements selected from the set consisting of A, B, and C. The terms "first" and "second" herein refer to and distinguish a plurality of similar technical terms. They do not mean to limit the order or to limit the meaning to only two. For example, the first feature and the second feature refer to two types / two features. The first feature may be one or more, and the second feature may also be one or more.
[0037] In the related art, in a cloud computing environment, while providing NAS file sharing services to users, network isolation between different users must be ensured. In order to achieve the above functions, a transit virtual machine is generally used to forward data requests. Specifically, a transit virtual machine has two network ports, one network port is used to configure the Internet Protocol (IP) address of the customer network, and the other network port is used to configure the IP address of the network where the storage server is located. Through the network address translation (NAT) function of the packet filtering system (iptables), the traffic accessing the IP address in the customer network is forwarded to the network where the NAS storage server is located. Users only need to access the address in their own network to achieve NAS mounting.
[0038] The solution of forwarding data requests by using a transit virtual machine has the following problems:
[0039] 1. Transit virtual machines cannot be shared between different users. Therefore, every time a NAS shared disk is created, a transit virtual machine needs to be created in the cloud environment. The more NAS shared disks a user creates, the more computing resources are occupied, increasing the cost of NAS file sharing services.
[0040] 2. In actual usage scenarios, users do not access NAS shared disks frequently. During most of the day, there is no data traffic on the transfer machine, but it occupies a large amount of computing resources.
[0041] 3. Deploying virtual machines requires implementing network IO (Input / Output) based on the virtualization layer, which will be limited by the virtualization layer and the bandwidth will be relatively small, thus affecting the transfer efficiency.
[0042] In order to at least partially solve one or more of the above problems and other potential problems, the present disclosure proposes a method for accessing a NAS server, which can achieve network isolation between different users by adopting a solution of forwarding data requests by a transit physical machine, thereby helping to improve the security of the NAS file system. At the same time, it reduces the computing power cost and storage cost of the NAS file sharing service.
[0043] An embodiment of the present application provides a method for accessing a NAS server, which can be applied to a first physical machine, wherein the first physical machine is pre-configured with a virtual network card associated with each of N users, wherein different users are associated with different virtual network cards. The first physical machine includes but is not limited to fixed devices and / or mobile devices. For example, fixed devices include but are not limited to servers, desktop computers, etc., and servers can be cloud servers or ordinary servers. For example, mobile devices include but are not limited to mobile phones, tablet computers, etc. Figure 1 As shown, the access method of the NAS server includes:
[0044] S101: Receive a first request sent by a client of a first user; wherein a target address in the first request is a first address of a first virtual network card associated with the first user in a first physical machine;
[0045] S102: Determine a second address of a NAS server associated with the first user based on a pre-configured flow table rule associated with the first virtual network card;
[0046] S103: Forward the first request to the NAS server based on the second address.
[0047] The embodiments of the present application are applied to accessing a NAS server. A NAS server is a dedicated storage server that is connected to a client computer via a network and provides services such as file storage, backup, and sharing. A NAS device is usually composed of storage hardware, an operating system, and a file system, and can be regarded as a streamlined dedicated server specifically used to store and share files. The main functions of a NAS server include file sharing, data backup, data recovery, data encryption, and remote access. Multiple users can access and share folders or files on a NAS server via the network at the same time, thereby improving work efficiency. In addition, a NAS server can also automatically back up user data regularly to prevent data loss, and quickly restore backup data in the event of data loss or damage to ensure business continuity. In actual applications, a NAS shared disk is usually configured for users on a NAS server to provide users with cloud storage services in the form of a NAS shared disk.
[0048] In an embodiment of the present application, a first physical machine is deployed as a transit between the NAS server and the user's client. The first physical machine refers to a physical machine. The first physical machine is used to forward the traffic of the client reading and writing NAS to the NAS storage server to achieve network isolation between different users. The physical machine (Physical Machine) refers to a real computer hardware device with a physical form. Normally, optionally, the physical machine may include: a central processing unit (CPU), a random access memory (RAM), a hard disk, a graphics card, a motherboard, and a power supply. Exemplarily, the first physical machine may be a physical machine using an x86 system. In addition, as an optional method, the first physical machine may be deployed in a cloud environment, for example, in the same cloud environment as the NAS server.
[0049] In an embodiment of the present application, the first physical machine is pre-configured with a virtual network card associated with each of the N users, and the virtual network card refers to a network interface card (NIC) simulated by software on a physical computer. In the first physical machine, different users are associated with different virtual network cards, and N is an integer greater than or equal to 1. In other words, for communications with different users, the first physical machine communicates with the client through different network interfaces. For example, the first physical machine a is pre-configured with virtual network cards (denoted as virtual network card 1, virtual network card 2, and virtual network card 3) associated with three users (denoted as user A, user B, and user C). Among them, user A is associated with virtual network card 1, user B is associated with virtual network card 2, and user C is associated with virtual network card 3.
[0050] Optionally, in some embodiments, the first virtual network card associated with the first user may include two virtual network cards, one of which is configured to communicate with the user network of the first user, and the other is configured to communicate with the network where the NAS server is located (such as the above-mentioned cloud environment). The first virtual network card can be created based on network isolation technology so that requests from other users cannot flow to the first virtual network card associated with the first user. Exemplarily, the method for creating the first virtual network card may include: creating a namespace on the first physical machine; creating two virtual network cards on the Namespace, and configuring the IP addresses of the first user's network and the NAS server network respectively. Here, Namespace is a network isolation technology of the Linus operating system (linux), which is used to achieve network isolation between different Namespaces, and networks within the same Namespace can communicate.
[0051] In the embodiment of the present application, the client of the first user includes but is not limited to a fixed device and / or a mobile device. For example, the fixed device includes but is not limited to a desktop computer, a laptop computer, etc. For example, the mobile device includes but is not limited to a mobile phone, a tablet computer, etc. Optionally, multiple clients may be deployed in the network of the first user, and the multiple clients may respectively initiate a first request to access the NAS server.
[0052] In the embodiment of the present application, the first request may be a request of any business type, including but not limited to a connection creation request, a data read and write request, etc. In some embodiments, the first request may include: an identity identification number (ID) of the first user, and an IP address of a first virtual network card associated with the first user in the first physical machine. The above is only an exemplary description and is not intended to limit all possible contents included in the first request, but it is not exhaustive here.
[0053] According to the above method, the first request initiated by the client of the first user carries a target address, which is the first address of the first virtual network card associated with the first user in the first physical machine, so that the first physical machine receives the first request through the first virtual network card. Afterwards, the first physical machine determines the second address of the NAS server associated with the first user based on the pre-configured flow table rule, and forwards the first request to the NAS server based on the second address.
[0054] In some embodiments, the flow table rule is used to perform NAT on the traffic of the client virtual machine. Exemplarily, the flow table rule may include mapping relationship information between the first address of the first virtual network card and the second address, so that the first physical machine can forward the request whose target address is the first address of the first virtual network card to the NAS server pointed to by the second address according to the mapping relationship information. Optionally, the flow table rule is set on the open source virtual switch component (OpenvSwitch, OVS) in the first physical machine.
[0055] The solution disclosed in the present invention uses a physical machine to forward requests from the user's client. The physical machine is configured with virtual network cards associated with different users, so that requests from different users are forwarded through different virtual network cards, which can achieve traffic forwarding for different users on the same physical machine and isolation between different users. On the one hand, the computing and storage resources in the physical machine do not need to be specifically allocated to specific users, but multiple users can share resources while being isolated from each other; and by utilizing the physical machine's own scheduling, it is possible to occupy computing power resources and storage resources only when there is a forwarding business. Therefore, while ensuring the security of the NAS file system, it is possible to reduce the computing power cost and storage cost of the NAS file sharing service. On the other hand, deploying a physical machine does not require the configuration of a virtualization layer, and will not be subject to network IO restrictions similar to virtual machines, which can improve the transfer efficiency and achieve high-speed forwarding.
[0056] Figure 2 A schematic diagram of a scenario showing a method for accessing a NAS server is shown in FIG. Figure 2 As shown, the access scenarios of the NAS server may include: a client virtual machine, a first physical machine, and a NAS storage server. The client virtual machine is the user of the NAS file storage service, mounts the NAS file system, and reads and writes the system content. The first physical machine (also known as a NAS transit machine) is used to forward the traffic of the client virtual machine reading and writing NAS to the NAS storage service to achieve network isolation between different users. The NAS storage server provides NAS file system services to the client. The first physical machine may include: Openvswitch and Namespace. The OpenvSwitch is an open source virtual machine switch component, and flow table rules are set on the OpenvSwitch to achieve NAT forwarding of the traffic of the client virtual machine. The Namespace is used to achieve that the networks of different Namespaces are not interconnected, and the networks within the same Namespace can communicate.
[0057] Here, the traffic of the NAS generally refers to the traffic connected to the NAS device through the network for data transmission (including the first request mentioned above). These NAS devices are generally designed to store large amounts of data and can be accessed simultaneously by multiple client devices (such as computers, servers, etc.) through a network (such as Ethernet).
[0058] In the above scenario, the NAT capability of Openvswitch is used to forward NAS access traffic. Compared with the forwarding solution using a transit virtual machine, it occupies less computing resources and memory resources. One transit physical machine can support hundreds of NAS shared mount forwarding requests. Openvswitch can also be combined with the Data Plane Development Kit (DPDK) technology to achieve low-latency, high-bandwidth, and low-resource traffic forwarding, greatly reducing the cost of data center construction.
[0059] In some embodiments, forwarding the first request to the NAS server based on the second address includes: sending the first request after converting the source address in the first request to the first address of the first virtual network card and converting the target address in the first request to the second address of the NAS server.
[0060] Exemplarily, in the case where the first virtual network card includes a virtual network card for the user network and a virtual network card for the NAS server network, the address of the first virtual network card includes the address of the virtual network card for the user network and the address of the virtual network card for the NAS server network. The source address in the first request received by the first physical machine is the client address in the user network (i.e., the address of the client of the first user), and the target address is the address of the virtual network card for the user network. The first physical machine can convert the source address in the first request into the address of the virtual network card for the user network, convert the target address in the first request into the address of the NAS server (i.e., the second address), and then send the first request. In this way, the NAS server will receive the first request, and the NAS server can send a response message to the first request to the first virtual network card (the virtual network card for the NAS server network) based on the source address in the received first request.
[0061] In some embodiments, the above steps are implemented based on NAT technology. Specifically, converting the source address in the first request to the first address of the first virtual network card is based on source address translation (Source Network Address Translation, SNAT). Converting the destination address in the first request to the second address of the NAS server is based on destination address translation (Destination Network Address Translation, DNAT). NAT is a technology that rewrites the source IP address and / or port of an IP data packet when it passes through a network device such as a router or firewall. NAT is usually used to solve the problem of IP address shortage, allowing one or more hosts in an internal network to access an external network (such as the Internet) through one or more legal IP addresses. NAT can also provide network security and isolation functions because it hides the real IP address of the internal network.
[0062] The technical solution of the embodiment of the present disclosure converts the source address in the first request into the first address of the first virtual network card, and converts the target address in the first request into the second address of the NAS server, and then sends the first request. In this way, by converting the source address into the first address of the virtual network card, the real IP address of the internal network or the client can be hidden, thereby enhancing security.
[0063] In some embodiments, the access method of the NAS server also includes: receiving a first response message for the first request from the NAS server; wherein the target address of the first response message is the first address of the first virtual network card; and sending the first response message to the client based on the address of the client of the first user.
[0064] In the above embodiment, the first response information is sent by the NAS server, and the first response information is sent to the client via the first physical machine. The first response information may include: the processing result of the first request, the data or content of the response. Exemplarily, the data or content of the response may include: a connection confirmation message, data read and write information, etc. Among them, the data read and write information includes but is not limited to various types of data such as HyperText Markup Language (HTML) documents, JavaScript Object Notation (JSON) data, pictures, videos, etc.
[0065] Exemplarily, the first physical machine sends a first response message to the client based on the address of the first user's client, which may include: the first physical machine converts the source address in the first response message to the first address of the first virtual network card, and converts the target address in the first response message to the address of the first user's client, and then sends the first response message. The specific implementation process can refer to the corresponding implementation of the address conversion of the first request in the aforementioned embodiment, which is not repeated here.
[0066] The technical solution of the embodiment of the present disclosure receives a first response message from a NAS server for a first request; wherein the target address of the first response message is the first address of a first virtual network card; and based on the address of a client of the first user, the first response message is sent to the client. In this way, by using a virtual network card as an intermediate address, the real address of the NAS server can be protected from being directly exposed to the client to a certain extent. This helps to reduce direct attacks and detections against the NAS server and improve the security of the system.
[0067] In some embodiments, the first request is a Transmission Control Protocol (TCP) request; before receiving the first request sent by the client of the first user, the access method of the NAS server also includes: receiving an Address Resolution Protocol (ARP) request in the network; wherein the target IP address in the ARP request matches the first virtual network card; based on the first virtual network card, sending a second response message for the ARP request; wherein the second response message carries a Media Access Control (MAC) address corresponding to the target IP address; and the MAC address is used by the client to send a TCP request to the first physical machine.
[0068] The above TCP request is used to establish a connection based on TCP in network communication. TCP is a connection-oriented, reliable, byte stream-based transmission protocol and an important component of the Internet communication protocol TCP / IP. In practical applications, before establishing a connection based on a TCP request, addressing is required. In the above embodiment, addressing is performed by sending an ARP request.
[0069] Specifically, in the above embodiment, the client of the first user knows the IP address of the first virtual network card in advance, and uses it as the target IP address, and first sends an ARP request containing the target IP address, such as broadcasting the ARP request; because the target IP address is the IP address of the first virtual network card, the first virtual network card will respond to the ARP request, and use the MAC address of the first virtual network card as the MAC address corresponding to the target IP address, and feedback the MAC address through a second response message, so that the client can obtain the MAC address of the first virtual network card, and send the first request based on the MAC address and IP address of the first virtual network card.
[0070] Optionally, the first request (i.e., TCP request) can be used in the connection establishment process. The client, the first physical machine, and the NAS server can repeat the transmission process of the first request and the first response message to complete the connection establishment process. After the connection establishment process, the client can read and write the shared disk created on the NAS server through the first physical machine.
[0071] The above embodiment provides a NAS server access process based on the TCP protocol. Based on the above embodiment, the TCP protocol can be used to implement low-latency, high-bandwidth, and low-resource-occupancy traffic forwarding.
[0072] In some embodiments, the address conversion in the above method can be implemented using a virtual machine switch component. Specifically, based on a pre-configured flow table rule associated with the first virtual network card, determining the second address of the NAS server associated with the first user includes: the virtual machine switch component in the first physical machine determines the second address of the NAS server associated with the first user based on the pre-configured flow table rule associated with the first virtual network card.
[0073] Exemplarily, the virtual machine switch component may include OVS.
[0074] In some embodiments, the above method may also include a configuration process of a virtual switch component and a virtual network card. Specifically, before receiving the first request sent by the client of the first user, the access method of the NAS server also includes: in response to receiving a forwarding creation command, based on the address information of the NAS server associated with the first user carried in the forwarding creation command, creating a network isolation module associated with the first user; configuring the first virtual network card associated with the first user in the network isolation module, and creating a flow table rule in the virtual machine switch component based on the first address of the first virtual network card and the address information of the NAS server.
[0075] The above-mentioned embodiment can be implemented by a control device of a cloud environment. The control device can connect each NAS server to the first physical machine. The control device can respond to a NAS shared disk creation command initiated by a user to deploy a NAS shared disk and a corresponding transfer mechanism for the user. Specifically, the control device sends a transfer creation command to the first physical machine, and the transfer creation command includes the address information of the NAS server associated with the user. Based on this, the first physical machine can create a network isolation module associated with the first user according to the address information of the NAS server, and create a flow table rule in the virtual machine switch component.
[0076] In some implementations, the network isolation module may be a Namespace, which is used to create a first virtual network card associated with the first user, for example, a virtual network card for a user network and a virtual network card for a NAS server network, respectively.
[0077] Optionally, the transfer creation command may also include an access address configured by the control device for the first user, the access address configured for the first user may be used as the address of the first virtual network card, and the first physical machine may create the first virtual network card and the flow table rule according to the access address configured by the control device for the first user and the address of the associated NAS server. In addition, the control device also synchronizes the access address to the first user, so that the first user can initiate a first request according to the access address.
[0078] The technical solution of the disclosed embodiment is to create a network isolation module associated with the first user based on the address information of the NAS server associated with the first user carried in the forwarding creation command in response to receiving the forwarding creation command; configure the first virtual network card associated with the first user in the network isolation module, and create a flow table rule in the virtual machine switch component based on the first address of the first virtual network card and the address information of the NAS server. In this way, by creating a dedicated network isolation module for the first user, it can be ensured that the data transmission and storage operations of the user are logically isolated, reducing the risk of data leakage or unauthorized access with other users or system components.
[0079] Accordingly, the present disclosure provides a configuration method. Figure 3 : is a flowchart of a configuration method according to an embodiment of the present disclosure. The configuration method can be applied to electronic devices, including but not limited to fixed devices and / or mobile devices. For example, fixed devices include but are not limited to servers, and servers can be cloud servers or ordinary servers. For example, mobile devices include but are not limited to: mobile phones, tablet computers, scanning devices. In some possible implementations, the configuration method can also be implemented by a processor calling computer-readable instructions stored in a memory. Optionally, the electronic device can be a control device for a cloud environment. Figure 3 As shown, the configuration method includes:
[0080] S301: In response to receiving a NAS shared disk creation command, creating a NAS shared disk associated with a second user in a NAS server in a cloud environment;
[0081] S302: Send a transit creation command to the first physical machine; wherein the transit creation command carries the address information of the NAS server associated with the second user; the transit creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure a second virtual network card associated with the second user in the network isolation module, and to create a flow table rule in the virtual machine switching component of the first physical machine based on the second virtual network card and the address information of the NAS server.
[0082] Optionally, the NAS shared disk creation command can be sent by the client of the second user. That is, the second user initiates the NAS shared disk creation command, and the control device of the cloud environment deploys the NAS shared disk and the corresponding transfer mechanism for the second user. Specifically, after the control device creates the NAS shared disk associated with the second user in the NAS server, it sends a transfer creation command to the first physical machine, so that the first physical machine creates a corresponding virtual network card and flow table rules for the second user.
[0083] It can be understood that the configuration method for the NAS shared disk creation command initiated by the second user can also be applied to the processing of NAS shared disk creation commands initiated by other users, such as the processing of NAS shared disk creation commands initiated by the first user. Therefore, the technical details in the above configuration method can be implemented by referring to the processing method of the first physical machine for the transfer creation command in the above embodiment, and will not be repeated here.
[0084] For example, after the control device deploys the system, the user can call the interface to initiate a command to create a NAS shared disk. The control device calls the interface to create a Namespace, a virtual network card, and a flow table rule on the first physical machine (transfer machine) to implement traffic forwarding. The user's client (virtual machine) accesses the IP address on the Namespace in this network segment to access the shared disk on the NAS server.
[0085] In order to facilitate understanding of the above technical solution. Figure 4 The flow chart of NAS traffic forwarding is shown as follows: Figure 4 As shown, the process may include:
[0086] S401: Start;
[0087] S402: Calling an interface to create a NAS shared disk on the NAS server;
[0088] S403: Creating a network isolation module on the first physical machine;
[0089] S404: Create two virtual network cards on the network isolation module, configure IP addresses of the user network and the NAS server network respectively, and connect to OVS;
[0090] S405: Create NAT flow table rules on OVS to implement NAS traffic forwarding;
[0091] S406: End.
[0092] Accordingly, the access method of the NAS server may include:
[0093] 1. The client virtual machine initiates an ARP request to access the mount point address. The virtual network card in the network isolation module responds to the ARP request;
[0094] 2. The client virtual machine initiates a TCP connection request to access the mount point address. OVS performs SNAT and DNAT conversion on the request and forwards the connection to the NAS server;
[0095] 3. The NAS server responds to the client's TCP request and establishes a connection with the first physical machine;
[0096] 4. The first physical machine performs NAT translation on the server response and forwards it to the client virtual machine;
[0097] 5. The client virtual machine receives a response from the first physical machine and performs subsequent connection establishment steps;
[0098] 6. The first physical machine repeats the above SNAT and DNAT conversions to finally complete the connection establishment process. The client can read and write data to the NAS shared disk created on the NAS server through the first physical machine.
[0099] The technical solution of the disclosed embodiment is, in response to receiving a NAS shared disk creation command, to create a NAS shared disk associated with the second user in the NAS server in the cloud environment; to send a transfer creation command to the first physical machine; the transfer creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure the second virtual network card associated with the second user and the flow table rules in the network isolation module. In this way, creating an independent NAS shared disk and network isolation module for each user can effectively isolate data between different users and reduce the risk of data leakage and illegal access. By configuring the virtual network card and flow table rules, the user's access rights to the NAS shared disk can be further controlled to ensure the security of the data.
[0100] It should be understood that the schematic diagrams shown in the above figures are merely exemplary and not restrictive, and they are scalable, and those skilled in the art can Figure 1-4 Various obvious changes and / or substitutions can be made to the examples, and the resulting technical solutions still fall within the scope of the disclosure of the embodiments of the present disclosure.
[0101] The embodiment of the present disclosure provides an access device for a NAS server, which is applied to a first physical machine, wherein the first physical machine is pre-configured with a virtual network card associated with each of N users, wherein different users are associated with different virtual network cards, and N is an integer greater than or equal to 1, such as Figure 5 As shown, the access device of the NAS server includes: a first receiving module 501, used to receive a first request sent by a client of a first user; wherein the target address in the first request is a first address of a first virtual network card associated with the first user in a first physical machine; a determining module 502, used to determine a second address of the NAS server associated with the first user based on a pre-configured flow table rule associated with the first virtual network card; and a forwarding module 503, used to forward the first request to the NAS server based on the second address.
[0102] In some embodiments, the forwarding module 503 includes: a conversion submodule, configured to send the first request after converting the source address in the first request into the first address of the first virtual network card and converting the target address in the first request into the second address of the NAS server.
[0103] In some embodiments, the access device of the NAS server further includes: a second receiving module ( Figure 5 ), for receiving a first response message from the NAS server for the first request; wherein the target address of the first response message is the first address of the first virtual network card; the first sending module ( Figure 5 ), and is used to send a first response message to the client based on the address of the client of the first user.
[0104] In some embodiments, the first request is a transmission control protocol TCP request; before receiving the first request sent by the client of the first user, the access device of the NAS server further includes: a third receiving module ( Figure 5 ), for receiving an address resolution protocol ARP request in the network; wherein the target Internet protocol IP address in the ARP request matches the first virtual network card; a second sending module ( Figure 5 (not shown) is used to send a second response message for the ARP request based on the first virtual network card; wherein the second response message carries a MAC address corresponding to the target IP address; the MAC address is used to send a TCP request to the first physical machine.
[0105] In some embodiments, the determination module 502 includes: a determination submodule, which is used for the virtual machine switch component in the first physical machine to determine the second address of the NAS server associated with the first user based on the pre-configured flow table rule associated with the first virtual network card; wherein, before receiving the first request sent by the client of the first user, the access device of the NAS server also includes: a first creation module ( Figure 5 ), for creating a network isolation module associated with the first user based on the address information of the NAS server associated with the first user carried in the transit creation command in response to receiving the transit creation command; a second creation module ( Figure 5 ), which is used to configure a first virtual network card associated with the first user in the network isolation module, and create a flow table rule in the virtual machine switch component based on the first address of the first virtual network card and the address information of the NAS server.
[0106] Those skilled in the art should understand that the functions of the various processing modules in the access device of the NAS server in the embodiment of the present disclosure can be understood with reference to the relevant description of the access method of the NAS server mentioned above. The various processing modules in the access device of the NAS server in the embodiment of the present disclosure can be implemented by a generation circuit that implements the functions of the embodiment of the present disclosure, or can be implemented by running software that executes the functions of the embodiment of the present disclosure on an electronic device.
[0107] The access device of the NAS server of the embodiment of the present disclosure can achieve network isolation between different users by adopting the solution of forwarding data requests by a transit physical machine, which helps to improve the security of the NAS file system and reduce the computing power cost and storage cost of the NAS file sharing service.
[0108] The present disclosure provides a configuration device, such as Figure 6 As shown, the configuration device includes: a third creation module 601, used to create a NAS shared disk associated with the second user in the NAS server in the cloud environment in response to receiving a NAS shared disk creation command; a third sending module 602, used to send a transit creation command to the first physical machine; wherein the transit creation command carries the address information of the NAS server associated with the second user; the transit creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure the second virtual network card associated with the second user in the network isolation module and create a flow table rule in the virtual machine switching component of the first physical machine based on the second virtual network card and the address information of the NAS server.
[0109] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0110] Figure 7 FIG. 1 is a structural block diagram of an electronic device according to an embodiment of the present disclosure. Figure 7 As shown, the electronic device includes: a memory 710 and a processor 720, and the memory 710 stores a computer program that can be run on the processor 720. The number of the memory 710 and the processor 720 can be one or more. The memory 710 can store one or more computer programs. When the one or more computer programs are executed by the electronic device, the electronic device executes the method provided by the above method embodiment. The electronic device may also include: a communication interface 730, which is used to communicate with external devices and perform data exchange transmission.
[0111] If the memory 710, the processor 720 and the communication interface 730 are implemented independently, the memory 710, the processor 720 and the communication interface 730 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0112] Optionally, in a specific implementation, if the memory 710, the processor 720 and the communication interface 730 are integrated on a chip, the memory 710, the processor 720 and the communication interface 730 can communicate with each other through an internal interface.
[0113] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0114] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0115] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on the computer, the process or function according to the embodiment of the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (for example: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (for example: infrared, Bluetooth, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that can be accessed by the computer, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc. It is worth noting that the computer-readable storage medium mentioned in the present disclosure may be a non-volatile storage medium, in other words, a non-transient storage medium.
[0116] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0117] In the description of the embodiments of the present disclosure, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0118] In the description of the embodiments of the present disclosure, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in this article is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0119] In the description of the embodiments of the present disclosure, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.
[0120] The above are merely exemplary embodiments of the present disclosure and are not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for accessing a network attached storage NAS server, applied to a first physical machine, wherein: The first physical machine is pre-configured with a virtual network card associated with each of N users, wherein different users are associated with different virtual network cards, and N is an integer greater than or equal to 1; the method comprises: Receive a first request sent by a client of a first user; wherein a target address in the first request is a first address of a first virtual network card associated with the first user in the first physical machine; Determine a second address of a NAS server associated with the first user based on a preconfigured flow table rule associated with the first virtual network card; Based on the second address, forward the first request to the NAS server.
2. The method according to claim 1, wherein: The forwarding the first request to the NAS server based on the second address includes: After converting the source address in the first request into the first address of the first virtual network card and converting the target address in the first request into the second address of the NAS server, the first request is sent.
3. The method according to claim 1 or 2, wherein: The method further comprises: Receiving a first response message from the NAS server for the first request; wherein the target address of the first response message is the first address of the first virtual network card; Based on the address of the client of the first user, the first response message is sent to the client.
4. The method according to claim 1 or 2, wherein: The first request is a Transmission Control Protocol TCP request; Before receiving the first request sent by the client of the first user, the method further includes: Receiving an Address Resolution Protocol (ARP) request in a network; wherein a target Internet Protocol (IP) address in the ARP request matches the first virtual network card; Based on the first virtual network card, a second response message is sent for the ARP request; wherein the second response message carries a MAC address corresponding to the target IP address; and the MAC address is used by the client to send the TCP request to the first physical machine.
5. The method according to claim 1 or 2, wherein: The determining, based on a preconfigured flow table rule associated with the first virtual network card, a second address of the NAS server associated with the first user includes: The virtual machine switch component in the first physical machine determines a second address of the NAS server associated with the first user based on a preconfigured flow table rule associated with the first virtual network card; Before receiving the first request sent by the client of the first user, the method further includes: In response to receiving the transfer creation command, based on the address information of the NAS server associated with the first user carried in the transfer creation command, create a network isolation module associated with the first user; A first virtual network card associated with the first user is configured in the network isolation module, and the flow table rule is created in the virtual machine switch component based on the first address of the first virtual network card and the address information of the NAS server.
6. A configuration method, comprising: In response to receiving the NAS shared disk creation command, creating a NAS shared disk associated with the second user in a NAS server in the cloud environment; A transit creation command is sent to the first physical machine; wherein the transit creation command carries the address information of the NAS server associated with the second user; the transit creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure the second virtual network card associated with the second user in the network isolation module, and to create a flow table rule in the virtual machine switching component of the first physical machine based on the second virtual network card and the address information of the NAS server.
7. A NAS server access device, applied to a first physical machine, wherein: The first physical machine is pre-configured with a virtual network card associated with each of N users, wherein different users are associated with different virtual network cards, and N is an integer greater than or equal to 1; the device comprises: A first receiving module, configured to receive a first request sent by a client of a first user; wherein a target address in the first request is a first address of a first virtual network card associated with the first user in the first physical machine; A determination module, configured to determine a second address of a NAS server associated with the first user based on a pre-configured flow table rule associated with the first virtual network card; A forwarding module is used to forward the first request to the NAS server based on the second address.
8. The device according to claim 7, wherein: The forwarding module comprises: The conversion submodule is used to send the first request after converting the source address in the first request into the first address of the first virtual network card and converting the target address in the first request into the second address of the NAS server.
9. The device according to claim 7 or 8, wherein: The device also includes: A second receiving module is used to receive a first response message from the NAS server for the first request; wherein the target address of the first response message is the first address of the first virtual network card; The first sending module is used to send the first response message to the client based on the address of the client of the first user.
10. The device according to claim 7 or 8, wherein: The first request is a Transmission Control Protocol TCP request; Before receiving the first request sent by the client of the first user, the device further includes: A third receiving module is used to receive an address resolution protocol ARP request in the network; wherein the target Internet protocol IP address in the ARP request matches the first virtual network card; The second sending module is used to send a second response message for the ARP request based on the first virtual network card; wherein the second response message carries a MAC address corresponding to the target IP address; and the MAC address is used by the client to send the TCP request to the first physical machine.
11. The device according to claim 7 or 8, wherein: The determining module comprises: A determination submodule, configured for a virtual machine switch component in the first physical machine to determine a second address of a NAS server associated with the first user based on a preconfigured flow table rule associated with the first virtual network card; Before receiving the first request sent by the client of the first user, the device further includes: A first creation module, configured to, in response to receiving a transfer creation command, create a network isolation module associated with the first user based on address information of the NAS server associated with the first user carried in the transfer creation command; The second creation module is used to configure the first virtual network card associated with the first user in the network isolation module, and create the flow table rule in the virtual machine switch component based on the first address of the first virtual network card and the address information of the NAS server.
12. A configuration device, comprising: a third creation module, configured to create a NAS shared disk associated with the second user in a NAS server in the cloud environment in response to receiving a NAS shared disk creation command; The third sending module is used to send a transit creation command to the first physical machine; wherein the transit creation command carries the address information of the NAS server associated with the second user; the transit creation command is used to instruct the first physical machine to create a network isolation module associated with the second user, so as to configure the second virtual network card associated with the second user in the network isolation module, and to create a flow table rule in the virtual machine switching component of the first physical machine based on the second virtual network card and the address information of the NAS server.
13. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to at least one processor; wherein, The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are for causing a computer to execute a method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Remote storage method, remote storage system and client
CN101986651A
Distributed network attached storage method and system
CN106878457A
Public service virtual machine access method and device based on private cloud
CN108259642A
Message processing method and device
CN112929277A
Data acquisition method and network configuration method suitable for n target devices with same IP address, electronic device and data acquisition system
CN116827777A
