A network access control list (ACL) allows you to manage network access in a virtual private cloud (VPC). You can create a network ACL in a VPC and add inbound and outbound rules to the network ACL. After you create a network ACL, you can associate it with a vSwitch. This way, you can use the network ACL to control the traffic that flows through the Elastic Compute Service (ECS) instances in the vSwitch.
Operations
Create a network ACL
A VPC is created. For more information, see Create and manage a VPC.
- Log on to the VPC console.
- In the left-side navigation pane, choose .
In the top navigation bar, select the region where you want to create a network ACL.
For more information about the regions that support network ACLs, see Feature release and supported regions.
On the Network ACL page, click Create Network ACL.
In the Create Network ACL dialog box, set the following parameters and click OK.
Parameter
Description
VPC
Select the VPC for which you want to create the network ACL.
NoteThe VPC and network ACL must be deployed in the same region.
If the VPC contains an ECS instance that belongs to one of the following instance families, you cannot create a network ACL for the VPC.
ecs.c1, ecs.c2, ecs.c4, ecs.ce4, ecs.cm4, ecs.d1, ecs.e3, ecs.e4, ecs.ga1, ecs.gn4, ecs.gn5, ecs.i1, ecs.m1, ecs.m2, ecs.mn4, ecs.n1, ecs.n2, ecs.n4, ecs.s1, ecs.s2, ecs.s3, ecs.se1, ecs.sn1, ecs.sn2, ecs.t1, and ecs.xn4.
In this case, you must upgrade or release the ECS instances that do not support advanced VPC features. For more information about advanced VPC features, see Advanced VPC features.
For more information about how to upgrade ECS instances, see Upgrade the instance types of subscription instances or Change the instance type of a pay-as-you-go instance.
For more information about how to release an ECS instance, see Release an instance.
NoteIf the VPC contains one of the specified ECS instance types and the network ACL feature is enabled, you must upgrade or release the ECS instance for the network ACL to work as expected.
Name
Enter a name for the network ACL.
Description
Enter a description for the network ACL.
Add rules to the network ACL
After you create a network ACL, you can add inbound rules to the network ACL. You can use inbound rules to control whether ECS instances in a vSwitch can be accessed over the Internet or private networks. You can also add outbound rules to the network ACL. You can use outbound rules to control whether ECS instances in a vSwitch can access the Internet or private networks.
Network ACLs are stateless. If you configure an inbound rule that allows traffic, you must also configure a corresponding outbound rule. Otherwise, the system may fail to respond to requests.
- Log on to the VPC console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region to which the network ACK that you want to manage belongs.
- On the Network ACL page, find the network ACL that you want to manage and click its ID.
On the Basic Information page, you can create inbound or outbound rules.
Create an inbound rule
Click the Inbound Rule tab, and then click Manage Inbound Rule.
Set the following parameters and click OK.
Parameter
Description
Priority
Specify the priority of the inbound rule.
A smaller value indicates a higher priority. You can create at most 20 rules. For more information, see Rule priorities.
Rule name
Enter a name for the inbound rule.
Action
Select an action for the inbound rule. Valid values:
Accept: accepts network traffic that is destined for the ECS instances connected to the vSwitch.
Drop: drops network traffic that is destined for the ECS instances connected to the vSwitch.
Protocol
Select a protocol. Valid values:
ALL
ICMP
GRE
TCP
UDP
Source IP Addresses
Specify the source CIDR block from which data is transmitted.
Default value: 0.0.0.0/0.
Destination Port Range
Enter the destination port range of the inbound rule.
Valid values: 1 to 65535. Separate the first port and last port with a forward slash (/), for example, 1/200 or 80/80. A value of -1/-1 specifies all ports. Therefore, you cannot set the value only to -1/-1.
If you set Protocol to ALL, ICMP, or GRE, you cannot set the destination port range and -1/-1 is used by default. If you set Protocol to TCP or UDP valid ports are 1 to 65535. Specify the port range in the 1/200 or 80/80 format and you cannot specify -1/-1.
Create an outbound rule
Click the Outbound Rule tab, and then click Manage Outbound Rule.
Set the following parameters and click OK.
Parameter
Description
Priority
Set the priority of the outbound rule.
A smaller value indicates a higher priority. You can create at most 20 rules. For more information, see Rule priorities.
Rule name
Enter a name for the outbound rule.
Action
Select an action for the outbound rule. Valid values:
Accept: allows ECS instances connected to the vSwitch to access the Internet or other private networks.
Drop: forbids ECS instances connected to the vSwitch to access the Internet or other private networks.
Protocol
Select a protocol. Valid values:
ALL
ICMP
GRE
TCP
UDP
Destination IP Address
Specify the destination CIDR block of traffic.
Default value: 0.0.0.0/32.
Destination Port Range
Enter the destination port range of the outbound rule.
Valid values: 1 to 65535. Separate the first port and last port with a forward slash (/), for example, 1/200 or 80/80. A value of -1/-1 specifies all ports. Therefore, you cannot set the value to -1/-1.
Change the priorities of network ACL rules
Network ACL rules take effect in descending order of priority. A smaller value indicates a higher priority. You can prioritize network ACL rules based on your business requirements.
- Log on to the VPC console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region to which the network ACK that you want to manage belongs.
- On the Network ACL page, find the network ACL that you want to manage and click its ID.
On the Basic Information page, you can change the priorities of inbound and outbound rules.
Change the priority of an inbound rule
Click the Inbound Rule tab, and then click Manage Inbound Rule.
Drag and drop an inbound rule upwards or downwards, and then click OK.
Change the priority of an outbound rule
Click the Outbound Rule tab, and then click Manage Outbound Rule.
Drag and drop an inbound rule upwards or downwards, and then click OK.
Associate a network ACL with a vSwitch
Before you associate a network ACL with a vSwitch, make sure that the following requirements are met:
A network ACL is created and network ACL rules are added to it.
A vSwitch is created. The vSwitch and network ACL must belong to the same VPC. For more information, see Create and manage a vSwitch.
- Log on to the VPC console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region to which the network ACK that you want to manage belongs.
- On the Network ACL page, find the network ACL that you want to manage and click Associate vSwitch in the Actions column.
On the Resources tab, click Associate vSwitch.
In the Associate vSwitch dialog box, select the vSwitch that you want to associate and click OK.
The network ACL and vSwitch must belong to the same VPC. A vSwitch can be associated only with one network ACL.
Disassociate a network ACL from a vSwitch
You can disassociate a network ACL from a vSwitch. After the network ACL is disassociated from the vSwitch, the network ACL no longer controls traffic that flows through the ECS instances connected to the vSwitch.
- Log on to the VPC console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region to which the network ACK that you want to manage belongs.
- On the Network ACL page, find the network ACL that you want to manage and click Associate vSwitch in the Actions column.
On the Resources tab, find the vSwitch and click Unbind in the Actions column.
In the Unbind Network ACL message, click OK.
Delete a network ACL
Before you delete a network ACL, you must disassociate the network ACL from the vSwitch.
- Log on to the VPC console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select the region to which the network ACK that you want to manage belongs.
On the Network ACL page, find the network ACL that you want to delete and click Delete in the Actions column.
In the Delete Network ACL message, click OK.
References
CreateNetworkAcl: creates a network ACL.
UpdateNetworkAclEntries: updates network ACL rules.
AssociateNetworkAcl: associates a network ACL with a vSwitch.
UnassociateNetworkAcl: disassociates a network ACL from a vSwitch.
DeleteNetworkAcl: deletes a network ACL.