Cannot communicate to VM:port from internet but I can connect from within virtual network

Mike Totman 0 Reputation points
2023-05-23T06:34:47.27+00:00

I have 2 VMs in a shared virtual network which I'm setting up to have the same software. I want to make a port available from the internet, so I make an iptables rule in the Linux host OS and then also add a rule to allow the connection in the Azure Firewall (from the Networking tab of the VMs blade in the portal)

I have them both configured the same with regard to this port, and I can connect to that port from any other server within the virtual network using the internal IP address (10.x.x.x), so I know the iptables configuration is correct. Plus they both match.

If I try to connect from outside the virtual network using the Public IP address (20.x.x.x) it succeeds for one server but fails for the second. e.g. using curl to connect to that port from my personal laptop.

I've attached screenshots of the portal blades below, showing the virtual network, and the firewall configurations for the two VMs. "spdmwdeusd0" works, "sdpmwdeust0" fails.

sdpmvnet

wd-d0-networking

wd-t0-networking

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,035 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,772 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Totman 0 Reputation points
    2023-05-24T05:41:16.9966667+00:00

    Regarding the public IP addresses, each VM is associated with a "load balancer" which is connected to that public IP address. I don't know why, I assume as part of our migration, as we have not set up any extra machines for load balancing, each VM is a single machine.

    When I checked on that I discovered my problem. Inbound NAT Rules on the load balancer for the non-working server sdpmwdeust0. Once I added a corresoponding rule there for the port I needed, 4984, it worked from the public internet.

    I realize now that the main status pages for the VMs would've made that clearer.

    Thank you for you questions which lead me to my answer.


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.