Balance FTP passive-mode on NLB

0

Hi, we would to balance a FTP server running in PASV (passive mode) on two EC2 instances, having only private IPs, by a Internet-facing NLB. What is the suggested setup? Do I need to create a listener on the NLB for EVERY port in the PASV range? If yes, Is it advisable to limit the PASV range to a couple of ports or this could limit the number of concurrent connections?

Thanks

6回答
0

As far as I know, "pasv_address" is advertised by FTP server (vsftpd) to the client during the first control connection (open) and thus the successive data connection (passive) will go directly to the EC2, NLB is no more involved. Here an example found on the Internet: https://resetenv.com/2018/03/01/nlb/

dom
回答済み 1年前
  • In that case, why use NLB at all? Each of the FTP instances will need an Elastic IP so use DNS load-balancing instead.

0

I don't think that this will work. See comment below - make sure you're using the same target group for all listeners.

NLB uses a hash algorithm to distribute traffic to the target instances. In the documentation it says that the target is chosen based on based on the protocol, source IP address, source port, destination IP address, destination port, and TCP sequence number. Edit: As zob says - stick sessions change the way the hash algorithm works.

Edit: Therefore, if you do not use sticky sessions: Based on this, it's likely that (at least some of the time) the FTP control connection from the client will go to one target; and the data connection will go to another, resulting in the transfer failing. it may work some of the time; and not at others depending on whether the two connections are hashed to the same target.

profile pictureAWS
エキスパート
回答済み 1年前
  • NLB supports sticky sessions which works by reducing the tuples used for flow hashing to just the client IP. This is applied at the target group level, so multiple listeners going to the same TG will flow hash to the same target when stickiness is enabled.

0

Yes, when using NLB for FTP, it will be necessary to create a listener for each port number.
Therefore, in the following configuration, it is necessary to create three listeners, one for port 21, one for port 60001, and one for port 60002.
The number of listeners is also the number of simultaneous connections that can be made.

listen=YES
listen_ipv6=NO

ssl_enable=YES
rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem
ssl_sslv2=NO
ssl_sslv3=NO
ssl_tlsv1=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES

pasv_enable=YES
pasv_min_port=60001 ←Designation of port range for data transfer (number of simultaneous connections possible)
pasv_max_port=60002 ←Designation of port range for data transfer
pasv_addr_resolve=YES
pasv_address=NLB DNS NAME
tcp_wrappers=NO
profile picture
エキスパート
回答済み 1年前
0

A too small number of ports can limit the number of connections. Is there any other solution? Is assigning a public IP to the EC2 and configuring "pasv_address" to this IP a viable alternative?

dom
回答済み 1年前
0

What if we stop using FTP and use SFTP with port forwarding in Systems Manager?
This would eliminate the need to create an NLB.
https://aws.amazon.com/jp/blogs/mt/use-port-forwarding-in-aws-systems-manager-session-manager-to-connect-to-remote-hosts/

profile picture
エキスパート
回答済み 1年前
0

No, we need FTP to support some legacy applications.

dom
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ