当前位置: > CentOS > CentOS教程 >

Centos7下安装配置Shadowsocks

时间:2016-06-06 00:12来源:linux.it.net.cn 作者:IT

Shadowsocks是一个轻量级socks5代理,以python写成。

1)安装pip

[root@localhost ~]# cd ~/shadowsocks/
[root@localhost ~]# curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
[root@localhost ~]# python ~/shadowsocks/get-pip.py
[root@localhost ~]# pip install --upgrade pip

2)安装shadowsocks

[root@localhost ~]# pip install shadowsocks

3)配置服务端

[root@localhost ~]# vi /etc/shadowsocks.json

{
  "server": "0.0.0.0",
  "server_port": 8383,
  "password": "nimeide",
  "method": "aes-256-cfb"
}

method为加密方法,可选aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4-md5, chacha20, salsa20, rc4, table;server_port为服务监听端口;password为密码,可使用密码生成工具生成一个随机密码

  

  配置service并启动

[root@localhost ~]# vi /etc/systemd/system/shadowsocks.service

[Unit]
Description=Shadowsocks

[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json

[Install]
WantedBy=multi-user.target

[root@localhost ~]# systemctl enable shadowsocks
[root@localhost ~]# systemctl start shadowsocks

查看是否启动成功

[root@localhost ~]# systemctl status shadowsocks -l
● shadowsocks.service - Shadowsocks
   Loaded: loaded (/etc/systemd/system/shadowsocks.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2016-05-09 06:43:11 UTC; 19h ago
 Main PID: 9163 (ssserver)
   CGroup: /system.slice/shadowsocks.service
           └─9163 /bin/python /usr/bin/ssserver -c /etc/shadowsocks.json

May 09 07:11:30 localhost ssserver[9163]: 2016-05-09 07:11:30 INFO     connecting www.google.co.kr:443 from *************:59141
May 09 07:11:30 localhost ssserver[9163]: 2016-05-09 07:11:30 INFO     connecting www.google.co.kr:443 from *************:59142
May 09 07:11:30 localhost ssserver[9163]: 2016-05-09 07:11:30 INFO     connecting www.google.co.kr:443 from *************:44769
May 09 07:11:30 localhost ssserver[9163]: 2016-05-09 07:11:30 INFO     connecting www.google.co.kr:443 from *************:59150
May 09 07:11:31 localhost ssserver[9163]: 2016-05-09 07:11:31 INFO     connecting www.google.co.kr:443 from *************:59134
May 09 07:11:33 localhost ssserver[9163]: 2016-05-09 07:11:33 INFO     connecting www.gstatic.com:443 from *************:59154
May 09 07:11:35 localhost ssserver[9163]: 2016-05-09 07:11:35 INFO     connecting apis.google.com:443 from *************:59158
May 09 07:11:41 localhost ssserver[9163]: 2016-05-09 07:11:41 INFO     connecting safebrowsing.google.com:443 from *************:59169
May 09 07:12:20 localhost ssserver[9163]: 2016-05-09 07:12:20 INFO     connecting www.google.ie:443 from *************:59193
May 09 10:23:20 localhost ssserver[9163]: 2016-05-09 10:23:20 INFO     connecting clients1.google.com:443 from *************:63574

 4)客户端启动/停止

[root@localhost ~]# sslocal -s $ssserver_ip -p $ssserver_port -b 0.0.0.0 -l 1080 -k $ssserver_passwd -m aes-256-cfb -t 600 -d start

[root@localhost ~]# sslocal -s $ssserver_ip -p $ssserver_port -b 0.0.0.0 -l 1080 -k $ssserver_passwd -m aes-256-cfb -t 600 -d stop

 



(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容