CentOS7 安装 shadow,socks 服务端

环境

conoha vps

CentOS7.2


背景

在 conoha 买了一个 vps,准备使用 shadow,socks 搭建 vpn


1、安装shadow,socks

yum install python-setuptools && easy_install pip

pip install shadow,socks

2、在/etc/shadow,socks新建config.json配置文件

{
    "server":"133.130.127.xxx",
    "server_port":4433,
    "local_address": "0.0.0.0",
    "local_port":1080,    
    "password":"myxxx",
    "timeout":600,
    "method":"aes-256-cfb"
}

3、后台运行 shadow,socks 服务端程序,并把标准输出和标准错误输出重定向到/etc/shadow,socks/a.log

nohup ssserver -c /etc/shadow,socks/config.json > /etc/shadow,socks/a.log 2>&1 &

4、打开本机的 shadow,socks 客户端,对应输入config.json配置文件中的serverserver_portpassword ,此时却发现上不了网

2021-04-06-22-32-53

5、原来是 CentOS 的防火墙没有打开我们设定的 4433 端口,现在使用firewall把端口权限打开

#打开 4433 端口(--permanent 永久生效,没有此参数重启后失效)
firewall-cmd --zone=public --add-port=4433/tcp --permanent    

#重新载入 firewall
firewall-cmd --reload

注:CentOS7 的防火墙用 firewall 取代了之前的 iptables,如果你是 CentOS 的老版本用户:

iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 4433 -j ACCEPT

#保存iptables规则
service iptables save 

参考资料

shadow,socks服务端的安装

标准输出,标准错误输出

5分钟理解Centos7防火墙firewalld

posted @ 2017-02-06 18:17  小蒋不素小蒋  阅读(1200)  评论(0编辑  收藏  举报

ICP证:沪ICP备20014317号