Updated on 2024-11-21 GMT+08:00

Network and Resource Planning

To use an enterprise router to scrub traffic for VPCs in the same region, you need:
  • Network Planning: Plan CIDR blocks of VPCs and their subnets, and route tables of VPCs and the enterprise router.
  • Resource Planning: Plan the quantity, names, and other parameters of cloud resources, including VPCs, ECSs, and the enterprise router.

Network Planning

Figure 1 shows the network planning for protecting traffic for VPCs in the same region.

Figure 1 Networking planning for protecting VPC traffic in the same region
Table 1 Network traffic flows

Path

Description

Request traffic: from VPC 1 to VPC 2

  1. In the route table of VPC 1, there are routes with the next hop set to the enterprise router to forward traffic from VPC 1 to the enterprise router.
  2. VPC 1 is associated with the route table 1 of the enterprise router. This route table has a static route with the next hop set to the VPC 3 attachment to forward traffic from the enterprise router to VPC 3.
  3. Two NICs of ECS 3 are in the two subnets of VPC 3, respectively.
    1. The NIC eth0 in subnet 1 receives traffic. In the default route table of VPC 3, there are routes with the next hop set to ECS 3 to forward traffic from eth0 to eth1.
    2. The NIC eth1 in subnet 2 forwards the traffic scrubbed by firewall. In the custom route table of VPC 3, there are routes with the next hop set to the enterprise router to forward scrubbed traffic from VPC 3 to the enterprise router.
  4. VPC 3 is associated with the route table 2 of the enterprise router. This route table has a propagated route with the next hop set to the VPC 2 attachment to forward traffic from the enterprise router to VPC 2.

Response traffic: from VPC 2 to VPC 1

  1. In the route table of VPC 2, there are routes with the next hop set to the enterprise router to forward traffic from VPC 2 to the enterprise router.
  2. VPC 2 is associated with the route table 1 of the enterprise route. This route table has a static route with the next hop set to the VPC 3 attachment to forward traffic from the enterprise router to VPC 3.
  3. Two NICs of ECS 3 are in the two subnets of VPC 3, respectively.
    1. The NIC eth0 in subnet 1 receives traffic. In the default route table of VPC 3, there are routes with the next hop set to ECS 3 to forward traffic from eth0 to eth1.
    2. The NIC eth1 in subnet 2 forwards the traffic scrubbed by firewall. In the custom route table of VPC 3, there are routes with the next hop set to the enterprise router to forward scrubbed traffic from VPC 3 to the enterprise router.
  4. VPC 3 is associated with the route table 2 of the enterprise router. This route table has a propagated route with the next hop set to the VPC 1 attachment to forward traffic from the enterprise router to VPC 1.
Table 2 Description for traffic scrubbing for VPCs in the same region

Resource

Description

VPCs

  • The traffic to VPC 1 and VPC 2 needs to be scrubbed by the firewall deployed in VPC 3.
  • The CIDR blocks of the VPCs to be connected cannot overlap with each other.

    In this example, the CIDR blocks of the VPCs are propagated to the enterprise router route table as the destination in routes. The CIDR blocks cannot be modified and overlapping CIDR blocks may cause route conflicts.

    If your existing VPCs have overlapping CIDR blocks, do not use propagated routes. Instead, you need to manually add static routes to the route table of the enterprise router. The destination can be VPC subnet CIDR blocks or smaller ones.

  • VPC 1 and VPC 2 each have a default route table.
  • VPC 3 has two subnets. Subnet 1 is associated with the default route table, and subnet 2 is associated with the custom route table.
  • The routes in the default route table are described as follows:
    • Local: a system route for communications between subnets in a VPC.
    • Enterprise router: a custom route with destination set to 0.0.0.0/0 for routing traffic from a VPC subnet to the enterprise router. For details, see Table 3.
    • ECS 3: a custom route for routing traffic from a VPC subnet to ECS 3. For details, see Table 4.

Enterprise router

Disable the Default Route Table Association and Default Route Table Propagation, create two route tables, attach the three VPCs to the enterprise router, and configure the route tables as follows:
  • Associate the VPC 1 and VPC 2 attachments with route table 1, and add a static route to route table 1 with the next hop set to the VPC 3 attachment. For details, see Table 5.
  • Associate the VPC 3 attachment with route table 2. Propagate VPC 1 and VPC 2 attachments to route table 2. The route table 2 automatically learns the VPC CIDR blocks as the destination of routes. For details, see Table 6.

ECS

  • The three ECSs are in different VPCs. If the ECSs are in different security groups, add rules to the security groups to allow access to each other.
  • A third-party firewall is deployed on ECS 3. The ECS 3 has two NICs that are in the two subnets of VPC 3, respectively.
Table 3 Route table for VPC 1, VPC 2, and VPC 3

Destination

Next Hop

Route Type

10.0.0.0/8

Enterprise router

Static route (custom)

172.16.0.0/12

Enterprise router

Static route (custom)

192.168.0.0/16

Enterprise router

Static route (custom)

  • If you enable Auto Add Routes when creating a VPC attachment, you do not need to manually add static routes to the VPC route table. Instead, the system automatically adds routes (with this enterprise router as the next hop and 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 as the destinations) to all route tables of the VPC.
  • If an existing route in the VPC route tables has a destination to 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16, the routes will fail to be added. In this case, do not enable Auto Add Routes. After the attachment is created, manually add routes.
  • Do not add a route with the next hop set to the enterprise router to the default route table of VPC 3. Do not enable Auto Add Routes when creating the VPC 3 attachment.
  • Do not set the destination of a route (with an enterprise router as the next hop) to 0.0.0.0/0 in the VPC route table. If an ECS in the VPC has an EIP bound, the VPC route table will have a policy-based route with 0.0.0.0/0 as the destination, which has a higher priority than the route with the enterprise router as the next hop. In this case, traffic is forwarded to the EIP and cannot reach the enterprise router.
Table 4 VPC 3 default route table

Destination

Next Hop

Route Type

10.1.0.0/16

ECS

Static route (custom)

10.2.0.0/16

ECS

Static route (custom)

Table 5 Enterprise router route table 1

Destination

Next Hop

Route Type

0.0.0.0/0

VPC 3 attachment: er-attach-inspection

Static route

Table 6 Enterprise router route table 2

Destination

Next Hop

Route Type

VPC 1 CIDR block: 10.1.0.0/16

VPC 1 attachment: er-attach-01

Propagated

VPC 2 CIDR block: 10.2.0.0/16

VPC 2 attachment: er-attach-02

Propagated

Resource Planning

Each region has an enterprise router, VPCs, and ECSs. They can be in different AZs.

The following resource details are only examples. You can modify them if needed.

  • One enterprise router. See details in Table 7.
    Table 7 Enterprise router details

    Enterprise Router Name

    ASN

    Default Route Table Association

    Default Route Table Propagation

    Route Table

    Attachment

    er-test-01

    64512

    Disabled

    Disabled

    Two route tables:

    er-attach-01

    er-attach-02

    er-attach-inspection

    Table 8 Enterprise router route table 1 details

    Name

    Associated Attachment

    Static Route

    er-rtb-01

    er-attach-01

    er-attach-inspection

    er-attach-02

    Table 9 Enterprise router route table 2 details

    Name

    Associated Attachment

    Propagated Attachment

    er-rtb-02

    er-attach-inspection

    er-attach-01

    er-attach-02

  • Three VPCs that do not overlap with each other. See details in Table 10.
    Table 10 VPC details

    VPC

    VPC CIDR Block

    Subnet

    Subnet CIDR Block

    Association Route Table

    VPC 1: vpc-demo-01

    10.1.0.0/16

    subnet-demo-01

    10.1.0.0/24

    Default route table

    VPC 2: vpc-demo-02

    10.2.0.0/16

    subnet-demo-02

    10.2.0.0/24

    Default route table

    VPC 3: vpc-inspection

    192.168.0.0/16

    subnet-inspection-01

    192.168.0.0/24

    Default route table

    subnet-inspection-02

    192.168.1.0/24

    Custom route table

  • Three ECSs, respectively, in three VPCs. See details in Table 11 and Table 12.
    Table 11 ECS 1 and ECS 2 details

    ECS Name

    Image

    VPC

    Subnet

    Security Group

    Private IP Address

    ECS 1: ecs-demo-01

    Public image:

    CentOS 8.0 64-bit

    vpc-demo-01

    subnet-demo-01

    sg-demo

    (general-purpose web server)

    10.1.0.113

    ECS 2: ecs-demo-02

    vpc-demo-02

    subnet-demo-02

    10.2.0.175

    Table 12 ECS 3 details

    ECS Name

    Image

    NIC

    VPC

    Subnet

    Security Group

    Private IP Address

    ecs-inspection

    Public image:

    CentOS 8.0 64-bit

    eth0

    vpc-inspection

    subnet-inspection-01

    sg-demo

    (general-purpose web server)

    192.168.0.21

    eth1

    subnet-inspection-02

    192.168.1.22