linux:miwifi-shadowsocks
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux:miwifi-shadowsocks [2018/09/01 23:28] – created percy | linux:miwifi-shadowsocks [2019/03/09 01:35] (current) – percy | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== MiWifi with Shadowsocks ====== | ====== MiWifi with Shadowsocks ====== | ||
- | ====== | + | ===== / |
+ | |||
+ | <code BASH> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== / | ||
+ | |||
+ | vim / | ||
+ | |||
+ | <code Bash> | ||
+ | |||
+ | #!/bin/sh / | ||
+ | |||
+ | . / | ||
+ | |||
+ | START=95 | ||
+ | |||
+ | SS_REDIR_PID_FILE=/ | ||
+ | SS_TUNNEL_PID_FILE=/ | ||
+ | CONFIG=/ | ||
+ | DNS=8.8.8.8: | ||
+ | TUNNEL_PORT=5353 | ||
+ | |||
+ | start() { | ||
+ | # Client Mode | ||
+ | # | ||
+ | # Proxy Mode | ||
+ | service_start / | ||
+ | # Tunnel | ||
+ | service_start / | ||
+ | } | ||
+ | |||
+ | stop() { | ||
+ | # Client Mode | ||
+ | # | ||
+ | # Proxy Mode | ||
+ | service_stop / | ||
+ | # Tunnel | ||
+ | service_stop / | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code BASH> | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Everytime after the router restart, it will delete the script, so I put the script to / | ||
+ | chmod +x / | ||
+ | ln -s / | ||
+ | / | ||
+ | |||
+ | |||
+ | ==== To support kcptun with shadowsocks ==== | ||
+ | |||
+ | <code BASH> | ||
+ | CONFIG_KCPTUN=/ | ||
+ | # | ||
+ | CONFIG=$CONFIG_KCPTUN | ||
+ | DNS=8.8.8.8: | ||
+ | TUNNEL_PORT=5353 | ||
+ | |||
+ | start() { | ||
+ | # Client Mode | ||
+ | # | ||
+ | # Proxy Mode | ||
+ | | ||
+ | # Tunnel | ||
+ | | ||
+ | } | ||
+ | stop() { | ||
+ | # Client Mode | ||
+ | # | ||
+ | # Proxy Mode | ||
+ | | ||
+ | # Tunnel | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | And the shadowsocks-kcptun.json | ||
+ | <code Bash> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | And it will depends on the kcptun `cat / | ||
+ | <code Bash> | ||
+ | |||
+ | #!/bin/sh | ||
+ | |||
+ | cd / | ||
+ | echo ./ | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | ===== dnsmasq ===== | ||
+ | |||
+ | https:// | ||
+ | gfwlist2dnsmasq.sh -s gfwlist -o / | ||
+ | |||
+ | |||
+ | ===== gfwlist iptables ===== | ||
+ | |||
+ | <code BASH> | ||
+ | ipset -N gfwlist iphash | ||
+ | iptables -t nat -A PREROUTING -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-port 1081 | ||
+ | </ | ||
+ | |||
+ | ===== Restart all the service ===== | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | ===== ssh keys ===== | ||
+ | OpenWrt is not using ~/.ssh for the keys, and it use / | ||
+ | - https:// | ||
+ | - https:// | ||
+ | |||
+ | scp yourpubkey root@192.168.31.1:/ | ||
+ | cd / | ||
+ | cat / | ||
+ | chmod 0600 authorized_keys | ||
+ | |||
+ | Then in your local machine | ||
+ | vim ~/ | ||
+ | |||
+ | Add the ssh host config | ||
+ | < | ||
+ | Host miwifi.com 192.168.31.1 | ||
+ | IdentityFile ~/ | ||
+ | User root | ||
+ | </ | ||
+ | Then you can use the follow ssh command to login automatically | ||
+ | ssh root@192.168.31.1 | ||
+ | |||
+ | If you want to ssh to the other server in the OpenWRT, you can also add the config file, and use -F to set the ssh config file | ||
+ | ssh -F config username@yourserver | ||
+ | ===== Remote ssh forward ===== | ||
+ | |||
+ | sh / | ||
+ | ssh root@ef.pjq.me -p 32222 | ||
+ | <code Bash> | ||
+ | cat / | ||
+ | # | ||
+ | |||
+ | if [ $# = 2 ];then | ||
+ | localport=$1 | ||
+ | remoteport=$2 | ||
+ | echo ssh -gNfR ef.pjq.me: | ||
+ | ssh -F / | ||
+ | #echo autossh -f -M 2" | ||
+ | #autossh -f -M 2" | ||
+ | echo DONE, Now you can visit it via | ||
+ | echo http:// | ||
+ | else | ||
+ | cat << | ||
+ | Usage: | ||
+ | ./$0 localport remoteport | ||
+ | For example, forward the localhost port 80 to the remote server 8080 | ||
+ | ssh -gNfR ef.pjq.me: | ||
+ | Then, you can visit it via: http:// | ||
+ | EOF | ||
+ | |||
+ | fi | ||
+ | </ | ||
+ | |||
+ | ===== Reference | ||
-https:// | -https:// | ||
- http:// | - http:// | ||
- https:// | - https:// | ||
+ | - http:// | ||
/var/www/dokuwiki/wiki/data/attic/linux/miwifi-shadowsocks.1535815721.txt.gz · Last modified: 2018/09/01 23:28 by percy