If you use a Cloud Enterprise Network (CEN) transit router, you must manually configure routing between the transit router and a virtual private cloud (VPC) firewall before you can use the VPC firewall to protect traffic between VPCs and virtual border routers (VBRs) that are connected by using the transit router. This topic describes how to configure routing between a CEN transit router and a VPC firewall.

Prerequisites

  1. A CEN instance is created in the CEN console. Three VPCs are created. In this topic, VPC1, VPC2, and DMZ VPC are used. Two VBRs are created. In this topic, IDC-1 and IDC-2 are used. For more information, see Create a CEN instance.
  2. A VPC is created in the VPC console. In the following procedure, you must create a VPC firewall for the VPC. In this topic, FW VPC is used. In addition, three vSwitches are created for FW VPC. In this topic, TR-Vswitch-01, TR-VSwitch-02, and Cfw-Vswitch are used. TR-Vswitch-01 and TR-VSwitch-02 are used by a transit router to connect a network instance. The zone of one vSwitch is the same as the primary zone that you select when you connect the network instance to the transit router. The zone of the other vSwitch is the same as the secondary zone that you select when you connect the network instance to the transit router. Cfw-Vswitch is used when you create a VPC firewall.
  3. A custom route table is created for FW VPC in the VPC console. In this topic, VPC-CFW-RouteTable is used.

In this topic, the traffic between other VPCs and each of the following network instances is protected by Cloud Firewall: VPC1, IDC-1, and IDC-2. The traffic between VPC2 and DMZ VPC is not protected by Cloud Firewall. The traffic from any VPC or IDC to 0.0.0.0/0 in the default route is not protected by Cloud Firewall.

Application scope

Cloud Firewall can protect the traffic between network instances that are connected by using CEN transit routers. The network instances include VPCs, VBRs, and Cloud Connect Network (CCN) instances.

If you want to protect the traffic between VPCs in the same region by using a VPC firewall, you can follow the procedure in this topic.

Step 1: Connect FW VPC to a transit router

This step establishes a connection between FW VPC and a transit router.

  1. Log on to the CEN console.
  2. On the Instances page, find the CEN instance whose traffic you want to redirect to a VPC firewall and click the ID of the instance. The ID of the CEN instance
  3. On the Basic Settings tab, find a CEN transit router and click Create Connection in the Actions column or click the Add icon icon to the right of VPC in the upper part of the tab.
  4. On the Connection with Peer Network Instance page, configure the parameters.
    The following table describes the important parameters.
    Parameter Description
    Network Type The type of the network instance that you want to connect to the CEN instance. In this example, select VPC.
    Region The region in which the network instance resides. In this example, select the region that you specify when you create FW VPC.
    Networks The network instance that you want to connect to the CEN instance. In this example, select the ID of FW VPC.
    VSwitch The vSwitches that you can bind to the network instance. In this example, select TR-Vswitch-01 as the primary vSwitch and TR-VSwitch-02 as the secondary vSwitch.

    For more information about other parameters, see Use an Enterprise Edition transit router to create VPC connections.

Step 2: Connect the VPCs and VBRs to the transit router

This step separately establishes a connection between the transit router and each of the following network instances: VPC1, VPC2, DMZ VPC, IDC-1, and IDC-2. This way, the VPCs and VBRs are connected to the CEN instance.

For more information, see Use an Enterprise Edition transit router to create VPC connections.

Step 3: Create a VPC firewall

This step creates a VPC firewall for FW VPC.

To create a VPC firewall, log on to the Cloud Firewall console, go to the Firewall Settings page, and then click the VPC Firewall tab. On the VPC Firewall tab, click the CEN tab, find FW VPC, and then click Create in the Actions column. In the Create VPC Firewall dialog box, select Manual for Routing Mode, FW VPC for VPC, and Cfw-Vswitch for vSwitch.

For more information, see Create a VPC firewall for a CEN instance.

Note After this step is complete, an elastic network interface (ENI) named cfw-bonding-eni is created. To view the ENI, log on to the ECS console and choose Network & Security > ENIs.

Step 4: Create routes for VPC1, VPC2, and DMZ VPC

This step creates routes between the CEN instance and FW VPC for which the VPC firewall is created.

  1. Log on to the CEN console.
  2. On the Instances page, find the CEN instance whose traffic you want to redirect to the VPC firewall and click the ID of the instance. The ID of the CEN instance
  3. On the Transit Router tab, find a transit router and click the number in the Route Table column.
    Number of route tables
  4. Create route tables named Cfw-Untrust-RouteTable and Cfw-Trust-RouteTable.
    1. On the Route Table tab, click Create Route Table.
    2. In the Create Route Table dialog box, configure the parameters for the Cfw-Untrust-RouteTable and Cfw-Trust-RouteTable route tables.

      Transit Router: Retain the default value.

      Note
      • The Cfw-Untrust-RouteTable route table is used to forward traffic from VPC1, IDC-1, and IDC-2 to FW VPC.
      • The Cfw-Trust-RouteTable route table is used to forward traffic from FW VPC to VPC1, VPC2, DMZ VPC, IDC-1, and IDC-2.
  5. Configure the Cfw-Trust-RouteTable route table.
    After this operation is complete, the Cfw-Trust-RouteTable route table automatically learns routes from VPC1, VPC2, DMZ VPC, IDC-1, and IDC-2, and the traffic from FW VPC is forwarded to the Cfw-Trust-RouteTable route table.
    1. Click the Cfw-Trust-RouteTable route table that you created. In the right-side section, click the Route Propagation tab.
    2. On the Route Propagation tab, click Enable Route Propagation.
    3. In the Enable Route Propagation dialog box, select VPC1, VPC2, DMZ VPC, IDC-1, and IDC-2 for Attachment. Then, click OK.
      After route learning correlations are created, you can view the information about the routes that the system learns on the Route Entry tab.
    4. On the Route Table tab, click the system route table in the left-side route table list. In the Route Table Details section, click the Route Table Association tab.
    5. On the Route Table Association tab, delete the associated forwarding correlation that is created for FW VPC.
    6. Click the Cfw-Trust-RouteTable route table that you created. On the Route Table Association tab, click Create Association.
    7. In the Add Association dialog box, select FW VPC for Association. Then, click OK.
  6. Configure the Cfw-Untrust-RouteTable route table.
    After this operation is complete, traffic is forwarded to FW VPC for which the VPC firewall is created based on the Cfw-Untrust-RouteTable route table.
    1. Click the Cfw-Untrust-RouteTable route table that you create. In the right-side section, click the Route Entry tab.
    2. On the Route Entry tab, click Add Route Entry.
    3. In the Add Route Entry dialog box, configure the parameters.
      Parameter description:
      • Destination CIDR: Retain the default value 10.0.0.0/8.
      • Blackhole Route: Retain the default value No.
      • Next Hop: Select FW VPC.
    4. Repeat the preceding steps to add the following routes:
      • The route whose Destination CIDR is 172.16.0.0/12 and Next Hop is FW VPC.
      • The route whose Destination CIDR is 192.168.0.0/16 and Next Hop is FW VPC.
      • The route whose Destination CIDR is 61.20.0.0/16 and Next Hop is FW VPC.
      • The route whose Destination CIDR is 0.0.0.0/0 and Next Hop is DMZ VPC.
  7. Configure the system route table.
    1. On the Route Table tab, click the system route table in the left-side route table list. In the right-side section, click the Route Propagation tab.
    2. On the Route Propagation tab, delete the route learning correlations that are created for VPC1, IDC-1, FW VPC, and IDC-2.
      After this operation is complete, the system retains only the route learning correlations that are created for VPC2 and DMZ VPC. You can view the information about the routes that the system automatically learns on the Route Entry tab.
    3. On the Route Entry tab, click Add Route Entry.
    4. In the Add Route Entry dialog box, add the following routes:
      • The route whose Destination CIDR is 10.0.0.0/24 (VPC1) and Next Hop is FW VPC.
      • The route whose destination CIDR is 172.16.0.0/12 (IDC1) and Next Hop is FW VPC.
      • The route whose Destination CIDR is 61.20.0.0/16 (IDC-2) and Next Hop is FW VPC.
    5. On the Route Table Association tab, delete the associated forwarding correlations that are created for VPC1, IDC-1, and IDC-2.
  8. Configure the Cfw-Untrust-RouteTable route table.
    After this operation is complete, the traffic from VPC1, IDC-1, and IDC-2 is forwarded to the Cfw-Untrust-RouteTable route table.
    1. Click the Cfw-Untrust-RouteTable route table that you created. In the right-side section, click the Route Table Association tab.
    2. On the Route Table Association tab, click Create Association.
    3. In the Add Association dialog box, select VPC1, IDC-1, and IDC-2 for Association. Click OK.

After this step is complete, the routes between the CEN instance and FW VPC are created, and traffic can be forwarded to FW VPC.

Step 5: Configure route tables for the VPC firewall

This step forwards the traffic from FW VPC to the VPC firewall.

  1. Log on to the VPC console. In the left-side navigation pane, click Route Tables.
  2. On the Route Tables page, click the VPC-CFW-RouteTable route table. On the Associated vSwitch tab, click Associate vSwitch. Select Cfw-Vswitch for vSwitch. Click OK.
  3. Click the Route Entry List tab. Then, click the Custom Route tab and click Add Route Entry. In the panel that appears, configure the parameters.
    Parameter description:
    • Destination CIDR Block: Specify 0.0.0.0/0.
    • Next Hop Type: Select Transit Router.
    • Transit Router: Retain the default value, which specifies the network instance connection of FW VPC for which the VPC firewall is created.
    After this operation is complete, the outbound traffic of the VPC firewall is forwarded to the transit router.
  4. On the Route Tables page, click the name of the system route table that is created for FW VPC.
  5. On the page that appears, click the Route Entry List tab and click the Custom Route tab.
  6. Click Add Route Entry. In the Add Route Entry panel, configure the parameters.
    Parameter description:
    • Destination CIDR Block: Specify 0.0.0.0/0.
    • Next Hop Type: Select Secondary ENI.
    • Secondary ENI: Select Cfw-bonding-eni.
  7. On the Custom Route tab, delete other custom routes. To delete a route, click Delete in the Actions column.
    After this step is complete, the traffic from FW VPC is redirected to the VPC firewall.

Step 6: Check whether the forwarding configuration is successful

You can check whether the traffic logs of the CEN instance are displayed on the Traffic Logs tab. If the traffic logs are recorded, the forwarding configuration is successful. Examples:
  • VPC1 and VPC2 can communicate with each other, and traffic logs are recorded.
  • VPC2 and DMZ VPC can communicate with each other, but no traffic logs are recorded.

For more information, see Traffic logs.