OpenWrt是基于Linux的路由器固件,允许用户安装和运行应用程序来满足用户的需求。本文介绍了路由器刷入OpenWRT后的一些初始化操作

初始化

改拨号

1
2
删除原有WAN_6,否则无ipv6地址
直接改DHCP为PPPoE

改主题:

1
opkg install luci-theme-material

改语言:

1
opkg install luci-i18n-base-zh-cn

upnp支持:

1
opkg install luci-app-upnp

WOL支持,注意关闭快速启动:

1
opkg install luci-app-wol etherwake

在Firewall - Port Forwards 里设置端口映射或者端口转发

zerotier支持

安装:

1
2
opkg install zerotier
nano /etc/config/zerotier

改配置

1
2
option enabled '1'
list join 'd5e5fb6537ebc5f5'

运行命令完成配置

1
2
/etc/init.d/zerotier enable
/etc/init.d/zerotier start

下面的文件服务器和Python脚本不建议mips使用,tinyproxy不建议小内存使用

luci显示挂载点:

1
opkg install block-mount

查看文件夹大小

1
du -h -d 1

寻找进程:

1
pgrep -f aria2

查看端口占用:

1
netstat -lnp|awk 'BEGIN{prt=":2222$"}{if ($4 ~ prt) print $0}'

寻找aria2c

1
find ./ -name aria2c

设置uhttpd

1
2
3
4
5
6
nano /etc/config/uhttpd
config uhttpd 'webset'
list listen_http '0.0.0.0:80'
option home 'mnt/sda4/www/sean'
option rfc1918_filter 1
/etc/init.d/uhttpd restart

管理界面: 192.168.1.1:8888
AriaNg: 192.168.1.1:8887
pi-dash: 192.168.1.1:8889
Webset: 0.0.0.0:80

挂载USB,首先将U盘使用Diskgen格式化为EXT4

1
2
3
4
5
6
7
8
9
10
11
12
opkg update
opkg install kmod-usb-storage
ls -l /dev/sd*
block info | grep "/dev/sd"
\\回显/dev/sda1: UUID="2eb39413-83a4-4bae-b148-34fb03a94e89" VERSION="1.0" TYPE="ext4"就成功了

opkg install e2fsprogs
opkg install kmod-fs-ext4
mkfs.ext4 /dev/sda1
block detect > /etc/config/fstab
uci set fstab.@mount[0].enabled='1'
uci commit

开启ftp

1
opkg install vsftpd

安装到U盘

1
2
nano /etc/opkg.conf 添加dest usb /mnt/sda4
opkg install XXX -d usb

安装Python3

1
2
3
4
5
6
7
8
9
10
opkg install python3-base -d usb
opkg install python3-pip -d usb
opkg install python3 -d usb
opkg install gcc make -d usb
opkg install screen
nano /etc/profile
export PATH=/mnt/sda4/usr/bin
export C_INCLUDE_PATH="/mnt/sda4/usr/include"
export LD_LIBRARY_PATH="/mnt/sda4/usr/lib"
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

配制aira2

1
2
3
4
5
aria2c --conf-path=/mnt/sda4/etc/config/aria2.conf -D
config uhttpd 'AriaNg'
list listen_http '192.168.1.1:8889'
option home 'mnt/sda4/www/AriaNg'
option index_page index.php 改为0

pyngrok代理

1
/mnt/sda4/app/pyngrok/demo/sunny.py 153941140150

库相关

USB打印机

1
2
3
4
5
6
7
opkg install luci-app-p910nd
Configuring p910nd.
Configuring luci-compat.
Configuring luci-app-p910nd.

opkg install kmod-usb-printer
Configuring kmod-usb-printer.

WOL

1
2
3
4
5
6
7
8
opkg install luci-app-wol etherwake
Installing luci-app-wol (git-21.163.62608-7d7df07) to root...
Downloading https://downloads.openwrt.org/releases/21.02.1/packages/mipsel_24kc/luci/luci-app-wol_git-21.163.62608-7d7df07_all.ipk
Installing etherwake (1.09-5) to root...
Downloading https://downloads.openwrt.org/releases/21.02.1/packages/mipsel_24kc/packages/etherwake_1.09-5_mipsel_24kc.ipk
Package etherwake (1.09-5) installed in root is up to date.
Configuring etherwake.
Configuring luci-app-wol.

相关链接

Table of Hardware:OpenWRT官方支持硬件列表
小婉儿数码:有小米系的OpenWRT固件