如何在谷歌云Google Cloud Platform(GCP)上架设Shadowsocks科学上网

shadowsocks是一种基于Socks5代理方式的网路资料加密传输套件,并采用Apache许可证、GPL、MIT许可证等多种自由软体许可协定开放原始码。shadowsocks分为伺服器端和用户端,在使用之前,需要先将伺服器端部署到伺服器上面,然后通过用户端连线并建立本地代理。目前套件使用Python、C、C++、C#、Go语言等程式语言开发。

在中国大陆,本工具也被广泛用于突破防火长城(GFW),以浏览被封锁、遮蔽或干扰的内容。2015年8月22日,Shadowsocks原作者Clowwindy称受到了中国政府的压力,宣布停止维护此计划(专案)并移除其个人页面所储存的原始码。因为移除之前就有大量的复制副本,所以事实上并未停止维护,而是转由其他贡献者们持续维护中。引用wiki

Github上表面被删,其实还有偷偷维护可以使用,以后去一些地方就可以轻松翻墙


首先在专案中的Computer Engine 建立VM 执行个体

名称随便取

如果是要翻墙,个人需求建议选asia-northeast 或asia-east

亚洲区的分别在
asia-northeast ->日本
asia-east ->台湾
asia-southeast ->新加坡

  • 机器类型,建议选微型(用Shadowsocks服务不需要太多电脑运算能力)

接下来开启SSH进入伺服器里面

登入到console画面直接切换管理者角色sudo su
避免之后安装套件或执行程式权限不足

这里我使用的是“Shadowsocks Python版一键安装脚本”

先更新python,再来更新系统软体
apt-get install python-pip
apt-get update
apt-get upgrade

接者输入

wget --no-check-certificate -O shadowsocks.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh
会从Github 上下载打包好的档案下来

接着输入是chmod +x shadowsocks.sh 和./shadowsocks.sh 2>&1 | tee shadowsocks.log 进行安装

接着要设定密码,不建议用预设的密码,设定与使用者端的传输埠,我是使用预设值,有问题再修改。

加密选择,我是选择aes-256-cfb,到这里设定就已经完成了,等待安装完成

完成设定后会跑出检视画面,就可以使用。

依据需求,使用vim /etc/shadowsocks.json 来编辑设定

local_address 改为机器上的内部IP

Vim 编辑器的指令,i 是进入编辑模式、Esc 离开编辑模式到上层,在上层:w 是存档、:wq 是存档后离开、:q 是直接离开不存档

想编辑多人使用范例


“server”:”0.0.0.0″, 
“local_address”:”127.0.0.1″, 
“local_port”:1080, 
“port_password”:{ 
“8989”:”password0″, 
“9001”:”password1″, 
“9002 ”:”password2″, 
“9003”:”password3″, 
“9004”:”password4″ 
}, 
“timeout”:300, 
“method”:”your_encryption_method”, 
“fast_open”: false 
}

到这边伺服端的处理都完成了,重新启动Shadowsocks 后就可以了使用Reboot 指令重开伺服器。

新增防火墙规则,根据shadowsocks.json 来设定,开启对应tcp/udp port

回到VM上,编辑刚刚的机器,网路标记打上刚刚设置的防火墙名称,

也要勾选防火墙的HTTP和HTTPS

使用命令
啟動:/etc/init.d/shadowsocks start
停止:/etc/init.d/shadowsocks stop
重新啟動:/etc/init.d/shadowsocks restart
目前狀態:/etc/init.d/shadowsocks status
解除安裝: ./shadowsocks.sh uninstall


Mac上使用Shadowsocks

下载ShadowsocksX-2.6.3.dmg后安装
https://github.com/shadowsocks/shadowsocks-iOS/releases
点选Servers Preferences来设置

测试结果

Android上使用Shadowsocks

到Google 商店下载Shadowsocks 来安装

设置好伺服器IP位址

确定好按下去连接(圈处)

测试连线结果还不错

原文:https://medium.com/@kiras0518/%E5%9C%A8google-cloud-platform-gcp-%E4%B8%8A%E6%9E%B6%E8%A8%ADshadowsocks%E4%BB%A5ubuntu-16-04-lts-%E7%82%BA%E4%BE%8B-a0da93a10cb6