Help Center> Huawei Cloud Flexus> User Guide> Security Groups> Configuring Security Group Rules

Configuring Security Group Rules

Scenarios

Similar to a firewall, a security group is a logical group used to control network access. You can define access rules for a security group to protect the HECSs that are added to this security group.

  • Inbound: Inbound rules allow external network data to be sent to the HECSs in the security group.
  • Outbound: Outbound rules allow network traffic from the HECSs in the security group to be sent out of the security group.

For details about the default security group rules, see Default Security Groups and Security Group Rules. For details about configuration examples for security group rules, see Security Group Configuration Examples.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select your region and project.
  3. Under Computing, click Hyper ECS.
  4. On the Hyper Elastic Cloud Server page, click the name of the target HECS.

    The page providing details about the HECS is displayed.

  5. Click the Security Groups tab and then . View security group rules.
  6. Click the security group ID.

    The system automatically switches to the Security Group page.

  7. On the Inbound Rules tab, click Add Rule. In the displayed dialog box, set required parameters.

    You can click + to add more inbound rules.

    Table 1 Inbound rule parameters

    Parameter

    Description

    Example Value

    Protocol & Port

    Specifies the network protocol. Example values are All, TCP, UDP, ICMP, and GRE.

    Custom TCP

    Port: specifies the port or port range over which data can reach your HECS. The value ranges from 1 to 65535. For details about common ports, see Common Ports.

    22 or 22-30

    Source

    Specifies the source of the security group rule. The value can be another security group or a single IP address. For example:

    • xxx.xxx.xxx.xxx/32 (IPv4 address)
    • xxx.xxx.xxx.0/24 (subnet CIDR block)
    • 0.0.0.0/0 (any IP address)

    0.0.0.0/0

    Description

    Provides supplementary information about the security group rule. This parameter is optional.

    The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

    N/A

  8. On the Outbound Rules tab, click Add Rule. In the displayed dialog box, set required parameters.

    You can click + to add more outbound rules.

    Figure 1 Add Outbound Rule
    Table 2 Outbound rule parameters

    Parameter

    Description

    Example Value

    Protocol & Port

    Specifies the network protocol. Example values are All, TCP, UDP, ICMP, and GRE.

    Custom TCP

    Port: specifies the port or port range over which data can leave your HECS. The value ranges from 1 to 65535.

    For details about common ports, see Common Ports.

    22 or 22-30

    Source

    Specifies the source of the security group rule. The value can be another security group or a single IP address. For example:

    • xxx.xxx.xxx.xxx/32 (IPv4 address)
    • xxx.xxx.xxx.0/24 (subnet CIDR block)
    • 0.0.0.0/0 (any IP address)

    0.0.0.0/0

    Description

    Provides supplementary information about the security group rule. This parameter is optional.

    The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

    N/A

  9. Click OK to complete the security rule configuration.

Verifying Configurations

After adding the security group rules, you can check whether the rules have taken effect. For example, you have deployed a website on an HECS. Users need to access your website over HTTP and port 80, and you have added the security group rule shown in Table 3.

Table 3 Security group rule

Direction

Protocol/Application

Port

Source

Inbound

TCP

80

0.0.0.0/0

Linux

To verify the security group rule on a Linux HECS:

  1. Log in to the HECS.
  2. Run the following command to check whether TCP port 80 is listened:

    netstat -an | grep 80

    If command output shown in Figure 2 is displayed, TCP port 80 is listened.

    Figure 2 Command output for the Linux HECS
  3. Enter http://EIP bound to the HECS in the address box of the browser and press Enter.

    If the requested page can be accessed, the security group rule has taken effect.