Preparation
1.create a directory
mkdir -p /tmp/mnt/sda4/jffs/opt
2.mount the directory to /opt
mount -o bind /tmp/mnt/sda4/jffs/opt /opt
Install Entware/opkg
1.install it by the command below
wget -O - http://pkg.entware.net/binaries/armv7/installer/entware_install.sh | sh
2.The installation process may take a while. Please be patient until it's finished. Then confirm opkg has been installed correctly.
opkg --version
Install and configure SS
1.install SS
opkg install shadowsocks-libev-ss-redir
2.edit configuration file of SS
vi /opt/etc/shadowsocks.json
3.put content below to the file and replace the value of server and password
{
"server" : "1.1.1.1",
"server_port" : "443",
"local_address" : "0.0.0.0",
"local_port" : "1080",
"password":"password",
"timeout":600,
"method":"aes-256-cfb"
}
4.start SS
ss-redir -c /opt/etc/shadowsocks.json
Configure admin panel of the router
1.put the content below to Administration >> Scripts >> init
mount -o bind /tmp/mnt/sda4/jffs/opt /opt
/opt/etc/init.d/S22shadowsocks start
2.put the content below to Advanced >> DHCP/DNS >> DHCP / DNS Server (LAN) >> Dnsmasq
Custom configuration
conf-dir=/tmp/mnt/sda4/jffs/dnsmasq.d
3.create and edit /tmp/mnt/sda4/jffs/dnsmasq.d
file and sample file could be found here.
server=/google.com/208.67.222.222#443
ipset=/google.com/gfwlist
4.put the content below to Administration >> Scripts >> firewall
#!/bin/sh
insmod ip_set
insmod ip_set_bitmap_ip
insmod ip_set_bitmap_ipmac
insmod ip_set_bitmap_port
insmod ip_set_hash_ip
insmod ip_set_hash_ipport
insmod ip_set_hash_ipportip
insmod ip_set_hash_ipportnet
insmod ip_set_hash_net
insmod ip_set_hash_netport
insmod ip_set_list_set
insmod xt_set
ipset -N gfwlist iphash
iptables -t nat -A PREROUTING -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-port 1080
iptables -t nat -A OUTPUT -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-port 1080
5.Restart your router and test SS.
Reference