K7

K7Blog

须知少年凌云志 曾许人间第一流.
proton
telegram

Newbie's All In One System Open WRT and Open Clash Diary - Pitfalls

Preface:#

To be honest, I have bought quite a few computers and electronic products in recent years. In 2019, I bought a gaming laptop and a second-hand office laptop. In 2020, I assembled my first desktop computer and followed someone else's tutorial to build a computer for only 100 yuan. I also bought a second-hand MacBook Pro 19 with the lowest configuration (I saw a video with the Touch Bar displaying lyrics and bought it on impulse). At the end of the year, I bought a MacBook Pro with the lowest configuration and an M1 chip. In 2021, I bought a Redmi lightweight laptop (I thought it was Xiaomi at the time). In 2022, I bought a MacBook Pro with an M1 Pro chip and a desktop computer with an i5-12600KF and 3070TI. In 2023, I bought another desktop computer for playing games and simple office use. In 2024, I got a mini PC called Jimo Ke K6.

v2-1b8b40d8ec01a9cd8fc829ae83f6973a_720w

During this period, I watched videos by Sibotu and bought a mini PC to run Hackintosh. I also bought a Raspberry Pi and moved houses multiple times, so I have several routers. I also have some mouse, keyboard, and other accessories, such as mouse pads, cooling brackets, headphones, hard drives, external hard drive enclosures, and monitors, etc.

Currently, I still have some remaining accessories, including the desktop computers from 2020, 2022, and 2023, the MacBook Pro with an M1 Pro chip, the mini PC I bought from Sibotu, Raspberry Pi, and the Jimo Ke K6 mini PC I bought this year. I plan to use this mini PC as a software router (already successful) and use PVE system as the front-end. I have installed Ubuntu on it for tinkering, so I don't have to open virtual machines for billing and timing.

Notes on Getting Started:#

I don't know why, but one day I suddenly had the idea of buying a mini PC to tinker with (maybe because I've been too idle recently and feel uncomfortable without tinkering). So I compared the parameters and prices of various mini PCs and chose the Jimo Ke K6 with 32GB RAM and a 500GB hard drive because it's better to have more RAM for running virtual machines, and I don't even use up 16GB in normal use.

First of all, there are more tutorials about mini PCs on Bilibili. Here, I saw a video series on building an All-In-One system:

The three video tutorials are quite detailed, from installing the PVE system to installing OpenWRT, Windows, Ubuntu, Mac, and Synology NAS, as well as optimizing the PVE system. The pace is also relatively fast, and you can learn it by following the operations once. The OpenWRT image provided by the uploader contains many plugins, including the Open Clash plugin that we need.

On YouTube, you can learn how to configure Open Clash from Bu Liang Lin:

If you ask me why bother tinkering with a software router for bypassing the Great Firewall when there are proxy software like Clash for Windows and V2rayN available, I couldn't understand it at first either. But when I finished configuring the entire router and connected my phone and computer to the network, I felt a sense of freedom when I used Google for daily operations and watched YouTube videos. Recently, I came across a sentence that resonated with me: "If you cannot use this project normally, it is likely because of IP issues or you cannot access the internet freely." (https://github.com/nashsu/FreeAskInternet)

Pitfalls:#

First of all, regarding OpenWRT, according to the Bilibili video mentioned above, when installing the PVE system, you will choose a network port. For example, if I have two network ports, I will configure network port 1 for the PVE system and set the gateway to 192.168.22.1 (the IP of OpenWRT). Then, when installing the OpenWRT system, the IP of OpenWRT will be set to 192.168.22.1. At this point, one end of the network cable is connected to the computer and the other end is connected to network port 1 of the mini PC. After installing OpenWRT, the other network port needs to be connected to the router or modem to access the internet. You will find that everything works fine, but if you restart the mini PC, you will find that you cannot access the internet and the local IP is not assigned. In this case, you just need to swap the two network cables to solve the problem. I don't know why this problem occurs.

Another issue is with installing Windows. Maybe I didn't optimize it, but after installing Windows 10, the CPU usage is around 10-30% when idle. As for Ubuntu, when installing it, you can choose the minimal installation and add some features. There will be an option to update Ubuntu below, and if you check it, the system will update and prompt you to restart. However, you will find that the system gets stuck at that point.

I couldn't control the shutdown and pause functions of PVE's console, so I had to forcefully cut off the power.

Configuring Open Clash for Specific Devices to Use Global Proxy#

If you follow Bu Liang Lin's video configuration, it should look like this by default:

Snipaste_2024-04-21_16-56-35

In mixed mode, the proxy mode follows the rules. For devices like my desktop computer and phone, whether playing games or watching Douyin, they need to have direct access to domestic websites. When I tinker with my Mac computer, I use global proxy, which makes some websites or IPs load faster. However, the rules won't be applied in these cases, and adding them one by one is troublesome. If you have a similar scenario like mine, where some devices follow the rules and some devices need global proxy, you can directly add the following code under "rules:" in the Custom Rules section of the Override Settings - Rule Settings:

- SRC-IP-CIDR,192.168.22.168/32,GLOBAL
- SRC-IP-CIDR,192.168.22.181/32,GLOBAL
- SRC-IP-CIDR,192.168.22.226/32,GLOBAL

Snipaste_2024-04-21_17-02-04

Modify the IP addresses to match your devices, and then scroll to the bottom and click "Apply Configuration." Don't change the "/32" at the end. For example, if you modify it to 1, 2, or 3, it will still work, but all devices under the gateway will have global proxy. I'm not sure why it's "/32," but I only know that it works this way.

By default, the DHCP lease is set to 12 hours. I'm not sure if it will assign different IPs after expiration, but you can directly bind a fixed IP to the MAC address:

Snipaste_2024-04-21_17-06-38

Summary:#

First, install OpenWRT in the PVE system. You may encounter a situation where the PVE system has no network. In that case, I changed the DNS server to the IP of OpenWRT, and then there was no problem. Then, there is the issue with the network ports. Originally, you set network port 1 for scientific internet access and network port 2 for internet access. However, after restarting, the two network ports are swapped. There is also the issue with installing Ubuntu. If you choose to update the system during installation, it will get stuck. As for the performance consumption of Windows 10, it is relatively high. I saw some optimization options for Ubuntu in VM software, which may also be applicable to the PVE system. I will study it when I have time.

Let me share my network setup. It's best to have network cables of different colors so that you know what each color is used for. First, I use one network cable to connect the mini PC to the modem to provide network access. Then, I use another network cable to connect the mini PC to the router. The router is set to repeater mode so that both Wi-Fi and devices connected to the router's network port will be assigned IPs and gateways by OpenWRT. The network traffic will go through OpenWRT. Finally, I connect my PC and laptop to the router with network cables to achieve scientific internet access. If someone who understands this aspect has read my article, could you please tell me if my mini PC is acting as a software router or a bypass router?

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.