AC-86U+FRP+FTP

Database and Ruby, Python, History


好不容易有了内网穿透,顺带成功搭上FTP,结果速度感人,只有100KB,回头一看,自己的VPS就1M的带宽,搞个铲铲。但Anyway,还是勉强可以用了。

配置/etc/vsftpd.conf

FTP除了21作为通信端口,还需要额外的随机端口作为数据端口。自己把随机端口限制在3个范围内,这样自己在FRPC里面只需要配置4个端口就行了。port_promiscuouspasv_promiscuous 是避免IP和端口的安全检查。pasv_address一般配置为FRPS服务器的公网IP地址,但是我这里特殊配置为127.0.0.1是因为自己做了ssh的端口映射。

pasv_enable=YES
pasv_min_port=10311
pasv_max_port=10313
port_promiscuous=YES
pasv_promiscuous=YES
pasv_address=127.0.0.1

netstat -tulnp | grep ftp 找到FTP的进程,kill掉,重启ftp nohup vsftpd /etc/vsftpd.conf &

配置FRPC

# frpc configuration
[common]
server_addr = 1.2.3.4
server_port = 5443
token = **TOKEN**
log_file = /tmp/frpc.log
log_level = info
log_max_days = 3
tcp_mux = true
protocol = tcp
login_fail_exit = false
user = admin

[ftp]
type = tcp
local_ip = 192.168.51.1
local_port = 21
remote_port = 6821
use_encryption = true
use_compression = true
[ftp1]
type = tcp
local_ip = 192.168.51.1
local_port = 10311
remote_port = 10311
use_encryption = true
use_compression = true
[ftp2]
type = tcp
local_ip = 192.168.51.1
local_port = 10312
remote_port = 10312
use_encryption = true
use_compression = true
[ftp3]
type = tcp
local_ip = 192.168.51.1
local_port = 10313
remote_port = 10313
use_encryption = true
use_compression = true

安装FRPS服务器

一键安装FRPS

wget https://code.aliyun.com/MvsCode/frps-onekey/raw/master/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh
./install-frps.sh install

端口映射

自己不想开放太多的端口,因为不知道这样安不安全,所以索性就只保留了22端口,然后通过下面的方法做一个端口映射。所以,对于客户端来说,FTP server的IP是pasv_address=127.0.0.1

ssh -N -C -T -L 6821:127.0.0.1:6821 -L 6822:127.0.0.1:6822 -L 10311:127.0.0.1:10311 -L 10312:127.0.0.1:10312 -L 10313:127.0.0.1:10313 admin@1.2.3.4

Reference

http://vsftpd.beasts.org/vsftpd_conf.html