Current location - Recipe Complete Network - Complete vegetarian recipes - Create a Private NAS+ Blog with Raspberry Pie (1)—— Web articles
Create a Private NAS+ Blog with Raspberry Pie (1)—— Web articles
Title: Raspberry Pie NAS_ Web Page

date: 202 1-0 1-26 10:35:00

tags:

-Raspberry pie

- NAS

-Network

blog_home: http://www.smcbaq.top:808 1/

My plan is to use Raspberry Pie to build a personal blog +NAS combination. At first, I used Raspberry Pie 3b+, and I have already built a personal blog based on hexo. However, I made various compromises on power supply, wiring and other issues because of conditions before, which finally led to certain problems. This time, I deployed Raspberry Pie 4b again and recorded the building process. If anyone finds this series of articles, they can try it. After all, I will try it.

In this series of articles, some steps may be completed directly according to other people's articles and blogs. There are no pits, so I won't repeat them here, just use links, focusing on the pits that may be involved in the middle.

A computer, a router (I use R6300U with revised Merlin), a raspberry pie (with power supply, I use 4b), and a network cable (optional, I use ultra-Category 5 cable that supports Gigabit).

The key point of home networking is to do a good job in the router. Our goal in this step is to make raspberry pie accessible on the intranet. My home network is structured as follows:

Very simple structure, simply speaking, the main route manages the living room and the slave route manages the room. Because the main route has better performance, Raspberry Pie plans to connect to the main route, and I connect the WiFi of the slave route in the room most of the time, so it is necessary to pay attention to the fact that the master-slave route cannot open AP isolation, otherwise the computer cannot access the route, and other defaults will do. The router, especially the master route, recommends dhcp mode, which is very simple to verify. The mobile phone is connected to the master route, and the computer is connected to the slave route. Computer phones can ping each other, and Android phones use APP: $ TERM UX to ping computers.

Raspberry pie can be opened by installing the system. I use the desktop version of Raspberry Pi OS(Raspbian), and the recommended software version is not installed. The specific opening method is to add a file named ssh under the boot drive letter without any suffix.

You can learn this tutorial by installing the raspberry pie system.

Then connect the raspberrypie to the power supply, plug in the network cable and connect it to the LAN port of the main route, wait for a period of time, find the IP assigned to the raspberry pie in the router management interface (the device name is usually pi or Raspberry Pi), and connect the Raspberry Pie successfully by computer ssh. The initial user name of the Raspberry Pie is pi, and the default password is Raspberry. Remember to use passwd and sudo passwd root to modify the passwords of Pi users and root users respectively.

If there is no network cable, set up WLAN connection for raspberry pie in advance, and then find IP even ssh, but it is not recommended to do so. The specific reasons will be mentioned in the software article later, and of course, if you read it then, you will say it separately.

In fact, public network access is not a hard requirement. You can do intranet penetration through frp, but this requires an extra server, which is a bit contrary to my original intention. After all, one of the purposes of doing this is to have an extra server.

The key point of public network access is to have a public network IP. Some operators will directly give a public network IP, such as broadband in my telecom dormitory at school, but most of them will not give it, so it is necessary to judge in advance. There are two main methods:

If you don't have a public IP, then call your home broadband provider and ask the customer service to open it. Generally speaking, it is included in the broadband service. If you ask what you want to do, you can say that you need to check the public IP at any time for monitoring at home, and it will be opened soon, which will save the effort of wrangling.

Although we get the public IP, generally speaking, operators provide dynamic IP, and then it will be more troublesome to access the external network (routers usually provide remote viewing software and can see the IP, but it is very convenient to access it by changing the IP), so we need to use dynamic domain name resolution-DDNS, so that we can access it directly by using the domain name.

First of all, Merlin's own free DDNS from ASUS. Because of a BUG in my version of magic change Merlin's netware brush, DDNS often breaks itself, so I manually operate the router to open it. Because it is too frequent about once every 2-3 days, I finally chose to give up, but the official Merlin of ASUS AC68U will not have this BUG.

Finally, my choice is DDNS from Alibaba Cloud, and the advantages of magic change Meilin are reflected here. You can directly install the plug-in and set the following tags.

There are a series of real-name registration system operations to purchase domain names. Please be patient if you already have this demand.

Finally, I bought a cheaper domain name, and my personal blog is using this domain name http://www.smcbaq.top: 8081

This is easy to understand, because the devices in the intranet cannot be accessed directly, so we need to set the router to do port forwarding to map the devices. Merlin firmware can set the communication port and local port in the following marks.

The communication port is the port accessed when the external network equipment is connected, and the local port is the port occupied by the service started by the local equipment (here, raspberry pie). The former is set casually, while the latter needs to be configured, for example:

I want to visit my blog via port 808 1, so the communication port is set to 808 1, and this blog service runs on port 8080 of Raspberry Pi, so the local port is set to 8080, the local IP is the IP of Raspberry Pi, and the communication protocol uses TCP.

Add and save.

Ps: I finished the operation earlier, and the tutorial was written temporarily. It may be a bit pitted on your computer. Remember to operate carefully and don't see the command ctrl+c/v blindly.

If the slave routing function is relatively complete and the AP mode can be turned on, it is quite convenient to switch seamlessly at home using two WiFi with the same name.

You can set a fixed assigned intranet IP address for raspberry pie, although it will not change generally, but it will be more troublesome once it changes.

Ssh connection can give the public key of the computer to Raspberry Pie to realize secret-free ssh login. The specific tutorial is here, and the tutorial of windows generating public key is this.

Computers can use vs-code to install Remote-SSH plug-ins to facilitate file operations. It is quite simple to find them by yourself.