Score:0

Can't connect to my virtual Ubuntu Server via WebSocket on specified port from the host machine

ph flag

I have an Ubuntu Server (Ubuntu 20.04.2 LTS) installed on Hyper-V with External interface, it has its own IP. I connect to it with Putty via SSH and it works.

On that machine I installed my own service that works as a WebSocket server listening on port 50000.

I tested it with a client working on the same VM, connecting to ws://localhost:50000/. It works.

Then I ran the same test client from my host, connecting to ws://ubuntu-vm:50000/. The DNS entry ubuntu-vm resolves to my VM external IP. I use it to connect to VM with Putty.

ping ubuntu-vm of course works correctly.

Here's the detailed error message I get:

HttpRequestException: No connection could be made because the target machine actively refused it. (ubuntu-vm:50000)

Somewhere else I read I need to add a rule to Ubuntu Firewall, so I did it:

sudo ufw allow from any to any port 50000 proto tcp
sudo ufw allow from any to any port 50000 proto udp

It didn't help. It works from VM, it doesn't work from the host that sees VM, pings VM and connects to VM via SSH.

IDK, maybe the problem is specific to Hyper-V, but maybe there's something in my server configuration I could try?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.