Centos7下安装配置Redsocks

时间:2024-05-03 08:38:02

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

1、下载编译

[root@localhost ~]# yum install libevent-devel git gcc
[root@localhost ~]# mkdir ~/*
[root@localhost ~]# cd ~/*
[root@localhost ~]# git clone https://github.com/darkk/redsocks
[root@localhost ~]# cd ~/*/redsocks
[root@localhost ~]# make
[root@localhost ~]# cp ~/*/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 = ;
ip = 127.0.0.1;
port = ;
type = socks5;
}

3、启动/停止

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