openwrt on wndr4300

So I want to install OpenWrt on Netgear WNDR4300.

Currently, stable release is 18.06.1 which is merged with LEDE.

After days of trial, I stick to 17.01.4 which can run ssr and other cool packages.

1 Prep

If the device can run a shell, gather device info by these commands.

1
2
3
ssh user@router.ip
uname -a
cat /proc/cpuinfo

2 Image Release

It's recommanded to read start guide first, then download the appropriate image file.

First-time installation on a device, or flashing openwrt firmware, choose the factory install wndr4300 image.1

1
2
3
tftp 192.168.1.1
binary
put lede-17.01.4-ar71xx-nand-wndr4300-ubi-factory.img

Sysupgrading an existing openwrt device on it's web admin GUI, choose wndr4300 system upgrade file. Compileing package with corresponding openwrt device's SDK file, choose ar71xx SDK.

3 Signal Strength

  • Choose Country as US, which has unlimited Transmit Power.
  • Operating frequency is another key parameter, relay radio will inherit the BSSID's mode, channel and width.
  • Frequency Width may halve and will cause channel's Bitrate halving too.
  • 2.4GHz – 20/40MHz, 5GHz – 20/40/80MHz

4 Packages

On openwrt 18.06.1, wndr4300 only has 13.71MB space to install packages, on LEDE 17.01.4, only has 13.9MB space.

1
opkg update

4.1 usb storage

1
2
3
4
5
6
7
opkg update
opkg install kmod-fs-ext4 kmod-fs-btrfs block-mount kmod-usb-storage blkid hd-idle
### samba can install in 18.06.1
opkg install luci-app-samba
### There's an error in 17.01.4, but still works
/etc/init.d/samba enable
/etc/init.d/samba restart

4.2 koolproxy

1
2
cat /proc/cpuinfo
opkg install --force-depends http://firmware.koolshare.cn/binary/KoolProxy/ar71xx/koolproxy_3.7.2-20180127_mips_24kc.ipk

koolproxy may cause http website unavailable.

4.3 frp

1
2
scp frpc.tar.xz root@192.168.1.1:/root
ln -s /tmp/frpc /usr/bin/frpc

Add to startup, or /etc/init.d/frpc, or /etc/rc.common, or /etc/rc.local

1
2
tar -xJf /root/frpc.tar.xz -C /tmp
frpc -c /root/frpc.ini &

Remember to write this conf file, or sleep 10 seconds before start frpc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[common]
server_addr = vps_ip
server_port = vps_port
token = password
login_fail_exit = false
log_file = /tmp/frpc.log

[lede]
type = http
local_port = 80
subdomain = lede

[aria2]
type = http
local_port = 6800
subdomain = aria2

4.4 shadowsocksR

1
2
3
4
5
6
scp ~/Downloads/luci-app-shaodwsocksR*_all.ipk root@192.168.1.1:/tmp/
opkg update
opkg remove dnsmasq
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.o
mv /etc/config/dhcp /etc/config/dncp.o
opkg install luci-app-shadowsocksR-GFW_1.2.1_all.ipk

If dnsmasq running but not working, check /etc/config/network.

1
2
3
config interface 'wan'
option proto 'dhcp'
option ifname 'eth0'

If GFW not working, add a line to /etc/dnsmasq.conf

1
2
echo conf-dir=/etc/dnsmasq.ssr >> /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart

/etc/china_ssr.txt /etc/dnsmasq.ssr/gfw_list.conf

4.5 aria2

1
2
3
4
opkg update
opkg install aria2_1.34.0-1_mips_24kc.ipk
opkg install luci-app-aria2
aria2c --conf-path=/home/aria2/aria2.conf -D
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
quiet=true
continue=true
input-file=/home/aria2/aria2.session
save-session=/home/aria2/aria2.session
dht-file-path=/home/aria2/dht.dat
log=/home/aria2/aria2.log
file-allocation=prealloc
bt-enable-lpd=true
enable-dht=true
rpc-listen-port=6800
dir=/home/tmp/inbox
disk-cache=4M
max-overall-download-limit=0
max-overall-upload-limit=90K
max-concurrent-downloads=3
max-connection-per-server=5
min-split-size=20M
split=5
save-session-interval=30
follow-torrent=true
listen-port=6881-6999
bt-max-peers=55
user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
rpc-secret=yourtoken
log-level=error
check-certificate=false
lowest-speed-limit=0

5 Compile with SDK

5.1 prepare

  • Choose Ubuntu 16.04 x64 to compile

    1
    sudo apt-get install gawk libncurses5-dev libz-dev zlib1g-dev git ccache
  • Download corresponding SDK

    1
    2
    3
    4
    5
    6
    7
    8
    9
    wget https://archive.openwrt.org/releases/17.01.4/targets/ar71xx/nand/lede-sdk-17.01.4-ar71xx-nand_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz
    xd -d lede-sdk-17.01.4-ar71xx-nand_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz
    tar -xf lede-sdk-17.01.4-ar71xx-nand_gcc-5.4.0_musl-1.1.16.Linux-x86_64

    cd OpenWrt-SDK-*
    ### Update packages, may not necessary.
    ./scripts/feeds update
    ./scripts/feeds update packages base luci routing telephony
    ./scripts/feeds install libpcre zlib libopenssl

5.2 shadowsocksR-libev for OpenWrt2

1
2
3
4
5
6
7
8
9
10
11
12
git clone https://github.com/ywb94/openwrt-ssr.git package/openwrt-ssr
### Choose in menu
# luci ->3. Applications-> luci-app-shadowsocksR origin ver
# luci ->3. Applications-> luci-app-shadowsocksR-GFW GFWList ver
make menuconfig
pushd package/openwrt-ssr/tools/po2lmo
make && sudo make install
popd
# po2lmo ./package/openwrt-ssr/files/luci/i18n/shadowsocksr.zh-cn.po ./package/openwrt-ssr/files/luci/i18n/shadowsocksr.zh-cn.lmo

make package/openwrt-ssr/compile V=99
ls bin/packages/mips_24kc/base/

5.3 aria2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
### Openwrt official aria2 package is outdated, so install another compiled version.
opkg install aria2
### compile own ipk
cd openwrt/lede*
export LC_ALL="en_US.UTF-8"
./scripts/feeds install aria2
vi package/feeds/packages/aria2/Makefile
cp package/feeds/packages/aria2/Makefile aria2.makefile
### change PKG_VERSION to 1.34.0, and md5 to 2c21fb1b154f828ae179b03fd368c42d
make menuconfig
### Network -> File Transfers -> aria2 configuration,
### Select magnet, bit torrent... or vi .config
CONFIG_PACKAGE_aria2=y
#
# Aria2 Configuration
#
CONFIG_ARIA2_OPENSSL=y
# CONFIG_ARIA2_GNUTLS is not set
# CONFIG_ARIA2_NOSSL is not set
CONFIG_ARIA2_BITTORRENT=y
# CONFIG_ARIA2_SFTP is not set
# CONFIG_ARIA2_ASYNC_DNS is not set
# CONFIG_ARIA2_COOKIE is not set
CONFIG_ARIA2_METALINK=y
CONFIG_ARIA2_LIBXML2=y

make package/aria2/download -j8 V=s
make package/aria2/prepare -j8 V=s
make package/aria2/compile -j8 V=s
ls bin/packages/mips_24kc/packages/
mv bin/packages/mips_24kc/packages/aria2_1.34.0-1_mips_24kc.ipk ~/
scp eula.edu:aria2_1.34.0-1_mips_24kc.ipk ./
scp ./aria2_1.34.0-1_mips_24kc.ipk root@192.168.1.1:/tmp/