Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库。Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配置Shadowsocks)。通常的用途是流量透传或流量转发,首先将本机上目的地为的某些特定IP的流量转发到Redsocks的监听端口上(本文为8888),之后Redsocks会将这些流量再转发给后端的Shadowsocks,再通过shadowocks转到更远的地方。
1、下载编译
[[email protected] ~]# yum install libevent-devel git gcc [[email protected] ~]# mkdir ~/shadowsocks [[email protected] ~]# cd ~/shadowsocks [[email protected] ~]# git clone https://github.com/darkk/redsocks [[email protected] ~]# cd ~/shadowsocks/redsocks [[email protected] ~]# make [[email protected] ~]# cp ~/shadowsocks/redsocks/redsocks /usr/local/bin/
2、新建配置文件(默认即可,无需更改)
[[email protected] ~]# 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、启动/停止
启动 [[email protected] ~]# nohup /usr/local/bin/redsocks -c /etc/redsocks.conf & 停止 [[email protected]ocalhost ~]# kill -9 对应进程
时间: 2024-12-18 19:12:47