Updated on 2024-06-27 GMT+08:00

Configuring Multi-VPC Access

VPC provisions an isolated virtual network environment defined and managed by yourself, improving the security of cloud resources and simplifying network deployment. When using SFS to share files, a file system and the cloud servers need to run in the same VPC.

In addition, VPC can use network access control lists (ACLs) for access control. A network ACL is an access control policy system for one or more subnets. Based on inbound and outbound rules, the network ACL determines whether data packets are allowed in or out of any associated subnet. In the VPC list of a file system, each time an authorized address is added and corresponding permissions are set, a network ACL is created.

For more information about VPC, see the Virtual Private Cloud.

Scenarios

Multi-VPC access can be configured for an SFS Capacity-Oriented file system so that cloud servers in different VPCs can share the same file system, as long as the VPCs are added as authorized VPCs or the cloud server IP addresses are added as authorized IP addresses of the VPC.

SFS Turbo can work with VPC Peering to allow cloud servers in two or more VPCs of the same region to share the same file system as if they are in the same VPC. For details about VPC peering connection, see VPC Peering Connection.

This section describes how to configure multi-VPC access for an SFS Capacity-Oriented or a General Purpose file system.

Use Restrictions

  • You can add a maximum of 20 authorized VPCs for a file system and a maximum of 400 ACL rules for each authorized VPC. When you add an authorized VPC, the IP address 0.0.0.0/0 will be added automatically.
  • If a VPC added to a file system has been deleted from the VPC console, the IP addresses or IP address ranges of this VPC can still be seen as activated in the file system's VPC list. But this VPC can no longer be used and you are advised to remove it from the list.
  • Before adding an authorized VPC for a General Purpose File System, you need to create a VPC endpoint to establish communication between the compute resources and the file system.
  • You need to configure a VPC endpoint for each VPC you want to add as an authorized VPC for a General Purpose File System. Or, the file system will fail to be mounted.

Procedure for SFS Capacity-Oriented

  1. Log in to the SFS console.
  2. In the file system list, click the name of the target file system. On the displayed page, locate the Authorizations area.
  3. Click Add Authorized VPC and select a VPC on the displayed dialog box, as shown in Figure 1.. If no VPCs are available, create one and then add. You can add multiple VPCs for a file system.

    You can select multiple VPCs from the drop-down list.

    Figure 1 Adding VPCs

  4. Click OK. A successfully added VPC is displayed in the list. When a VPC is added, the IP address 0.0.0.0/0 is automatically added, with the Read-write read/write permission, no_all_squash user permission, and no_root_squash root permission configured.
  5. View the information about authorized VPCs in the VPC list. Table 1 describes the parameters.

    Table 1 Parameter description

    Parameter

    Description

    Name

    Name of the added VPC, for example, vpc-01

    Authorized Addresses/Segments

    Number of authorized IP addresses or IP address ranges

    Operation

    Includes the Add and Deletion operations. Click Add to add an authorized address, including adding an authorized IP address, read/write permission, user permission, user root permission, and priority. For details, see Table 2. Click Delete to remove this authorized VPC.

  6. Click on the left of the VPC name to view the IP addresses or IP address ranges added to this VPC. You can add, edit, or delete IP addresses or IP address ranges. Click Add in the Operation column of the VPC. The Add Authorized Address/Segment dialog box is displayed, as shown in Figure 2. Table 2 describes the parameters displayed.

    Figure 2 Adding an authorized address or segment
    Table 2 Parameter description

    Parameter

    Description

    Authorized Address/Segment

    • Enter one IPv4 address or range in each line.
    • Enter a valid IPv4 address or range that is not starting with 0 except 0.0.0.0/0. If you add 0.0.0.0/0, any IP address within this VPC will be authorized to access the file system. Do not enter an IP address or IP address range starting with any number ranging from 224 to 255, for example 224.0.0.1 or 255.255.255.255, because class D and class E IP addresses are not supported. IP addresses starting with 127 are also not supported. If you enter an invalid IP address or IP address range, the authorization may fail to be added, or the added authorization does not work.
    • Do not enter multiple IP addresses (separated using commas) in a line. For example, do not enter 10.0.1.32,10.5.5.10.
    • If you enter an IP address range, enter it in the format of IP address/mask. For example, enter 192.168.1.0/24. Do not enter 192.168.1.0-255 or 192.168.1.0-192.168.1.255. The number of bits in a subnet mask must be an integer ranging from 0 to 31, and mask value 0 is valid only in 0.0.0.0/0.

    Read-Write Permission

    You can select Read-write or Read-only. Read-write is preselected.

    User Permission

    Whether to retain the user identifier (UID) and group identifier (GID) of the shared directory. There are two options:

    • all_squash: The UIDs and GIDs of shared files are mapped to user nobody, which is suitable for public directories.
    • no_all_squash (default value): The UIDs and GIDs of shared files are retained.

    You do not need to configure this parameter if you add an authorized address for a CIFS file system.

    User Root Permission

    Whether to allow the client to access as root. There are two options:

    • root_squash: Clients cannot access as root. When a client accesses as root, the user is mapped to user nobody.
    • no_root_squash (default value): Clients are allowed to access as root who has full control and access permissions of the root directories.

    You do not need to configure this parameter if you add an authorized address for a CIFS file system.

    Priority

    The value must be an integer ranging from 0 to 100. 0 has the highest priority, and 100 the lowest. In the same VPC, the permission of the IP address or IP address range with the highest priority is preferentially used. If IP addresses or IP address ranges are of the same priority, the permission of the most recently added or modified one will be used.

    For example, if the client IP address is 10.1.1.32 and both 10.1.1.32 (read/write) with priority 100 and 10.1.1.0/24 (read-only) with priority 50 meet the requirements, the permission of 10.1.1.0/24 (read-only) is used because it has a lower priority. If there is no other priority, all IP addresses in 10.1.1.0/24, including 10.1.1.32, have the read-only permission.

    For an ECS in VPC A, its IP address can be added as an authorized IP address of VPC B, but this ECS cannot mount the file systems in VPC B. The VPC of the ECS and the file system must be the same.

General Purpose File System

  1. Log in to the SFS console.
  2. In the navigation pane on the left, choose General Purpose File System to go to its console.
  3. In the file system list, click the name of the target file system to go to the file system details page.
  4. In the left navigation pane, choose Permissions Management.
  5. Click Add Authorization Rule. A dialog box is displayed, as shown in Figure 3. If no VPCs are available, create one.

    Table 3 describes the parameters displayed.
    Figure 3 Add Authorization
    Table 3 Parameter description

    Parameter

    Description

    VPC

    VPC you want to add, for example, vpc-30e0. If no VPC is available, create one.

    Authorizations

    You can select Read/Write or Read-only. Read/Write is preselected.

  6. Click OK. The added VPC will be displayed in the list.
  7. On the VPC Endpoints page, click Buy VPC Endpoint.

    The Buy VPC Endpoint page is displayed.

    Figure 4 Buy VPC Endpoint

  8. Set the parameters as prompted.

    Table 4 Parameters for purchasing an endpoint

    Parameter

    Description

    Region

    Region where the VPC endpoint is located. Ensure that this region is the same as the one where the planned General Purpose File System resides.

    VPCEP supports General Purpose File System only in the CN North-Beijing4, CN East-Shanghai1, and CN South-Guangzhou regions.

    Billing Mode

    Pay-per-use is preselected by default, but you will not be billed for the endpoint purchased for General Purpose File Systems.

    Service Category

    Select Find a service by name.

    Enter a VPC endpoint service name based on the region selected.

    • If the CN North-Beijing4 region is selected, enter cn-north-4.com.myhuaweicloud.v4.storage.lz13.
    • If the CN South-Guangzhou region (AZ1) is selected, enter cn-south-1.com.myhuaweicloud.v4.obsv2.
    • If the CN South-Guangzhou region (AZ6) is selected, enter cn-south-1.com.myhuaweicloud.v4.obsv2.storage.lz06.
    • If the CN East-Shanghai1 region is selected, enter cn-east-3.com.myhuaweicloud.v4.storage.lz07.

    After entering the service name, click Verify.

    If Service name found is displayed, proceed with subsequent steps.

    If Service name not found is displayed, check whether the entered service name is correct. If the problem persists, submit a service ticket.

    VPC

    Select the VPC you have added as authorized VPC of the General Purpose File System.

    Tag

    Optional

    VPC endpoint tags. Each tag consists of a key and a value. You can add a maximum of 10 tags to one VPC endpoint.

    Tag keys and values must meet the requirements listed in Table 5.

    NOTE:

    If a predefined tag has been created in TMS, you can select the corresponding tag key and value.

    For details about predefined tags, see Predefined Tag Overview.

    Table 5 describes the tag parameters.
    Table 5 Tag parameter description

    Parameter

    Description

    Example Value

    Tag key

    Each tag has a unique key. You can customize the key or select the key of an existing tag created in TMS.

    A tag key:

    • Can contain 1 to 36 Unicode characters.
    • Can contain only letters, digits, hyphens (-), and underscores (_).

    Key_0001

    Tag value

    A tag value can be repetitive or left blank.

    A tag value:

    • Can contain 0 to 43 Unicode characters.
    • Can contain only letters, digits, hyphens (-), and underscores (_).

    Value_0001

  9. Click Next.

    • If you do not need to modify the specifications, click Submit.
    • If you need to modify the specifications, click Previous, modify the configuration as needed, and then click Submit.

  10. Go back to the VPC endpoint list and check whether the status of the VPC endpoint changes to Accepted. If so, the VPC endpoint has been connected to the VPC endpoint service.

Verification

After an authorized VPC is added for the file system, if the file system can be mounted to ECSs in that VPC and the ECSs can access the file system, the configuration is successful.

Example

You create an SFS Capacity-Oriented file system A in VPC-B whose CIDR block is 10.0.0.0/16. You had an ECS D (private IP address 192.168.10.11) in VPC-C whose CIDR block is 192.168.10.0/24. If you want to mount file system A to ECS D and perform reads and writes in the file system from ECS D, you need to add VPC-C as an authorized VPC of file system A, add the private IP address of ECS D as an authorized address of VPC-C, and set Read-Write Permission to Read-write.

You buy a new ECS F (private IP address 192.168.10.22) in the VPC-C whose CIDR block is 192.168.10.0/24. If you want ECS F to have only the read permission for file system A and a lower read priority than ECS D, you need to add the private IP address of ECS F as an authorized address of VPC-C, set Read-Write Permission to Read-only, and set Priority to an integer ranging from 0 and 100 and greater than the priority set for ECS D.