Unable to access custom port in Azure VM

James Seward 1 Reputation point
2020-10-15T16:09:22.74+00:00

I am attempting to set up a VM to host peerjs server. I have setup peerjs server locally and confirmed it works. Created VM in Azure and did the same there. Now I am attempting to connect from my local pc to peerjs server running in Azure. I have setup my server to run on port 9000. When I attempt to connect I always get a timeout. I have opened in and inbound and outbound port in the network security group for the server at 9000. Not sure what else is blocking the connection. 1st screenshot below, shows server running peerjs, client connected method on left demonstrates local connection working, image on right shows port config. 2nd screenshot shows connection error to server and port number.
32676-pic1.png32743-pic2.png32677-pic3.png

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,165 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Andreas Baumgarten 97,396 Reputation points MVP
    2020-10-15T20:06:42.96+00:00

    There are maybe multiple things you could check:

    Inbound traffic communication order:
    NSG of subnet -> NSG of VM -> Firewall of VM OS
    All rules must allow incoming traffic on port 9000

    Outbound traffic communication order:
    Firewall of VM OS -> NSG of VM -> NSG of subnet
    All rules must allow outgoing traffic on port 9000


    (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.

  2. James Seward 1 Reputation point
    2020-10-16T14:32:55.753+00:00

    OK So I created new win 10 vm, turned off all vm firewall, installed node and peerjs sever. Started server at 9000, with myapp and test locally (localhost:9000/myapp) and it works. Created nsg and opened inbound and outbound port 9000 and set priority to 310 for inbound and 100 for outbound. Associate nsg with subnet default (only one there is at this point) and test again at 13.92.37.113:9000/myapp and get timeout, Still not sure what might be blocking. Please advise.

    0 comments No comments

  3. Andreas Baumgarten 97,396 Reputation points MVP
    2020-10-18T19:53:54.797+00:00

    I just created a VM, installed IIS and changed the binding on Port 9000 (sorry I am not familiar with PeerJS), added a NSG related to the VM, added a NSG related to the subnet.

    33152-iis.jpg

    In the VM firewall I added a inbound rule to allow Port 9000 communication

    33124-fw.jpg

    In the VM related NSG I added a inbound rule to allow Port 9000 communication

    33076-vm-nsg.jpg

    In the subnet related NSG I added a inbound rule to allow Port 9000 communication

    33172-subnet-nsg.jpg

    Eh voila. It works.

    33144-publicwebsite.jpg

    https://ping.eu/port-chk/

    33145-checkport.jpg

    ----------

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

    Regards
    Andreas Baumgarten

    0 comments No comments

  4. Flavio Oliva 1 Reputation point
    2021-05-22T16:48:52.243+00:00

    I faced this situation and I was running a Red Hat VM within Azure.

    I was able to fix the problem by enabling firewalld and open the port that I wanted.

    Hope that helps.

    Flavio Oliva

    0 comments No comments

  5. Umapada Mandal 1 Reputation point
    2021-08-06T18:07:59.657+00:00

    Thanks .. Creating rules in Windows server firewall which allow connections in specific port though NSG will works. Much appreciated.

    0 comments No comments