Manage Security Groups
A security group is a collection of security rules that control ingress and egress traffic for VM NICs. A VM NIC can join multiple security groups, and the security group priority determines the rule matching order.
Rule Types
Security groups use security rules in the group to control traffic to and from NICs. A security group can contain system rules and custom rules.
- System rules: After a security group is created, the system provides the following rules by default:
- Intra-group communication rule: Allows NICs in the same security group to communicate with each other by default. This rule has a higher priority than all custom rules. It cannot be modified or deleted and can only be disabled.
- Intra-/inter-group communication rule: Allows NICs in the security group to access NICs outside the security group by default. NICs outside the security group are not allowed to access NICs inside the security group by default. This rule supports modifying the default intra-group and inter-group access behavior for individual VM NICs.
- Custom rules: Rules that users add to the security group.
Rule Elements
| Element | Description |
|---|---|
| Direction |
|
| Target |
|
| Action |
The following actions can be applied to traffic that matches rule conditions:
By default, if traffic to or from the NIC does not match any custom rule, ingress traffic is denied and egress traffic is allowed. |
| Protocol and Port |
The packet protocol and corresponding port targeted by a rule include the following types:
|
| Priority | The matching order of a security group rule relative to other rules. The supported priority range is 1-100. A larger value indicates a lower priority. |
Create Security Groups and Rules
About this task
Before a virtual machine can use a security group, you need to create the security group, add rules to the security group, and associate the security group with VM NICs.
Procedure
-
Create a security group.
-
Add rules to the security group.
-
Import or export rules in batch as needed.
- To add rules in batch, on the security group details page, click and upload a CSV file. Imported rules do not affect existing rules. Their priorities are placed after existing rules by default, and the rules are disabled by default. After importing the rules, you can manually adjust their priorities and enable them. To ensure system compatibility, import files must be edited by using Microsoft Excel.
- To reuse rules from one security group in another security group, export ingress rules, egress rules, or all rules, and then import them into the target security group.
-
Associate the security group with VM NICs.
- To associate the security group with VM NICs in batch, go to the security group VM NIC tab, select the target NICs in batch, and select the network scope to which the security group applies and the target NICs.
- To associate VM NICs with security groups in batch, go to the target virtual machine Overview tab and use Modify Configuration to associate security groups with VM NICs in batch. The smaller the value corresponding to a security group bound to a virtual machine, the higher the effective priority of the security group.
Note: If the VM NIC IP address is empty on the platform, the default security group rule, namely the intra-group communication rule, does not take effect for the NIC. Configure security groups properly to avoid rule conflicts between security groups.
Operate Security Groups and Rules
About this task
After creating security groups and rules and binding security groups to VM NICs, you can modify security group state, configuration, bindings, and rule priorities as needed.
