Protect traffic between VPCs with Cloud Firewall
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:
-
In automatic mode, you can create traffic redirection scenarios for your network instances based on your business requirements. The vpc firewall automatically configures routes on the Enterprise Edition transit router and creates an elastic network interface to redirect traffic to the vpc firewall.
-
In manual mode, you must manually create an elastic network interface for the vpc firewall on the Enterprise Edition transit router and configure routes to redirect traffic to the ENI. For detailed instructions, see Protect all traffic between VPCs connected by a CEN transit router (manual traffic redirection), Protect some traffic between VPCs connected by a CEN transit router (manual traffic redirection), and Protect traffic between VPCs across regions in a CEN instance (manual traffic redirection).
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/10CIDR 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
Log on to the CEN console.
On the CEN Instance page, click the ID of the CEN instance that you want to manage.
-
On the tab, find the Transit Router instance in the target region. In the Security Protection column, hover over the security protection icon
. In the tooltip that appears, click Enable Cloud Firewall. -
In the Create VPC Firewall dialog box that appears, select Automatic, and click Check Now.
-
If the check fails, perform the following steps:
-
-
-
If other error messages are returned, handle the errors as prompted.
-
-
If the check passes, click Next to go to the Create Firewall Instance page.
Step 2: Create firewall instance
-
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 Start Creation to start creating the firewall instance. This process takes 10 minutes or more.
NoteIn 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.
-
After the firewall instance is created, click Next to open the traffic redirection configuration page.
Step 3: Enable traffic redirection
-
On the traffic redirection configuration page, configure the following parameters and click OK:
-
Template Name:
Template1 -
Select a scenario: Select Point to point.
-
Select Traffic Redirection Instance:
-
Row 1: For Instance Type, select VPC. For Instance ID, select
VPC1. -
Row 2: For Instance Type, select VPC. For Instance ID, select
VPC2.
-
-
-
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.
-
After you configure the traffic redirection scenario, the system automatically creates the following resources:
-
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.
-
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
WarningDo 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
-
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.
-
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
-
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.
-
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.