概述
我的寝室里有很多设备都需要正确上网,如果我一个一个去配置寝室里的机器让他们正确上网,这太麻烦了,要写ip写加密方式写....所以有没有一个方便的方式来让我正确的上网呢?有,我只需要让我的树莓派可以正确上网就可以啦,之后我所有的设备都通过树莓派来正确上网,那么怎么做呢
操作
首先我们要给树莓派安装python
怎么安装看下面
fedora安装pyenv实现python的版本管理
安装好python之后要安装shadowsocks客户端
pip install shadowsocks
之后配置shadowsocks客户端
新建一个配置文件
touch conf.json
编辑它
vim conf.json
输入下面内容
{
"server":"你的主机",
"server_port":8989,
"local_address":"0.0.0.0",
"local_port":4396,
"password":"密码",
"timeout":300,
"method":"rc4-md5",
}
注意local_address要0.0.0.0
之后创建一个会话
screen -S shadowsocks
运行sslocal
� shadowsocks sslocal -c conf.json
INFO: loading config from conf.json
2017-11-04 13:17:42 WARNING warning: local set to listen on 0.0.0.0, it's not safe
2017-11-04 13:17:42 INFO loading libcrypto from libcrypto.so.1.0.0
2017-11-04 13:17:42 INFO starting local at 0.0.0.0:4396
之后做个测试看看而不可以连接
把浏览器中的socks5代理插件ip改为你的树莓派ip,端口是4396
为什么端口是4396,致敬厂长
一般来说没问题,可以代理成功的
� shadowsocks sslocal -c conf.json
INFO: loading config from conf.json
2017-11-04 13:17:42 WARNING warning: local set to listen on 0.0.0.0, it's not safe
2017-11-04 13:17:42 INFO loading libcrypto from libcrypto.so.1.0.0
2017-11-04 13:17:42 INFO starting local at 0.0.0.0:4396
2017-11-04 13:18:54 INFO connecting www.google.co.jp:443 from 192.168.1.108:58698
2017-11-04 13:18:54 INFO connecting www.google.co.jp:443 from 192.168.1.108:58700
2017-11-04 13:18:55 INFO connecting www.google.co.jp:443 from 192.168.1.108:58702
2017-11-04 13:18:56 INFO connecting google.com:80 from 192.168.1.108:58704
2017-11-04 13:18:56 INFO connecting google.com:80 from 192.168.1.108:58706
2017-11-04 13:18:56 INFO connecting apis.google.com:443 from 192.168.1.108:58708
2017-11-04 13:18:56 INFO connecting clients5.google.com:443 from 192.168.1.108:58710
2017-11-04 13:18:56 INFO connecting lh3.googleusercontent.com:443 from 192.168.1.108:58712
2017-11-04 13:18:57 INFO connecting notifications.google.com:443 from 192.168.1.108:58714
2017-11-04 13:18:57 INFO connecting ogs.google.com:443 from 192.168.1.108:58716
2017-11-04 13:18:57 INFO connecting ssl.gstatic.com:443 from 192.168.1.108:58718
2017-11-04 13:18:57 INFO connecting www.google.com:443 from 192.168.1.108:58720
2017-11-04 13:18:57 INFO connecting www.gstatic.com:443 from 192.168.1.108:58722
2017-11-04 13:18:57 INFO connecting www.youtube.com:443 from 192.168.1.108:58724
2017-11-04 13:18:57 INFO connecting clients4.google.com:443 from 192.168.1.108:58726
2017-11-04 13:19:03 INFO connecting play.google.com:443 from 192.168.1.108:58734
2017-11-04 13:19:04 INFO connecting play.google.com:443 from 192.168.1.108:58736
2017-11-04 13:19:07 INFO connecting www.jianshu.com:80 from 192.168.1.108:58740
这样你就不需要每次开机都启动shadowsocks客户端来链接了
当然更骚气的做法就是你可以把tcp的4396端口用ngrok代理出去,那么你就不需要处于局域网之中了,不过速度会变慢
./ngrok -proto=tcp -config=ngrok.cfg 4396
欢迎关注Bboysoul的博客www.bboysoul.com
Have Fun
网友评论