In this article, we will take a look at Openwrt based on Raspberry Pi 4B. Openwrt is a famous router management system. It is used by many manufacturers due to its open source and third-party compilation advantages.
I happened to have a Raspberry Pi 4B on hand, and I flashed Openwrt to do soft routing. At the same time, try to add various plugins to it.
Accessories Preparation
Raspberry Pi 4B development board 32G memory card one network cable
Select firmware
Here I am using Lean's Raspberry Pi openwrt firmware.
Author's project address: https://github.com/coolsnowwolf/openwrt
Flash firmware
Open the tool win32, select the firmware and disk location as follows, click Write
After the write is successful, insert the card into the Raspberry Pi. Start the Raspberry Pi.
Login the background
Connect the Raspberry Pi's network port to your computer with a network cable, and then enter 192.168.1.1 in the browser. If the connection is fine, it will jump directly to the openwrt background interface.
Default username: root
Default login password: password
Add interface
Add a wan port, the protocol is DHCP client, check the Ethernet adapter eth0 in the physical settings
The Advantages of Openwrt
The difference between openwrt and other firmware is that it can install many plug-ins. Such as advertising blocking, cloud disk download acceleration, etc.
Network storage
Of course, we can also use Nginx and PHP environments on the router. In other words, we can build the router into a small server.
Configure ssh
Why can’t you log in to ssh for your own things? Many router firmware cannot be logged in with ssh, while openwrt is very simple.
Configure ssh
Log in ssh
Build a blog
Modify nginx configuration file
user root root;
worker_processes 1;
pid /var/run/nginx_kodexplorer.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
sendfile on;
keepalive_timeout 65;
server {
listen 8081;
server_name localhost;
location/{
root /mnt/www/;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location=/50x.html {
root html;
}
location ~ \.php$ {
root /mnt/www/;
try_files $uri=404; # PHP file does not exist and returns 404
fastcgi_pass unix:/var/run/php7-fpm.sock; # Execute PHP through Unix sockets
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Fix Nginx fastcgi vulnerability
include /etc/nginx/fastcgi_params;
}
}
}
Test probe file
Installing typecho
In this way, an inconspicuous router is built into a server.
Recommended Comments