FTP有自己的特殊性,在IPVS中进行了特殊的处理。在这一节中把关于FTP的处理择出来,缕清楚。
FTP有两种模式 主动和被动,主动和被动是针对服务器说的,指的是对于数据连接,服务器主动连接到客户端,还是服务器被动接收客户端的连接。
主动模式(active)是 client主动通告服务器它所开启的数据端口,服务器用20端口来连接client的数据端口。client通告服务器端口的消息有一个固定的格式,"PORT xxx,xxx,xxx,xxx,ppp,ppp\n" 这个数据包,
被动模式(passive)是 服务器 告诉客户端它监听的数据端口,客户端主动连接到服务器。"227 Entering Passive Mode (xxx,xxx,xxx,xxx,ppp,ppp)".xxx,xxx,xxx,xxx is the server address, ppp,ppp is the server port number.
先分析主动模式的处理。
To setup ftp with LVS, you schedule only port 21 for forwarding. While the realserver is listening on port 21, it calls the client from port 20 (i.e. it's not listening on port 20) rather than the client calling the realserver (through the director). You do not add entries for port 20 with ipvsadm. Port 20 is handled by persistence for LVS-DR and LVS-Tun. For active ftp with LVS-NAT, you don't need the ipvs ftp helper module (the ftp helper module is only needed for passive ftp, Wensong 17 Sep 2002) (however see ftp helper module.)