ASUSWRT
ASUSWRT
一、使用
1.1 SSHD
开启ssh访问:Administration > System > Enable SSH
# Password-based login will use the same username and password as telnet/web access.
# ssh <user>@<router>
1.2 Scheduled tasks (cron jobs)
You can create scheduled tasks using the standard crond service that runs on the router. You can put your cron tasks in /var/spool/cron/crontabs/. The file must be named "admin" as this is the name of the system user. Note that this location resides in RAM, so you would have to put your cron script somewhere such as in the jffs partition, and at boot time copy it to /var/spool/cron/crontabs/ using an init-start user script.
A simple way to manage your cron jobs is through the included "cru" command. Just run "cru" to see the usage information. You can then put your "cru" commands inside a user script to re-generate your cron jobs at boot time.
1.3 Mounting remote CIFS shares
You can mount remote SMB shares on your router. The syntax will be something like this:
mount \\\\192.168.1.100\\ShareName /cifs1 -t cifs -o "username=User,password=Pass" -o vers=2.0
(backslashes must be doubled.)
1.4 DNS Director
DNS Director (originally called DNSFilter, not to be confused with the company bearing the same name) is a feature that allows you to force specific devices on your network to use specific nameservers (DNS). This can be done globally, or on a per device basis. Each of them can have a different nameserver enforced. For example, you can have your LAN use Quad9's server to provide basic filtering of malicious sites, but force your children's devices to use CleanBrowsing's family server that filters out both malicious and adult content.
https://github.com/RMerl/asuswrt-merlin.ng/wiki/DNS-Director
1.5 DNS Privacy
https://github.com/RMerl/asuswrt-merlin.ng/wiki/DNS-Privacy
1.6 VPN Director
VPN Director lets you create rules to determine how your LAN traffic is redirected through your OpenVPN and WireGuard clients. You can create rules based on their local or remote IP (or even both). Subnets in CIDR notation (i.e. 192.168.50.0/24) can also be used to cover IP ranges.
二、编译官方/梅林固件
2.1 环境准备
系统为ubuntu-20.04.6
# Install latest packages
apt-get -y dist-upgrade && \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get -y --no-install-recommends \
install lib32ncurses-dev dos2unix libtool-bin cmake libproxy-dev \
uuid-dev liblzo2-dev autoconf automake bash bison bzip2 diffutils \
file flex m4 g++ gawk groff-base libncurses5-dev libtool libslang2 \
make patch perl pkg-config shtool subversion tar texinfo zlib1g \
zlib1g-dev git gettext libexpat1-dev libssl-dev cvs gperf unzip \
python2 libxml-parser-perl gcc-multilib libxml2-dev g++-multilib \
gitk libncurses5 mtd-utils libvorbis-dev autopoint autogen sed \
build-essential intltool libglib2.0-dev xutils-dev \
lib32z1-dev lib32stdc++6 xsltproc gtk-doc-tools libelf-dev:i386 \
libelf1:i386 libltdl-dev openssh-server curl nano lzip patchelf \
automake gosu bc rsync sudo xxd python-is-python2 autoconf-archive
# Clean up env
apt -y autoremove && \
apt -y autoclean && \
rm -Rf /var/cache/apt/archives/* && \
# Set bash as default shell
ln -s bash /bin/sh.bash && \
mv /bin/sh.bash /bin/sh && \
2.2 下载源码
cd $HOME
git clone https://github.com/RMerl/am-toolchains
git clone https://github.com/RMerl/asuswrt-merlin.ng
mkdir amng-build
rsync -a --del asuswrt-merlin.ng/ amng-build
2.3 设置工具链变量
# Broadcom HND ARM platform (RT-AC86U, GT-AC2900):
sudo ln -s ~/am-toolchains/brcm-arm-hnd /opt/toolchains
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib" >> ~/.profile
echo "export TOOLCHAIN_BASE=/opt/toolchains" >> ~/.profile
echo "PATH=\$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin" >> ~/.profile
echo "PATH=\$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin" >> ~/.profile
sudo ln -sf ~/am-toolchains/brcm-arm-hnd /opt/toolchains
export LD_LIBRARY_PATH=$LD_LIBRARY:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib
export TOOLCHAIN_BASE=/opt/toolchains
export PATH=$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
export PATH=$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
# Broadcom HND AX ARM platform (RT-AX56U, RT-AX58U, RT-AX86U, RT-AX88U, GT-AX11000, RT-AX68U):
sudo ln -s ~/am-toolchains/brcm-arm-hnd /opt/toolchains
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY:/opt/toolchains/crosstools-arm-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/lib" >> ~/.profile
echo "export TOOLCHAIN_BASE=/opt/toolchains" >> ~/.profile
echo "PATH=\$PATH:/opt/toolchains/crosstools-arm-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/bin" >> ~/.profile
echo "PATH=\$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/bin" >> ~/.profile
sudo ln -sf ~/am-toolchains/brcm-arm-hnd /opt/toolchains
export LD_LIBRARY_PATH=$LD_LIBRARY:/opt/toolchains/crosstools-arm-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/lib
export TOOLCHAIN_BASE=/opt/toolchains
export PATH=$PATH:/opt/toolchains/crosstools-arm-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/bin
export PATH=$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/bin
# Broadcom SDK6/SDK7 ARM platform (RT-AC68U, RT-AC88U, RT-AC3100, RT-AC5300):
sudo ln -s ~/am-toolchains/brcm-arm-sdk/hndtools-arm-linux-2.6.36-uclibc-4.5.3 /opt/brcm-arm
ln -s ~/am-toolchains/brcm-arm-sdk ~/amng-build/release/src-rt-6.x.4708/toolchains
echo "PATH=\$PATH:/opt/brcm-arm/bin" >> ~/.profile
sudo ln -sf ~/am-toolchains/brcm-arm-sdk/hndtools-arm-linux-2.6.36-uclibc-4.5.3 /opt/brcm-arm
ln -sf ~/am-toolchains/brcm-arm-sdk /build/release/src-rt-6.x.4708/toolchains
export LD_LIBRARY_PATH=$LD_LIBRARY:/opt/brcm-arm/lib
export PATH=$PATH:/opt/brcm-arm/bin
2.4 开始编译
# RT-AC68U firmware
cd ~/amng-build/release/src-rt-6.x.4708
make rt-ac68u
# RT-AC88U firmware
cd ~/amng-build/release/src-rt-7.14.114.x/src
make rt-ac88u
# RT-AC3100 firmware
cd ~/amng-build/release/src-rt-7.14.114.x/src
make rt-ac3100
# RT-AC5300 firmware
cd ~/amng-build/release/src-rt-7.14.114.x/src
make rt-ac5300
# RT-AC86U firmware
cd ~/amng-build/release/src-rt-5.02hnd
make rt-ac86u
# RT-AX56U firmware
cd ~/amng-build/release/src-rt-5.02axhnd.675x
make rt-ax56u
# RT-AX58U firmware
cd ~/amng-build/release/src-rt-5.02axhnd.675x
make rt-ax58u
# RT-AX86U firmware
cd ~/amng-build/release/src-rt-5.02L.07p2axhnd
make rt-ax86u
# RT-AX88U firmware
cd ~/amng-build/release/src-rt-5.02axhnd
make rt-ax88u
# GT-AC2900 firmware
cd ~/amng-build/release/src-rt-5.02hnd
make gt-ac2900
# GT-AX11000 firmware
cd ~/amng-build/release/src-rt-5.02axhnd
make gt-ax11000
# RT-AX68U firmware
cd ~/amng-build/release/src-rt-5.02L.07p2axhnd
make rt-ax68u