Firewall Overview

A firewall is an optional layer of security for your subnets. After you associate one or more subnets with a firewall, you can control traffic in and out of the subnets.

For details, see Figure 1.

Figure 1 Security groups and firewalls

Similar to security groups, firewalls control access to subnets and add an additional layer of defense to your subnets. Security groups only have the "allow" rules, but firewalls have both "allow" and "deny" rules. You can use firewalls together with security groups to implement comprehensive and fine-grained access control.

Differences Between Security Groups and Firewalls summarizes the basic differences between security groups and firewalls.

Firewall Basics

After a persistent connection is disconnected, new connections will not be established immediately until the timeout period of connection tracking expires. For example, after an ICMP persistent connection is disconnected, a new connection will be established and a new rule will be applied when the timeout period (30s) expires.

  • The timeout period of connection tracking varies by protocol. The timeout period of a TCP connection in the established state is 600s, and that of an ICMP connection is 30s. For other protocols, if packets are received in both inbound and outbound directions, the connection tracking timeout period is 180s. If packets are received only in one direction, the connection tracking timeout period is 30s.
  • The timeout period of TCP connections varies by connection status. The timeout period of a TCP connection in the established state is 600s, and that of a TCP connection in the FIN-WAIT state is 30s.

Default Firewall Rules

By default, each firewall has preset rules that allow the following packets:

How Traffic Matches Firewall Rules

Application Scenarios

Configuration Procedure

Figure 2 shows the procedure for configuring a firewall.

Figure 2 firewall configuration procedure
  1. Create a firewall by following the steps described in Creating a Firewall.
  2. Add firewall rules by following the steps described in Adding a Firewall Rule.
  3. Associate subnets with the firewall by following the steps described in Associating Subnets with a Firewall. After subnets are associated with the firewall, the subnets will be protected by the configured firewall rules.

Notes and Constraints