Cannot open port in Azure Virtual Machine

Mike Fairley 31 Reputation points
2022-08-08T05:55:10.783+00:00

I have tried everything and am now exhausted!
Hoping someone can step me through the process to open a port on a Windows VM.
Done so far:

  1. Port 3389 was already open and working fine
  2. I tried to open ports 21, 3306 and 5055
  3. Opened the ports in NSG
  4. Open Ports on Windows firewall.
  5. When didn't work have completely disabled Windows firewall 228925-1.png
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jackson Martins 10,606 Reputation points MVP Volunteer Moderator
    2022-08-08T19:10:08.91+00:00

    Hi @Mike Fairley
    as very well demonstrated by Andrea Baumgarten, it looks like your external connection on port 5055 is working fine, so I think of two hypotheses

    1 - there is a port source block, like outbound of your client (some ISP block the ports)

    2 - there is something else preventing the connection, such as an antivirus

    Can you do an internal and external telnet test? like

    telnet localhost 21
    telnet localhost 5055

    telnet 47.x.x.x.x 21
    telnet 47.x.x.x.x 21

    If telnet gives an ok status, it means that the port is listening and maybe only the service is not responding. You can also use PowerShell to test port, like

    Test-NetConnection 8.8.8.8 -port 53

    229283-image.png

    Or an online tool, like:
    229276-image.png

    https://www.yougetsignal.com/tools/open-ports/

    Testing an online tool can help eliminate source client or ISP


3 additional answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2022-08-08T06:21:10.133+00:00

    Hi @Mike Fairley ,

    NSGs could be associated with the VM and/or with a subnet.
    If there is more than one NSG in the game the security rule sets must match in both NSGs.

    If you have 2 NSGs it looks like this:

    228966-image.png

    You can check the effective security rules applied to the VM by clicking on Effective security rules. The result should look like this:

    228965-image.png

    You could run a Connection Troubleshoot test to get more details:

    228899-image.png

    Are you able to connect via Port 21 from a VM in the same subnet of the affected VM?
    Please verify the affected VM is listening on Port 21.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments

  2. Mike Fairley 31 Reputation points
    2022-08-08T07:38:07.487+00:00

    Thanks for the detailed answer and the effort of including screen captures.
    I have a very simple lab server. I have only one NSG.

    Here are the effective rules

    229053-2.png

    Here is my connection diagnostic

    228986-3.png

    Still not able to connect from outside using public ip.

    0 comments No comments

  3. Mike Fairley 31 Reputation points
    2022-08-12T10:37:31+00:00

    Sorry - I have now marked your answer. Thanks for your help.

    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.