Centos7下安装配置Redsocks

  Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库。Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配置Shadowsocks)。通常的用途是流量透传或流量转发,首先将本机上目的地为的某些特定IP的流量转发到Redsocks的监听端口上(本文为8888),之后Redsocks会将这些流量再转发给后端的Shadowsocks,再通过shadowocks转到更远的地方。

1、下载编译

[root@localhost ~]# yum install libevent-devel git gcc
[root@localhost ~]# mkdir ~/shadowsocks
[root@localhost ~]# cd ~/shadowsocks
[root@localhost ~]# git clone https://github.com/darkk/redsocks
[root@localhost ~]# cd ~/shadowsocks/redsocks
[root@localhost ~]# make
[root@localhost ~]# cp ~/shadowsocks/redsocks/redsocks /usr/local/bin/

 2、新建配置文件(默认即可,无需更改)

[root@localhost ~]# vi /etc/redsocks.conf

base {
        log_debug = off;
        log_info = on;
        log = stderr;
        daemon = off;
        redirector = iptables;
}
redsocks {
        local_ip = 127.0.0.1;
        local_port = 8888;
        ip = 127.0.0.1;
        port = 1080;
        type = socks5;
}

 3、启动/停止

启动
[root@localhost ~]# nohup /usr/local/bin/redsocks -c /etc/redsocks.conf &
停止
[root@localhost ~]# kill -9 对应进程

 

posted @ 2016-05-16 09:56  振宇要低调  阅读(5541)  评论(0编辑  收藏  举报