背景
因服務器要搬遷,之前ftp提供商加的老機房的白名單,需要再加一遍新的,但是要求白名單只能加一個公網ip,但是現服務在k8s跑,通過net訪問外網沒有具體的公網ip;
解決方法
找一台有固定公網ip的服務器搭建 ftp代理,應用pod連接代理地址,實現ftp連接 (可先在已有白名單的服務器上搭建代理測試)
部署 ftp.proxy
#下載
wget http://www.ftpproxy.org/download/ftpproxy-current.tgz
#安裝編譯依賴
yum install ctags -y
#解壓編譯
tar -xvf ftpproxy-current.tgz
cd ftpproxy-1.2.3/ #文件名請自行修改
make
mkdir /usr/local/man -p
sudo make install
/usr/local/sbin/ftp.proxy -D 12580 192.168.1.1:10086
#192.168.1.1:10086 是ftp的地址端口
#12580 是本機代理的端口
#其他服務器測試連接
ftp
ftp> open 10.101.18.139 12580
Connected to 10.101.18.139 (10.101.18.139).
220 server ready - login please
Name (10.101.18.139:root): test
331 password required
Password:
230 login accepted
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
227 Entering Passive Mode (10,101,18,139,128,252)
150 Here comes the directory listing.
dr-xr-xr-x 13 1001 1001 4096 May 31 2017 test_home
參考文檔:https://best33.com/95.moe
搭建ftp:https://www.cnblogs.com/x602/p/13793955.html