Open Ports on azure NSG and server firewall: 21,20,4000-40009,990,14147
Issue: Client cannot connect to ftp from command line and Powershell
We are able to connect with testuser but not able see the directory/List
Installed Wireshark on server and on my laptop to capture packets
Created a filter on wireshark with “ftp” and “IP”
The packet capture doesn’t states weather is it passive or active mode and source IP is correct. (we configure primary IP and secondary IP on the server)
We found that the ftp connection is not working from the command prompt.
trying to initiate a connection to ftp.abcd.com which was resolving to 126.96.36.199 and not to the actual FTP Server 188.8.131.52
IP addresses 184.108.40.206 and 220.127.116.11 are both configured on the same Machine. However, the DNS was resolving to the secondary FTP IP instead of Primary
Initially, We also found that the FTP connections to 18.104.22.168 was working fine and these connections were Active connections. We were unable to see that the Passive mode works here. Also while initiating connection to 22.214.171.124 from Commad promt the session freezes after you give 'dir' command however the same is working with other ftp clients like FileZilla and Winscp.
I tried testing with WinSCP and FileZilla and got to see Passive mode connections are working fine and Active not which is an expected behavior.
We checked why the 'dir' command is not working from the devices after the successful authentication, we got to see that the windows firewall is blocking the connection. We disabled the firewall and the everything started working as expected.
I checked the same on my end after creating the firewall rule, issues were resolved. There was one system which even after disabling firewall was stuck at directory listing, this might be an issue within that system or the connections are being blocked by an external factor.
Since after disabling most of us are able to work fine.
settings need to be done on the machine
Go to Control Panel → Windows Firewall → Advanced Settings → Inbound Rules
Double-click the Name column to sort by name
Scroll down until you see two rules called "File Transfer Program"; these were set to Block on my PC (big red circle with a line through it)
Double-click on the rule
On the General tab, under Action, set to Allow the connection