Pages

Friday, 30 November 2018

路由器上的ss程序:shadowsocks-tiny

shadowsocks for router.

What

This is a tiny shadowsocks client for router(OpenWrt).

Install

Pre-compiled .ipk packages can be found in bin directory of the shadowsocks-tiny source code. Subdirectory AA is for Attitude Adjustment(12.09), subdirectory current is for latest OpenWrt release(which uses procd). If you can’t find the package for your router’s architecture, you need to compile it by yourself(and if you successfully compiled and tested it works, please send the .ipk to me, so I can include it here).
  • Compile from SDK
    There is a help page about using the SDK: http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk
    Shadowsocks-tiny depends on libopenssl. If libopenssl has not been installed on your router, you have to install libopenssl first. Usually you only need to run following command on your router to install libopenssl:
    opkg install libopenssl
        
    Packages are under packages directory of the shadowsocks-tiny source code. ./packages/shadowsocks-client-AAis for Attitude Adjustment(12.09), and ./packages/shadowsocks-client is for latest OpenWrt(which uses procd). Actually the only difference of these two packages is the init script. Select the right package for your SDK, and copy it to packages directory of your SDK, then compile.
  • Compile from OpenWrt souce
    You can add shadowsocks-client from packages feed:
    ./scripts/feeds update packages
    ./scripts/feeds install shadowsocks-client
        
    Then select shadowsocks-client from make menuconfig and compile.

Config

Shadowsocks-client uses uci as its configuration method. You have to edit /etc/config/sslocal to meet your needs.
Hint: server_addr and server_port is your shadowsocks server’s listening address and port. local_addr is your router’s address(e.g. 192.168.X.X) and local_port is the port number you want your router to listen.
After editing /etc/config/sslocal, run /etc/init.d/sslocal start to execute sslocal, and use logread to see if it works. Normally it will show:
Wed Jul 16 03:17:28 2014 daemon.notice sslocal: server address: XXX.XXX.XXX.XXX:XXXXX(tcp)
Wed Jul 16 03:17:28 2014 daemon.notice sslocal: listening address: XXX.XXX.XXX.XXX:XXXXX(tcp)
If all seem okay, run /etc/init.d/sslocal enable to let shadowsocks-client automatically starts when your router boots.
  • Host setting
    Set your browser or program to use socks5 proxy, and put local_addr and local_port as the socks5 server’s addresss and port number.

Note

Although shadowsocks-tiny has a server side program, it’s mainly for test purpose and doesn’t scale well. You can find other fancy server side programs of shadowsocks from https://github.com/clowwindy/shadowsocks/wiki/Ports-and-Clients
from https://github.com/zhao-gang/shadowsocks-tiny

No comments:

Post a Comment