
During this week, while scrolling through Douyin, I was unexpectedly shown a lot of information about home NAS servers. As I browsed, I thought about setting up a home server myself to remotely transfer some files and host a website. It would be much better than the Tencent Cloud server I purchased four years ago, as at least the bandwidth would be higher. As of last night, the entire setup was completed, and I organized the complete process to share on my public account.



Currently, home broadband still adopts the operator’s large internal network model, where the WAN network exit IP becomes a private network address, which hinders us from setting up a home server. Therefore, network adjustment is the first step we need to take.




First, the network exit must be a public network. To check whether our home broadband has a public IP, we must first look at the WAN port of our home broadband. Here, we must pay attention to whether the operator’s optical modem is in bridge mode or routing mode. If our own router’s connection mode is set to automatically obtain an address, then the optical modem must be in routing mode, and the WAN port address will be the address of our optical modem. If it is in dial-up mode, then the optical modem is in bridge mode, and the WAN port address will be the address of our own router, which is generally in routing mode. Finally, go to Baidu and search for an IP reflection address; if it matches, then the home broadband has a public address; otherwise, it needs to be modified.





Applying for a public IP is the first step. To simplify the future hassle of converting internal network to public network, the operator’s optical modem must be changed to bridge mode, and the home router must dial-up to access the internet, so we only need to deal with one layer of NAT.


The public IP applied for in the previous step is dynamic, and the operator will change our home public IP after a certain period. Thus, accessing via the public IP will not achieve the services we want.
The IP is dynamic, but once a domain name is applied, as long as the domain name resolution can reach our latest IP address, it will work. Therefore, utilizing dynamic domain name resolution can achieve this.
Now, applying for a domain name on Alibaba Cloud costs as low as 1 yuan for new users in the first year, and I applied for the cheapest domain name to test it for a year.
I initially planned to write a script to periodically check the public IP and modify the DNS resolution address. Later, I found that this had already been done by someone else, and the project is open-source and free to use.


ddns-go can automatically obtain public IPv4 or IPv6 and resolve it to the domain name,supports Mac, Windows, Linux systems,supports domain service providers such as Alibaba Cloud and Tencent Cloud,syncs every 5 minutes,supports multiple domain names simultaneously, andsupports multi-level domain names, which can be configured inthe web interface, making it simple and convenient.
Installation method: Download and unzip
https://github.com/jeessy2/ddns-go/releases, double-click to run, the program will automatically open http://localhost:9876, and modify the configuration.



After solving the domain name issue, we need to address the NAT port mapping. Since it is home broadband, the operator has blocked ports 80, 443, and 8080, so we must access using other port mappings.


My home broadband is Huawei AX3Pro, and only two ports are mapped here. By using a scanning tool to scan the IP, only these two ports respond.




Actually, by this step, our home server has been set up. We can set up any service we want. For example, we can set up a home cloud disk. SeaFile is a good open-source cloud disk tool, so let’s set up a cloud disk for personal use.

Download link, choose the 32-bit version to download
https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi
Install Python normally and configure the environment variable Path by adding the installation path incrementally (My Computer – Properties – Advanced System Settings – Advanced – Environment Variables).
SeaFile’s Windows installation package
Download link for Windows server version: http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.0.7_win32.tar.gz
Currently, the Windows version of SeaFile is no longer maintained, but it does not affect its use. Since my home server is Windows, I can only use the Windows version to set it up.
If it cannot be accessed after setup, please check whether the firewall is blocking ports 8000 and 8002.

To set up a home server, prepare an old computer to serve as the server. Then contact the operator to change the home broadband to a public IP. Register a domain name with a domain service provider, and use the open-source tool ddns-go to resolve the home public IP to the domain name resolution server. Subsequently, you can access the service via the domain name, ignoring the changing public IP.
Of course, on the home router, you must also do a good job of port mapping and avoid exposing too many ports of the home host to the public network. You can use port scanning tools to check.

The more mountains and rivers, the more you must strive to chase!
Written in – Huangwuping Road, Zhanggong District, Ganzhou City
April 17, 2022

Learning | Java Implementation of SSH Login to Execute Scripts
Learning | Common Knowledge Points of MyBatis
Learning | Configuration and Use of Spring Framework Timer
Trump | Goodbye, Weibo’s First Internet Celebrity

