Construction and maintenance of raspberry pie intranet penetration
Overview （http://neiwangchuantou.cn/arc…Chapter links)
Today, we mainly talk about the use ofNetwork cloud wear officialIt provides the function of Intranet penetration to visit the website of raspberry pie on the Internet, and remote management through SSH.
Raspberry pie（http://neiwangchuantou.cn/arc…Chapter links)
Raspberry pie is a microcomputer based on ARM architecture processor produced by Broadcom, which is cheap. At present, the latest version is 4B. The author uses 3B +, which was about 200 yuan at that time.
The configuration of 3B + version is as follows:
- Arm cortex-a53 CPU with main frequency of 1.4GHz and 64 bit 4-core
- 1GB lpddr2 memory
- 2.4GHz and 5GHz ieee802.11.b/g/n/ac wireless network card, Bluetooth 4.2
- 4 USB2.0
This configuration is more than enough to run a static website. After all, Alibaba cloud’s cheap one core 1g (the main frequency will be slightly higher).
Station building （http://neiwangchuantou.cn/arc…Chapter links)
Raspberry PI OS is officially provided by raspberry PI OS based on Debian, so the installation software is the same as the familiar Ubuntu. First, install nginx as a web server
sudo apt install nginx
Start up after installation:
#Start nginx. If there is no output, it means that the startup is successful sudo nginx #You can also actively view the process ps -ef | grep nginx
Viewing the process output is similar to the following:
By default, nginx has a configuration file that takes effect directly. You can access the LAN IP of raspberry pie through the browser. For example, mine is
192.168.199.175When you can see this page, it means that the web server has provided services normally.
If you need to visit your own website file, change the configuration file of nginx.
Penetration of network cloud through intranet
The website already has, the next is to configure the intranet penetration for external network access.
stayOnline cloud goes through the official websitePurchase the tunnel and set the penetration protocol to HTTP (s). The intranet port is the port of nginx installed above. The default value is 80. You can adjust it by modifying the configuration file. You can configure it here。
After confirmation, the console will generatetokenCopy it.
Next, install the cloud piercing client. It is said that raspberry pie is an arm architecture processor, so to download the arm version of netcloud penetration software, log in to the console and you can see that:
Copy the link address and execute the following command:
#Using WGet wget http://xiaomy.net/download/linux/wyc_linux_arm && chmod a+rwx wyc_linux_arm #Use curl, choose one curl -O http://xiaomy.net/download/linux/wyc_linux_arm && chmod a+rwx wyc_linux_arm
After the execution, the client of netcloud penetration is installed. Next, start the software and execute the following command:
./wyc_ linux_ The token recorded on ARM - token
You can see the following output:
You can access the Internet domain name directly in the browser
It’s so simple that the website inside raspberry pie can be accessed by the Internet.
Operation and maintenance （http://neiwangchuantou.cn/arc…Chapter links)
Is the website finished when it runs? Of course not. In the future, you may have to face website update, software update, service restart and other affairs. These things can only be operated through remote management, which is the content of this part:Operation and maintenance management of raspberry pie through SSH。
In fact, we have installed some software on raspberry pie in the process of building the website. This process is the operation of SSH connection,Now what we need to do is SSH to access the Internet address to connect to the raspberry pie。
The tunnel should also be opened first,This time, the penetration protocol is TCP, and the intranet port is SSH port. The default value is 22. Of course, you can modify it through the configuration file to keep it consistent。
After confirmation, the following information will be generated to record the Internet port, domain name and Token:
alsoStart againA cloud penetrating client, using the password just recorded, will generate an external network address with a port this time.
./wyc_ linux_ The token recorded on ARM - token
Finally, you can connect raspberry pie on other machines by following the command:
SSH - P Internet port PI @ domain name
This realizes the remote management of raspberry pie.
Summary （http://neiwangchuantou.cn/arc…Chapter links)
Two tunnels have been opened through the network cloud crossing, that is, the website accessed from the external network is realized, and the remote management is also realized.
Is it necessary, you may ask? It’s better to buy a cloud server!
I personally think that the biggest cost of building a website is cloud server. The 1-core 1g plus 1Mbps bandwidth is usually enough for personal websites. Take Alibaba cloud as an example. The price is about 500 per year. However, it was very hard for me to start Hadoop on this server.
And the intranet through transparent is much cheaper, we can choose higher bandwidth according to the situation of the website. And you can bind your own domain name, and the server doesn’t need to be put on record. It seems to outsiders that there is no difference between cloud server and cloud server.
Of course, such a comparison is obviously unfair, because we need to provide our own computer, electricity and energy to choose the scheme of Intranet penetration. The overall cost may be about the same, but in theory, the performance of the computer is controlled by ourselves, so it is much more playable. Isn’t life just about tossing?
Finally, thank you very much for the free solution provided by netcloud.