Background: VPC Peering and Security in Tencent Cloud
How VPC Peering Works
In Tencent Cloud, Virtual Private Cloud (VPC) Peering allows private connectivity between VPCs. However, unlike some other cloud providers, Tencent requires specific routing table entries and security group rule adjustments on both sides of the peering connection to allow traffic to flow bidirectionally.
# Example: Routing configuration for VPC Peering Destination CIDR: 10.20.0.0/16 Next Hop Type: Peering Connection Next Hop ID: pcx-abcd1234
Security Group Dependencies
Security groups in Tencent Cloud act as virtual firewalls. They are stateful and require rules that explicitly allow ingress and egress for both source and destination IP ranges—even in peered VPCs. Missing any of these rules leads to silent drops, often misattributed to service misconfigurations.
Root Cause: Asymmetrical Rules in Peered VPCs
What Goes Wrong
- Security groups allow traffic from one VPC CIDR but not vice versa
- Route tables don't reflect the entire range of service subnet CIDRs
- TCP traffic appears to initiate but never completes handshake
- DNS resolution succeeds, creating false confidence in connectivity
Real-World Impact
Microservices depending on internal APIs time out or fail intermittently, especially under load balancing or when services autoscale into new subnets. Observability tools may not capture the dropped packets if network flow logs aren't enabled.
Diagnostic Techniques
Step 1: Use Tencent Cloud VPC Diagnostics Tool
The VPC diagnostics tool provides basic insights into peering and route table issues. However, it does not validate security group configurations.
Step 2: Run Network Probes Internally
# Using curl with timeout flags curl -m 5 -v http://10.20.1.5:8080/healthz # Using telnet to test port connectivity telnet 10.20.1.5 8080
Step 3: Review Flow Logs
Enable flow logs on each subnet and instance to capture denied packets. Filter logs by source/destination IP and TCP flags to identify unacknowledged SYN packets.
Filter: action=REJECT and dstaddr=10.20.1.5
Mitigation Strategy
Security Group Rule Hardening
- Whitelist the CIDR blocks of all peered VPCs on both ingress and egress
- Allow necessary TCP/UDP ports with specific protocol flags
- Use tagging to auto-apply rules via Terraform or TKE operator
Route Table Validation
Ensure that all subnets in the peered VPC are covered by accurate routes. Monitor route propagation if using shared VPCs or nested peering structures.
Automation Example Using Terraform
resource "tencentcloud_security_group_rule" "allow_peered_vpc" { security_group_id = var.sg_id type = "ingress" protocol = "tcp" cidr_ip = "10.20.0.0/16" port_range = "1-65535" action = "ACCEPT" }
Best Practices for Tencent Cloud Networking
- Define and document network topology diagrams before peering
- Use naming conventions and tagging across VPCs for traceability
- Automate security group updates on new service deployments
- Establish CI pipelines to validate VPC, SG, and route configurations
- Enable VPC flow logs permanently in production environments
Conclusion
As Tencent Cloud adoption grows, so do the complexities of large-scale deployments across regions and isolated networks. Misconfigurations in VPC peering and security group rules can silently disrupt core service communication. These issues are hard to detect but critical to fix. Through careful diagnostics, rule hardening, and automation, teams can avoid hours of downtime and improve infrastructure resilience.
FAQs
1. Does Tencent Cloud automatically handle routing between peered VPCs?
No. While peering establishes the connection, you must manually update route tables and security groups to enable traffic flow.
2. Can I use CIDR blocks to reference entire VPCs in security groups?
Yes. Always use VPC-level CIDRs in security rules to cover entire subnet ranges, especially in autoscaling scenarios.
3. Are VPC flow logs free in Tencent Cloud?
They may incur small costs depending on traffic volume and log storage destination. Always validate pricing in your region.
4. How can I prevent issues during autoscaling?
Automate security group rule application for new nodes using templates, tags, or orchestration tools like TKE or Terraform.
5. Can nested VPC peering work in Tencent Cloud?
No. Tencent Cloud does not support transitive (nested) peering. Services must be explicitly peered and routed.