5.99刀入手一台搬瓦工VPS,不满意32位的Centos系统,mongodb跟docker都需要64位系统,于是换成64位的Centos6.5,重新架设了一个Shadowsocks,科学上网,你懂的
当然现在搬瓦工管理面板已经自带一键安装SS,不过我还是喜欢自己动手,其实也是使用别人的安装脚本了。

cd
mkdir src
cd src
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev.sh
chmod u+x shadowsocks-libev.sh
./shadowsocks-libev.sh

接下来输入密码,再回车就开始自动安装了,几分钟后就完成了

在/etc/shadowsocks-libev的config.json里修改配置,比如端口,监听IP,密码等等,比如我把端口改成9527了

然后需要设置防火墙,这是我的防火墙规则:

[[email protected] shadowsocks-libev]# cat /root/iptables-settings
# Generated by iptables-save v1.4.7 on Tue Mar 24 05:12:56 2015
*raw
:PREROUTING ACCEPT [2801:182049]
:OUTPUT ACCEPT [2622:289297]
COMMIT
# Completed on Tue Mar 24 05:12:56 2015
# Generated by iptables-save v1.4.7 on Tue Mar 24 05:12:56 2015
*nat
:PREROUTING ACCEPT [769:39795]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Tue Mar 24 05:12:56 2015
# Generated by iptables-save v1.4.7 on Tue Mar 24 05:12:56 2015
*mangle
:PREROUTING ACCEPT [2801:182049]
:INPUT ACCEPT [2801:182049]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2622:289297]
:POSTROUTING ACCEPT [2622:289297]
COMMIT
# Completed on Tue Mar 24 05:12:56 2015
# Generated by iptables-save v1.4.7 on Tue Mar 24 05:12:56 2015
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [24:3032]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9527 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j DROP
COMMIT
# Completed on Tue Mar 24 05:12:56 2015

保存防火墙规则:

iptables-save > /root/iptables-settings

恢复时使用:

iptables-restore /root/iptables-settings

可以写入开机事件。

echo "/sbin/iptables-restore /root/iptables-settings" >> /etc/rc.local

使用命令:
启动:/etc/init.d/shadowsocks start
停止:/etc/init.d/shadowsocks stop
重启:/etc/init.d/shadowsocks restart
查看状态:/etc/init.d/shadowsocks status

参考:http://teddysun.com/357.html

- EOF -

评论

加载中