Users cannot access port 21 on virtual machine

Christian James 0 Reputation points
2025-04-16T16:55:21.97+00:00

Users requested to have port 21 open for FTP

User's image

I made some rules under network settings but the users are reporting:
"I’m unable to access the FTP server due to a timeout error."

"Server sent passive reply with unrouteable address 10...*, using host address instead.

Timeout detected. (data connection)

Could not retrieve directory listing

__Error listing directory '/'."

I am not too sure what to do here.__

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,681 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LISBOA-4826 240 Reputation points
    2025-04-16T22:01:32.7066667+00:00

    hi Christian James

    To access an FTP server on an Azure VM, you need to configure both the VM's network security group (NSG) and the Windows Firewall to allow incoming FTP traffic, specifically ports 21 and optionally passive data ports.

    You also need to configure the FTP server itself, including specifying the external IP address for passive mode connections. 

    Here's a more details for reference:

    https://stackoverflow.com/questions/18422391/how-to-set-up-ftp-on-azure-vm

    https://serverfault.com/questions/960496/ftp-server-on-an-azure-virtual-machine#:~:text=You'll%20need%20to%20install,your%20server's%20external%20IP%20address.

    1. Configure the Network Security Group (NSG):
    • Add Inbound Security Rule: Click "Add inbound port rule".
    • Configure the rule:
      • Service: Select "FTP" or "Custom" and specify port 21 (for active FTP) or port range 49152-65535 (for passive FTP).
        • Priority: Leave the priority at the default value.
          • Name: Give the rule a descriptive name.
          • Apply the changes: Save the rule. 
    1. Configure the Windows Firewall:
    • Connect to the VM: RDP into your Azure VM. 
    • Open Firewall Properties: Open Windows Firewall with Advanced Security. 
    • Create Inbound Rules:
      • For active FTP: Create a new rule for port 21. 
      • For passive FTP: Create a new rule for the specified passive data port range (e.g., 7000-7014). 
      • Enable the rules: Make sure the rules are enabled. 
    1. Configure the FTP Server (IIS) or anyother that works for you.

    Important Considerations:

    • Passive vs. Active FTP: Active FTP uses ports 20 and 21. Passive FTP uses port 21 for control and a higher port range for data transfer. 
    • Firewall Rules: Ensure that your VM's Windows Firewall rules and Azure Firewall rules (if applicable) allow both inbound and outbound traffic for FTP, especially for passive data ports. 
    • Static IP: It's recommended to assign a static public IP address to your VM to ensure consistent access to the FTP server. 
    • Troubleshooting: If you still can't connect, check the NSG rules, Windows Firewall rules, and FTP configuration. You can also use a port checker to verify that ports are open and accessible, like NMAP for example.

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you.

    Thank You.

    Lisboa

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.