Linux VPS上使用kingate搭建socks代理服务器
kingate是一位国人开发的代理服务器,支持http,socks,ftp等多种协议。支持多线程、tcp端口映射、规则控制、时间控制、用户认证、http管理等功能。
kingate官网:http://sourceforge.net/projects/kingate/
安装所需的依赖包
Debian:
CentOS:
安装kingate
wget http://softlayer.dl.sourceforge.net/project/kingate/kingate/2.0/kingate-2.0.tar.gz
tar xzf kingate-2.0.tar.gz
cd kingate-2.0/
./configure --prefix=/usr/local/kingate
make && make install
配置kingate
修改/usr/local/kingate/etc/kingate.conf 为以下内容:
http off
ftp off
pop3 off
smtp off
telnet off
socks on
mms off
rtsp off
manage on
max 2000
max_per_ip 0
min_free_thread 3
http_port 8082
http_accelerate off
x_forwarded_for on
http_time_out 30
ftp_port 2121
ftp_time_out 300
pop3_port 1100
pop3_time_out 300
smtp_port 2525
smtp_time_out 300
telnet_port 2323
telnet_time_out 300
socks_port 20120
socks_time_out 300
socks5_user off
mms_port 1755
mms_time_out 300
rtsp_port 5540
rtsp_time_out 300
manage_port 8822
manage_time_out 300
log_model user
log_level 0
log_rotate {0 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * }
log_close_msg on
mem_min_cache 50m
mem_max_cache 12m
disk_min_cache 20m
disk_max_cache 30m
use_disk_cache off
refresh never
refresh_time 300
user_time_out 0
mem_cache 50m
disk_cache 100m
max_deny_per_ip 0
max_queue_thread 15
min_limit_speed_size 1m
limit_speed 20k
max_request 50
total_seconds 10
bind_addr
run_user
insert_via off
以上配置中,socks on 表示启用socks代理(也可以根据你自己的需求开启其他类型的代理),socks_port 20120 表示socks代理的端口。manage on 为启用http管理,manage_port 8822 为http管理的端口。强烈建议修改端口号!
kingate启动及管理
下载启动脚本及添加权限
wget http://soft.vpser.net/proxy/kingate/kingate.init.d
mv kingate.init.d /etc/init.d/kingate
chmod +x /etc/init.d/kingate
kingate管理
启动kingate:
关闭kingate:
重启kingate:
http管理
管理地址:http://ip:8822 ,如果修改过配置,8822端口修改为你设置的端口号,默认用户名为root,密码为kingate。
加入开机启动
Debian执行:
CentOS执行:
客户端设置
这里以dropbox为例:
如有问题欢迎在本文或论坛反馈!
原创文章谢绝转载!
>>转载请注明出处:VPS侦探 本文链接地址:https://www.vpser.net/build/linux-vps-use-kingate-install-proxy-server.html
回复7楼问题:
这个问题今天仔细看了一把,估计作者也知道这毛病所以提供了-f的选项
需要知道安装目录,然后直接运行加-f参数可以重置,默认的话:
/usr/local/kingate/bin/kingate -f
成功启动之后再重新开就好了。
wget http://ncu.dl.sourceforge.net/project/kingate/kingate/2.1/kingate-2.1.tar.gz
tra xzf kingate-2.1.tar.gz
cd kingate-2.1/
./configure --prefix=/usr/local/kingate
make && make install
2.1的已经发布,但在debian上编程过程中出错,用户2.0就成功了,但是安装成功后还要怎样设置?http后台能进去,但是代理上不了。
@新手, 登录管理界面加
军哥,成功了。为什么是透明的代理呀,怎么加账号密码哦。。。。
我这里安装后,checkip.org显示的vps的ip,而checkip.dyndns.org显示却还是实际的ip,试了一下翻墙无效,看样子是透明代理
我安装后,checkip.org显示的是vps的地址,而通过checkip.dyndns.org却还是实际的地址,实际翻墙还是会被墙
@雨荨, 上下都消耗vps的流量。
军哥,这个代理上去后 上网和下载产生的流量是VPS的吗,还是不会损耗VPS一丁点的流量
/etc/init.d/kingate start
Starting kingate: kingate 2.0 Author king(email:khj99@tom.com)
http://sourceforge.net/projects/kingate/
sizeof fd_set is:128
start error,have another kingate (pid=6141) running.
try (kingate -q) to close it.
if you are sure of none kingate be running,try (kingate -f) to start server.
这是怎么情况?我重启了还是这样,而且那个pid=6141 进程压根没有……
为啥我装完以后,浏览器的IP上查IP的网站查发现已经是我美国的VPS的IP了,但还是上不了被墙的网站啊。。。
难道是GFW神器升级,这种东西根本穿不透?
注:在vps上能Ping通那些网站,应该是配置或者传输过程中出了一点问题
@istef, 应该是代码的问题,不太好办,要不找个deb或rpm包试试吧
@VPSer 编译过程都在下面了,帮忙看看是哪里出了问题,谢谢
davidbeck@yardvps:~/kingate-2.0# uname && uname -r
Linux
2.6.32-305-ec2
davidbeck@yardvps:~/kingate-2.0# ./configure --prefix=/usr/local/kingate
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking for inline... inline
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for inttypes.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking sstream usability... yes
checking sstream presence... yes
checking for sstream... yes
checking for an ANSI C-conforming const... yes
checking for uid_t in sys/types.h... yes
checking for inline... (cached) inline
checking for pid_t... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for ctime_r have len... no
checking for socklen_t... yes
checking for u_long... yes
checking for working memcmp... yes
checking for sys/time.h... (cached) yes
checking for unistd.h... (cached) yes
checking for alarm... yes
checking for working mktime... no
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking for vprintf... yes
checking for _doprnt... no
checking for wait3 that fills in rusage... yes
checking for gethostbyname_r... yes
checking for gettimeofday... yes
checking for inet_ntoa... yes
checking for localtime_r... yes
checking for memchr... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strncasecmp... yes
checking for strrchr... yes
checking for strstr... yes
checking for strtol... yes
checking for ctime_r... yes
checking for daemon... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING: 'Makefile.in' seems to ignore the --datarootdir setting
config.status: creating src/Makefile
config.status: WARNING: 'src/Makefile.in' seems to ignore the --datarootdir setting
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
davidbeck@yardvps:~/kingate-2.0# make
Making all in src
make[1]: Entering directory `/davidbeck/kingate-2.0/src'
make all-am
make[2]: Entering directory `/davidbeck/kingate-2.0/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O0 -D_REENTRANT -DLINUX -MT KConfig.o -MD -MP -MF ".deps/KConfig.Tpo" -c -o KConfig.o KConfig.cpp; \
then mv -f ".deps/KConfig.Tpo" ".deps/KConfig.Po"; else rm -f ".deps/KConfig.Tpo"; exit 1; fi
if g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O0 -D_REENTRANT -DLINUX -MT http://ftp.o -MD -MP -MF ".deps/ftp.Tpo" -c -o http://ftp.o http://ftp.cpp; \
then mv -f ".deps/ftp.Tpo" ".deps/ftp.Po"; else rm -f ".deps/ftp.Tpo"; exit 1; fi
if g++ -DHAVE_CONFIG_H -I. -I. -I. -g -O0 -D_REENTRANT -DLINUX -MT allow_connect.o -MD -MP -MF ".deps/allow_connect.Tpo" -c -o allow_connect.o allow_connect.cpp; \
then mv -f ".deps/allow_connect.Tpo" ".deps/allow_connect.Po"; else rm -f ".deps/allow_connect.Tpo"; exit 1; fi
In file included from oops.h:666,
from allow_connect.cpp:15:
lib.h: In function 'int store_in_chain(char*, int, mem_obj*)':
lib.h:184: warning: deprecated conversion from string constant to 'char*'
lib.h:187: warning: deprecated conversion from string constant to 'char*'
lib.h:191: warning: deprecated conversion from string constant to 'char*'
allow_connect.cpp: In function 'unsigned int allow_connect2(mysocket*, int, const char*, int, long unsigned int&, bool, unsigned int)':
allow_connect.cpp:44: error: cast from 'const char*' to 'int' loses precision
allow_connect.cpp:68: error: cast from 'const char*' to 'int' loses precision
make[2]: *** [allow_connect.o] Error 1
make[2]: Leaving directory `/davidbeck/kingate-2.0/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/davidbeck/kingate-2.0/src'
make: *** [all-recursive] Error 1
davidbeck@yardvps:~/kingate-2.0#