Help Center> Virtual Private Cloud> User Guide (Paris Regions) > FAQ> Security> Why Do My Security Group Rules Not Take Effect?
Updated on 2024-03-05 GMT+08:00

Why Do My Security Group Rules Not Take Effect?

Symptom

The security group rules you have configured for an ECS have not taken effect.

Troubleshooting

The issues here are described in order of how likely they are to occur.

Troubleshoot the issue by ruling out the causes described here, one by one.

Figure 1 Troubleshooting
Table 1 Troubleshooting

Possible Cause

Solution

Incorrect Security Group Rule Configurations

See Incorrect Security Group Rule Configuration

Conflicts Between Network ACL Rules and Security Group Rules

See Conflicts Between Network ACL Rules and Security Group Rules

Incorrect Security Group Rule Configuration

If security group rules are incorrectly configured, ECSs cannot be protected. Check the security group rules based on the following causes:

  1. The direction of a rule is incorrect.
  2. The protocol of a rule is incorrect.
  3. The port used in a rule is risky and cannot be accessed.
  4. The port used in a rule is not opened. You can perform the following steps to check whether a port is being listened on the server.

    For example, you have deployed a website on ECSs. Users need to access your website over TCP (port 80), and you have added the security group rule shown in Table 2.

    Table 2 Security group rule

    Direction

    Protocol & Port

    Source

    Inbound

    TCP: 80

    0.0.0.0/0

    Linux ECS

    Check whether the security group rule takes effect on a Linux ECS:

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

      netstat -an | grep 80

      If information similar to Figure 2 is displayed, TCP port 80 is enabled.

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

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

    Windows ECS

    To verify the security group rule on a Windows ECS:

    1. Log in to the ECS.
    2. Choose Start > Run. Type cmd to open the Command Prompt.
    3. Run the following command to check whether TCP port 80 is being listened on:

      netstat -an | findstr 80

      If information similar to Figure 3 is displayed, TCP port 80 is enabled.

      Figure 3 Command output for the Windows ECS
    4. Enter http://ECS EIP in the address box of the browser and press Enter.

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

  5. ECSs belong to different VPCs. If two ECSs are in the same security group but in different VPCs, the ECSs cannot communicate with each other. To enable communications between the ECSs, use a VPC peering connection to connect the two VPCs. For details about VPC connectivity, see .

Conflicts Between Network ACL Rules and Security Group Rules

Security groups operate at the ECS level, whereas network ACLs operate at the subnet level.

For example, if you configure an inbound security group rule to allow access over port 80 and a network ACL rule to deny access over port 80, the security group rule will not take effect.