In the previous article, we introduce how to use cpolar, use SSH on a remote access local raspberries pie, it can not only allow us to convenient access to the house in a public Internet environment raspberries pie, we can obtain the required data, set up their own cloud storage service, also can with raspberries sent to the server in the home, Set up your own web page. But regardless of the application scenario, stable access is an essential focus. How to set up cPolar to set up a permanent TCP address for SSH raspberry PI.
If you read our previous articles, you can easily see that the key to SSH access to raspberry PI from the public Internet is the data tunnel opened by CPolar. Therefore, to ensure stable access to Raspberry PI at all times, you must set up CPolar. Specific as follows:
1. Log in to cPolar’s official website to upgrade packages
Cpolar considers the need for a stable data tunnel from the beginning of the design, so CPolar can upgrade the type of service package to fix one (or more) data tunnels for the convenience of customers. Just log on to the CPolar website. Enter the “dashboard” under your account, you can easily upgrade the package.
2. Set the RESERVED TCP address
In this step, we need to click the “Reserved” button on the left side of the cPolar dashboard page. On the Reserved PAGE, click reserved TCP address.
Set Region to China VIP and set Description based on the actual situation to distinguish different SSHS. After filling in the content, you can click the “Reserve” button on the right and ask CPolar to generate a fixed TCP address for long-term use of the tunnel.
Then we need to bind the TCP address reserved by Cpolar to the local SSH port by entering the command line:
cpolar tcp -remote-addr=1.tcp.vip.cpolar.cn:20046 22
Copy the code
At this point, modify the configuration file of CPolar in raspberry PI to let CPolar remember our changes. Input in the raspberry pie: “nano/usr/local/etc/cpolar/cpolar yml” command, open cpolar configuration file.
In which input “remote_addr = 1. TCP. VIP. Cpolar. Cn: 20046”, appear as shown in the following image content, which shows that modified success.
Note that the remote_addr parameter in the configuration file is underlined, and the -remote-addr parameter used in the command line is underlined. After entering the correct command line, you can save and exit.
To make sure the configuration changes are correct, we should run a test to start the data tunnel separately by entering “cpolar start SSH” on the CPolar screen:
If the preceding information is displayed, it indicates that CPolar has started the reserved data tunnel correctly. Then we save and exit, restart cpolar (enter “sudo systemctl restart cpolar”), and then use the fixed public Internet address to SSH “SSH [email protected] -p 20046”. The operation is done using cPolar’s fixed TCP address. In practice, the port number assigned to each user is different. Therefore, the customer needs to change the port number to the actual port number when entering the command line to avoid connection failure.
As you can see from the above, reserving a fixed TCP port for Raspberry PI’s SSH is not a complicated operation, with only one important point to note. You can try it yourself by giving your raspberry PI a fixed TCP address. If you have any questions about the use of CPolar, please feel free to contact us and we will provide you with our best assistance.