gpt4 book ai didi

amazon-web-services - 当我 FTP 到远程服务器时,如何强制 Amazon EC2 实例使用我的弹性 IP?

转载 作者:行者123 更新时间:2023-12-04 08:06:24 24 4
gpt4 key购买 nike

我正在尝试通过 EC2 实例 FTP 到远程服务器,但是在登录时,如果我发送任何 FTP 命令,远程服务器就会断开连接。通过我的测试,远程 FTP 服务器似乎从我的 EC2 实例获取私有(private) IP 地址,而不是分配给它的公共(public)弹性 IP。有没有办法在启动连接时“强制”我的实例发送公共(public) IP?

最佳答案

FTP有两种操作模式——主动和被动。报价 wikipedia :

FTP may run in active or passive mode, which determines how the data connection is established.In active mode, the client creates a TCP control connection. In situations where the client is behind a firewall and unable to accept incoming TCP connections, passive mode may be used. In this mode, the client uses the control connection to send a PASV command to the server and then receives a server IP address and server port number from the server, which the client then uses to open a data connection from an arbitrary client port to the server IP address and server port number received



总而言之,在主动模式下,服务器将尝试创建与客户端的连接。由于您客户端的 IP 是私有(private) IP,在云内部,服务器无法连接到它 - 这是错误的原因。将您的 FTP 客户端配置为使用被动模式,它应该可以工作。

关于amazon-web-services - 当我 FTP 到远程服务器时,如何强制 Amazon EC2 实例使用我的弹性 IP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18518159/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com