tencent cloud

TencentDB for Tendis

Release Notes
Product Introduction
Overview
Strengths
Use Cases
Product Series
Performance
Command Compatibility
Regions and AZs
Relevant Concepts
Relevant Products
Purchase Guide
Billing Overview
Pricing
Payment Overdue Policy
Getting Started
Creating Tendis Instances
Connecting to Tendis Instances
iptables Forwarding
Operation Guide
Instance Connection Using Programming Languages
Instance Maintenance and Management
Monitoring Features
Configuring Security Groups
Disabling Commands
FAQs
General
Purchase
Connection and Login
Contact Us
Tendis Policy
Privacy Policy
Data Privacy and Security Agreement
Glossary

iptables Forwarding

PDF
Focus Mode
Font Size
Last updated: 2023-12-21 21:09:50
TencentDB for Tendis does not support direct access over a public network, but you can use a CVM instance with a public IP for port forwarding to access a Tendis instance over a public network.
Note:
Port forwarding with iptables is not stable, so we do not recommend this public network access solution in a production environment.


Directions

1. Log in to a CVM instance, and enable the IP forwarding feature.
Note:
The CVM and TencentDB instances must be under the same account and in the same VPC in the same region, or both in the classic network.
echo 1 > /proc/sys/net/ipv4/ip_forward
2. Configure the forwarding rule. The following sample code is to forward access requests of 26.xx.x.2:10001 (CVM public IP and customizable port) to a Tendis instance whose private IP and port are 10.0.0.5:6379.
iptables -t nat -A PREROUTING -p tcp --dport 10001 -j DNAT --to-destination 10.0.0.5:6379
iptables -t nat -A POSTROUTING -d 10.0.0.5 -p tcp --dport 6379 -j MASQUERADE
3. Configure the security group to open the public port of the CVM instance. We recommend that you configure a security group rule to allow only the source which needs to connect to the Tendis instance.
4. To connect to the Tendis instance in the private network using a public network address (26.xx.xx.2:10001 in the sample code), you can use the same command as the private network connection command. For more information, please see Connecting to Tendis Instances.
5. After connecting to the Tendis instance, run the info command. If database information is returned, the connection is successful.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback