edit-icon download-icon

Connect through public network

Last Updated: Oct 18, 2018

ECS Windows

Currently, ApsaraDB for Memcache is accessible by ECS intranet. If you must access ApsaraDB for Memcache through the Internet, you must create port mapping through netsh on the ECS Windows server.

  1. Log on to the ECS Windows server, and run the following command in CMD.

    1. netsh interface portproxy add v4tov4 listenaddress=ECS server private IP address listenport=11211 connectaddress=ApsaraDB for Memcache connection address connectport=11211

    To view all port forwarding rules on the server, run the following command: netsh interface portproxy show all

  2. Verify and test the mappings after settings are completed.

    Connect to the ECS Windows server locally through the telnet and write data for query and verification. If the IP address of the ECS Windows server is 1.1.1.1, that is telnet 1.1.1.1 11211.

    With these steps, your local PC or server can be connected to the ECS Windows 11211 port over the Internet and access Alibaba Cloud ApsaraDB for Memcache.

    Note: Because portproxy is provided by the official Microsoft team, and is not open-source, if you have any questions during configuration and usage, see the netsh portproxy usage instructions or consult with Microsoft. Also consider other alternatives, such as configuring proxy mappings through portmap.

  3. After finishing related operations, you can run netsh interface portproxy delete v4tov4 listenaddress=ECS private IP address listenport=11211 to delete the public network forwarding rule.

ECS Linux

Currently, Alibaba Cloud ApsaraDB for Memcache is accessible by ECS intranet. If you must access ApsaraDB for Memcache through the Internet, you must install rinetd on the ECS Linux server for forwarding.

  1. Install rinetd on the ECS Linux.

    1. wget http://www.boutell.com/rinetd/http/rinetd.tar.gz&&tar -xvf rinetd.tar.gz&&cd rinetd
    2. sed -i 's/65536/65535/g' rinetd.c (Modify the port range. Otherwise an error will be reported)
    3. mkdir /usr/man&&make&&make install

    Note: The download address of the rinetd installer may not be available. You can search for the installer on your own for downloading and usage.

  2. Create the configuration file.

    1. vi /etc/rinetd.conf
  3. Enter the following content.

    1. 0.0.0.0 11211 [Memcache connection address] 11211
    2. logfile /var/log/rinetd.log

  4. Run the rinetd command to start rinetd.

    Note: You can set it to auto start through echo rinetd >>/etc/rc.local. You can use pkill rinetd to end the process.

  5. Test and verify.

    Connect to the ECS Linux server locally through telnet for data write and query validation. For example, if the IP address of the server with rinetd installed is 1.1.1.1, that is telnet 1.1.1.1 11211.

    Following these steps, your local PC or server can be connected to the ECS Linux 11211 port over the Internet and access Alibaba Cloud ApsaraDB for Memcache.

    Note: Since rinetd is open-source software, if you have any questions during the usage, you can see its official documentation or contact the official side of rinetd for confirmation.

Thank you! We've received your feedback.