Updated at: 2024-02-07
Download the 23.05.2
version of OpenWRT on your computer according to the specifics of your device, for instance, I am using macOS.
Different versions of OpenWRT may vary greatly; it's recommended to use the version that I am using.
curl -o openwrt.img.gz https://downloads.openwrt.org/releases/23.05.2/targets/x86/64/openwrt-23.05.2-x86-64-generic-ext4-combined-efi.img.gz
First, create an Ubuntu bootable USB drive, insert the OpenWRT device and boot from the USB drive
Connect the computer and the router with an Ethernet cable, and change their IPs to the same subnet. Then copy the openwrt.img.gz file from the computer to the router
scp xxx@xxx:/path/to/openwrt.img.gz ./
Check the router's hard drive
lsblk
Write to the hard drive with root user
gunzip -c openwrt.img.gz | dd of=/dev/sda bs=4M
Shutdown, disconnect the Ethernet cable, remove the USB drive, and boot.
uci set network.lan.ipaddr=192.168.2.1
uci commit
Remove serial console
vim /boot/grub/grub.cfg
Remove this, otherwise, the startup will be slow
console=ttyS0,115200n8
Reboot or Power off then boot
Change the IP of the computer to the same subnet as the router, then visit http://192.168.2.1. If the router has multiple ports, try each one until you find the one that grants access.
If you haven't obtained IPv6 PD here, and if your modem also has routing capabilities, then it needs to support issuing PD. Otherwise, allow OpenWRT to dial in to obtain PD. If not, please contact your ISP and say no to all non-Native solutions like Relay, NAT6, etc.
Unplug and re-plug the computer's network cable at this time to automatically acquire an IP, which should be a GUA, and the DNS should also be a GUA. If a ULA is still obtained at this point, it should disappear after the next router reboot
brook dnsclient -d http3.ooo -t A -s 192.168.2.1:53
brook dnsclient -d http3.ooo -t AAAA -s 192.168.2.1:53
brook dnsclient -d http3.ooo -t A -s [xxx]:53
brook dnsclient -d http3.ooo -t AAAA -s [xxx]:53
brook echoclient -s 137.184.237.95:7777
brook echoclient -s [2604:a880:4:1d0::4cf:b000]:7777
opkg update
opkg install parted losetup resize2fs
wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
. ./expand-root.sh
Reboot
brook dnsclient -d http3.ooo -t A -s 127.0.0.1:53
brook dnsclient -d http3.ooo -t AAAA -s 127.0.0.1:53
brook dnsclient -d http3.ooo -t A -s [::1]:53
brook dnsclient -d http3.ooo -t AAAA -s [::1]:53
brook echoclient -s 137.184.237.95:7777
brook echoclient -s [2604:a880:4:1d0::4cf:b000]:7777
Test your Brook Server
brook testbrook --link 'brook://...'
Brook.ipk will use :9999, 127.0.0.1:8888, [::1]:8888, 127.0.0.1:5353
Then open dashboard http://192.168.2.1:9999
Check the two DNS servers allocated on your computer; one should be IPv4 and the other IPv6
brook dnsclient -d http3.ooo -t A -s 192.168.2.1:53
brook dnsclient -d http3.ooo -t AAAA -s 192.168.2.1:53
brook dnsclient -d http3.ooo -t A -s [xxx]:53
brook dnsclient -d http3.ooo -t AAAA -s [xxx]:53
Test IPv4 and IPv6, as well as TCP and UDP, of course, your Brook Server should support dual-stack
brook echoclient -s 137.184.237.95:7777
brook echoclient -s [2604:a880:4:1d0::4cf:b000]:7777