Updated on 2024-07-02 GMT+08:00

Fast-Adding Security Group Rules

Scenarios

The fast-adding rule function of security groups allows you to quickly add rules with common ports and protocols for remote login, ping tests, common web services, and database services.

Foe details about common ports used by cloud servers, see Common Ports Used by ECSs.

Procedure

  1. Log in to the management console.
  1. Click in the upper left corner and select the desired region and project.
  2. Click in the upper left corner and choose Networking > Virtual Private Cloud.

    The Virtual Private Cloud page is displayed.

  3. In the navigation pane on the left, choose Access Control > Security Groups.

    The security group list is displayed.

  4. Locate the row that contains the target security group and click Manage Rule in the Operation column.

    The page for configuring security group rules is displayed.

  5. On the Inbound Rules tab, click Fast-Add Rule.

    The Fast-Add Inbound Rule dialog box is displayed.

  6. Configure required parameters.
    Figure 1 Fast-Add Inbound Rule
    Table 1 Inbound rule parameter description

    Parameter

    Description

    Example Value

    Protocols and Ports

    Common protocols and ports are provided for:

    • Remote login and ping
    • Web services
    • Databases

    SSH (22)

    Type

    Source IP address version. You can select:
    • IPv4
    • IPv6

    IPv4

    Source

    Used to match the IP address or address range of an external request. The source can be:
    • IP address: If you select IP address for Source, you can enter multiple IP addresses in the same IP address box. Each IP address represents a different security group rule.
      • Single IP address: IP address/mask

        Example IPv4 address: 192.168.10.10/32

        Example IPv6 address: 2002:50::44/128

      • IP address range in CIDR notation: IP address/mask

        Example IPv4 address range: 192.168.52.0/24

        Example IPv6 address range: 2407:c080:802:469::/64

      • All IP addresses

        0.0.0.0/0 represents all IPv4 addresses.

        ::/0 represents all IPv6 addresses.

    • Security group: The source is from another security group. You can select a security group in the same region from the drop-down list. If there is instance A in security group A and instance B in security group B, and the inbound rule of security group A allows traffic from security group B, traffic is allowed from instance B to instance A.
    • IP address group: An IP address group is a collection of one or more IP addresses. You can select an available IP address group from the drop-down list. An IP address group can help you manage IP address ranges and IP addresses with same security requirements in a more simple way.

    Security group

    Action

    Allow or Deny
    • If the Action is set to Allow, access from the source is allowed to ECSs in the security group over specified ports.
    • If the Action is set to Deny, access from the source is denied to ECSs in the security group over specified ports.

    Security group rules are matched by priority and then by action. Deny rules take precedence over allow rules. For more information, see How Traffic Matches Security Group Rules.

    Allow

    Priority

    Security group rule priority.

    The priority value is from 1 to 100. The default value is 1 and has the highest priority. The security group rule with a smaller value has a higher priority.

    1

    Description

    (Optional) Supplementary information about the security group rule.

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

    -

  7. Click OK.

    The inbound rule list is displayed and you can view your added rule.

  8. On the Outbound Rules tab, click Fast-Add Rule.

    The Fast-Add Outbound Rule dialog box is displayed.

  9. Configure required parameters.
    Figure 2 Fast-Add Outbound Rule
    Table 2 Outbound rule parameter description

    Parameter

    Description

    Example Value

    Protocols and Ports

    Common protocols and ports are provided for:

    • Remote login and ping
    • Web services
    • Databases

    SSH (22)

    Type

    Source IP address version. You can select:
    • IPv4
    • IPv6

    IPv4

    Destination

    Used to match the destination address of an internal request. The destination can be:
    • IP address: If you select IP address for Destination, you can enter multiple IP addresses in the same IP address box. Each IP address represents a different security group rule.
      • Single IP address: IP address/mask

        Example IPv4 address: 192.168.10.10/32

        Example IPv6 address: 2002:50::44/128

      • IP address range in CIDR notation: IP address/mask

        Example IPv4 address range: 192.168.52.0/24

        Example IPv6 address range: 2407:c080:802:469::/64

      • All IP addresses

        0.0.0.0/0 represents all IPv4 addresses.

        ::/0 represents all IPv6 addresses.

    • Security group: The destination is from another security group. You can select a security group in the same region under the current account from the drop-down list. If there is instance A in security group A and instance B in security group B, and the outbound rule of security group A allows traffic to security group B, traffic is allowed from instance A to instance B.
    • IP address group: An IP address group is a collection of one or more IP addresses. You can select an available IP address group from the drop-down list. An IP address group can help you manage IP address ranges and IP addresses with same security requirements in a more simple way.

    Security group

    Priority

    Security group rule priority.

    The priority value is from 1 to 100. The default value is 1 and has the highest priority. The security group rule with a smaller value has a higher priority.

    1

    Action

    Allow or Deny
    • If the Action is set to Allow, access from ECSs in the security group is allowed to the destination over specified ports.
    • If the Action is set to Deny, access from ECSs in the security group is denied to the destination over specified ports.

    Security group rules are matched by priority and then by action. Deny rules take precedence over allow rules. For more information, see How Traffic Matches Security Group Rules.

    Allow

    Description

    (Optional) Supplementary information about the security group rule.

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

    -

  10. Click OK.

    The outbound rule list is displayed and you can view your added rule.