Protect traffic between VPCs with Cloud Firewall

Updated at:

Transit Router natively integrates with Cloud Firewall, enabling you to create VPC Firewalls that inspect and filter traffic between VPCs. This topic walks through configuring a VPC Firewall between two VPCs.

Scenario

In this example, two VPCs named VPC1 and VPC2 are created in the China (Hangzhou) region and connected through a Transit Router. To inspect and filter traffic between them, you create a Cloud Firewall on the Transit Router and configure a traffic redirection policy.

When you create a Cloud Firewall, you can select one of the following traffic redirection modes:

The two modes affect your services differently:

  • In automatic traffic redirection mode, enabling or disabling the vpc firewall takes about 5 to 30 minutes, depending on the number of route entries. This does not affect your business.

  • In manual traffic redirection mode, the duration of business impact when you enable or disable the vpc firewall depends on your traffic switching method.

The following procedure uses automatic traffic redirection mode. To use manual mode, see the Cloud Firewall documentation: Procedure.

Limitations

  • When you enable a vpc firewall, Cloud Firewall creates a new VPC instance named Cloud_Firewall_VPC. Ensure that you have a sufficient VPC quota. For more information about VPC quotas, see Limits and quotas.

  • The automatic traffic redirection mode does not support the following scenarios:

    • The route table of the Enterprise Edition transit router contains static routes, excluding static routes to the 100.64.0.0/10 CIDR block and its subnets.

    • Using multiple traffic redirection scenarios for VPC, VBR, and transit router (TR) instances at the same time.

    • Adding a Basic Edition transit router to the traffic redirection mode.

    • The transit router has a route conflict.

    • A VPC uses the prefix list feature.

  • A vpc firewall cannot protect traffic from a VPN gateway (such as an IPsec-VPN or SSL-VPN gateway) that is directly connected to a VPC. However, the vpc firewall can protect traffic from an IPsec-VPN connection that is attached to a transit router. For more information, see IPsec-VPN application scenarios (attached to a transit router).

  • A vpc firewall does not protect IPv6 traffic.

  • Traffic destined for the cloud service CIDR block (100.64.0.0/10) and routes with a 32-bit subnet mask is not redirected to the vpc firewall for protection.

  • You must maintain the following configurations:

    • Routing policies in the CEN-TR route table. For example, you must manually configure and maintain the route priority policy for VBRs in the TR route table of the vpc firewall.

    • Static routes for the cloud service CIDR block (100.64.0.0/10).

    • Route learning in the system route table.

  • Ensure that your network resources are in regions supported by the vpc firewall. Otherwise, you cannot enable the vpc firewall. For more information, see Supported regions for cloud products.

Prerequisites

  • You have created the VPC resources required for this scenario. The following table describes the resource plan.

    Parameter

    VPC1

    VPC2

    Region

    China (Hangzhou)

    China (Hangzhou)

    CIDR block

    10.0.0.0/16

    172.16.0.0/16

    vSwitch 1

    Located in Zone J

    CIDR block: 10.0.0.0/24

    Located in Zone J

    CIDR block: 172.16.0.0/24

    vSwitch 2

    Located in Zone K

    CIDR block: 10.0.1.0/24

    Located in Zone K

    172.16.1.0/24

  • You have connected the two VPCs by following the instructions in Connect VPCs in the same region.

  • You have subscribed to Cloud Firewall and authorized Cloud Firewall to access your cloud resources.

Procedure

Step 1: Run the pre-check

  1. Log on to the CEN console.

  2. On the CEN Instance page, click the ID of the CEN instance that you want to manage.

  3. On the Basic Settings > Transit Router tab, find the Transit Router instance in the target region. In the Security Protection column, hover over the security protection icon image. In the tooltip that appears, click Enable Cloud Firewall.

  4. In the Create VPC Firewall dialog box that appears, select Automatic, and click Check Now.

  5. If the check fails, perform the following steps:

    1. The message "VPC firewall asset synchronization not completed." appears.

      1. Log in to the Cloud Firewall console. In the left-side navigation pane, click Firewall.

      2. On the Firewall page, click VPC Firewall.

      3. On the VPC Firewall tab, click CEN (Enterprise Edition).

      4. If the asset you want to protect is not in the asset list, click Synchronize Assets to sync assets from your Alibaba Cloud account and its member accounts.

        Important

        Asset synchronization takes 5 to 10 minutes to complete.

    2. The message "The route table of the Transit Router contains a prefix list, blackhole route, static route, or route conflict." appears.

      • If a route entry is not required and you have confirmed that deleting the route entry does not affect your services, delete it. For more information, see Delete a custom route entry of an Enterprise Edition Transit Router.

        Warning

        Deleting a route entry may affect your services. Proceed with caution.

      • If the route entry must be retained, use manual mode. For more information, see the Cloud Firewall documentation: Procedure.

    3. If other error messages are returned, handle the errors as prompted.

  6. If the check passes, click Next to go to the Create Firewall Instance page.

Step 2: Create firewall instance

  1. On the Create Firewall Instance page, configure the following parameters:

    • Firewall Name: cfw1

    • VPC CIDR Block of Firewall: 192.168.0.0/27

    • Keep the default values for other parameters.

    Click to view the description of each parameter.

    Parameter

    Description

    Firewall Basic Information

    Firewall Name: Name the VPC firewall. This name identifies the firewall instance. Use a unique name that reflects your business context.

    VPC Configurations of Firewall

    • VPC CIDR Block of Firewall: Assign a VPC CIDR block to Cloud Firewall. To ensure proper operation, assign a CIDR block with a subnet mask of at least /27 that does not conflict with your network plan.

    • Configure Zone:

      Note
      • If both the primary and secondary zones areset to Default (Auto-assigned) the dual-active mode is used, which is suitable for latency-insensitive business scenarios and is easy to configure.

      • If you specify primary and secondary zones the active-standby mode is used, which is suitable for latency-sensitive business scenarios and can reduce traffic latency.

      • You can refer to Best practices for migrating VPC firewall zones for details on dual-active and active-standby modes and migration steps.

      • Primary Zone: Set the primary zone. Cloud Firewall supports default allocation of vSwitch zones.

        Important

        If your services are latency-sensitive, we recommend that you set the Primary Zone to the zone where your services are deployed to reduce latency.

      • Secondary Zone: Set the secondary zone. By default, the vpc firewall forwards traffic through the elastic network interface (ENI) in the primary zone for efficiency. If the primary zone becomes unavailable, the system automatically switches to the ENI in the secondary zone to ensure business continuity.

    IPS

    Select the operating mode and intrusion prevention policy for the Intrusion Prevention System (IPS) module.

    • IPS Mode

      • Monitor Mode: Monitors and generates alerts for malicious traffic.

      • Block Mode: Intercepts malicious traffic to block intrusions.

    • IPS Capabilities

      • Basic Rules: Provides basic protection for your assets, including blocking brute-force attacks, command execution vulnerabilities, and connections to command and control (C&C) servers after an infection.

      • Virtual Patching: Provides real-time protection against popular high-risk application vulnerabilities.

    Note

    This setting applies to all network instances under the same CEN instance.

  2. Click Start Creation to start creating the firewall instance. This process takes 10 minutes or more.

    Note

    In this step, the system automatically creates a firewall VPC and a Cloud Firewall instance in the VPC. This VPC is used only to host Cloud Firewall, is not visible in the VPC console, and cannot be configured or edited.

  3. After the firewall instance is created, click Next to open the traffic redirection configuration page.

Step 3: Enable traffic redirection

  1. On the traffic redirection configuration page, configure the following parameters and click OK:

    1. Template Name: Template1

    2. Select a scenario: Select Point to point.

    3. Select Traffic Redirection Instance:

      1. Row 1: For Instance Type, select VPC. For Instance ID, select VPC1.

      2. Row 2: For Instance Type, select VPC. For Instance ID, select VPC2.

    Click to view the description of each parameter.

    Parameter

    Description

    Basic Information

    Template Name: The name of the traffic redirection template.

    Select a scenario

    Select the type of scenario to be controlled and protected by the vpc firewall.

    • Instance-Instance: Controls traffic between two network instances. Suitable for simple network topologies.

    • Instance to Instances: Controls traffic between one network instance and multiple network instances. Suitable for star network topologies. You can select ALL for sub-redirection instances to redirect all traffic to the primary redirection instance through Cloud Firewall. This is equivalent to the traffic redirection scenario of a vpc firewall for a Basic Edition transit router.

      Important

      The instance-to-multi-instance scenario is not supported if the transit router route table contains a custom deny route policy. Use the multi-instance interconnection scenario instead.

    • Interconnected Instances: Controls traffic among multiple network instances. Suitable for full-mesh network topologies.

    Note

    A network instance is a VPC instance, VBR instance, or TR instance connected through an Enterprise Edition transit router.

    Redirection object

    Configure the Instance Type and Instance ID for traffic redirection.

  2. The traffic redirection process can take up to 30 minutes. When complete, traffic between VPC1 and VPC2 is protected, and a confirmation message appears, displaying basic firewall information such as its name, ID, associated Transit Router, VPC, region, and ENI ID.

  3. After you configure the traffic redirection scenario, the system automatically creates the following resources:

    1. A VPC connection named Cloud_Firewall_Attachment is created in the Transit Router to connect the Transit Router to Cloud Firewall.

      After you enable traffic redirection, you can find the Cloud_Firewall_Attachment connection on the Intra-region Connection tab of the Transit Router instance details page. Its associated route table is Cloud_Firewall_ROUTE_TABLE. The Owner Account is Cloud Service, and the Payer is Cloud Firewall.

    2. Three route tables are created in the Transit Router. The following table describes the route tables.

      Route table name

      Description

      Associated forwarding

      Route learning

      Cloud_Firewall_ROUTE_TABLE

      This route table is queried when traffic from the firewall VPC enters the Transit Router.

      Associated with the firewall VPC connection (Cloud_Firewall_Attachment)

      VPC1 and VPC2

      Please_Do_Not_Edit_Cloud_Firewall_Route_Table

      • This route table is queried when traffic from VPC1 enters the Transit Router.

      • This route table contains eight route entries: four are learned automatically by the Transit Router, and four are static routes added by the system. These static routes have more specific CIDR blocks than the learned routes and are used to redirect traffic from VPC1 to the firewall VPC.

      Associated with the VPC1 connection

      VPC1 and VPC2

      Please_Do_Not_Edit_Cloud_Firewall_Route_Table

      • This route table is queried when traffic from VPC2 enters the Transit Router.

      • This route table contains eight route entries: four are learned automatically by the Transit Router, and four are static routes added by the system. These static routes have more specific CIDR blocks than the learned routes and are used to redirect traffic from VPC2 to the firewall VPC.

      Associated with the VPC2 connection

      VPC1 and VPC2

      Warning

      Do not manually modify the automatically created route tables or route entries in the Transit Router as doing so can interrupt traffic and affect services.

Next steps

  • After you enable the vpc firewall, you can set up access control policies to control access between VPCs. For more information, see Configure an access control policy for a vpc firewall.

  • After you enable the vpc firewall, you can use the VPC Access feature to view traffic between your VPCs. For more information, see VPC Access.

  • After you enable the vpc firewall, you can use the VPC Protection feature to view information about anomalous events between VPCs that were intercepted by Cloud Firewall. For more information, see View VPC traffic blocking events.

FAQ

Modifying the traffic redirection scenario

  1. On the CEN instance details page, find the relevant Transit Router and click the security protection icon to open the Cloud Firewall console. After protection is enabled, a green shield icon appears in the Security Protection column of the Transit Router instance list, indicating that the Transit Router is protected.

  2. Perform the subsequent steps in the Cloud Firewall console. For more information, see Change configurations in automatic traffic redirection mode.

Editing or deleting a VPC Firewall

  1. On the details page of the CEN instance, find the destination Transit Router and click the security protection icon to open the Cloud Firewall console.

  2. Perform the subsequent steps in the Cloud Firewall console. For more information, see Edit or delete a VPC Firewall.

Cloud Firewall billing

Cloud Firewall is a paid service. For more information, see Billing overview.