Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cannot connect to QEMU VM over VNC within same network.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dartleader
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2019
Posts: 118

PostPosted: Fri Apr 09, 2021 12:59 am    Post subject: Cannot connect to QEMU VM over VNC within same network. Reply with quote

EDIT: SOLVED. Solution was to use vncviewer's -via functionality to connect across ssh.

Hello everyone,

I'm trying to host a number of virtual machines on my server at home using QEMU. When I have a test virtual machine running, it runs on the default port 5900, and I am able to see the service running from another machine within my local network, but am unable to join.

Output of scanning the remote server from my client machine:
Code:
 Starting Nmap 7.91 ( https://nmap.org ) at 2021-04-08 21:42 ADT
Nmap scan report for remote-server (192.168.1.101)
Host is up (0.00036s latency).

PORT     STATE  SERVICE VERSION
5900/tcp closed vnc

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1.64 seconds


When I try to connect to port 5900 with tigervnc's vncviewer, I get a 'connection refused' error - to nobody's surprise since the port is closed.

I have uncommented the line in /etc/libvirt/qemu.conf to allow vnc to listen to "0.0.0.0", which it states will cause it to listen to all addresses, but it has no effect.

QEMU and VNC work as expected when run on the same machine (ie: hosted on localhost), but I would like to migrate my VMs to my server and be able to connect to them remotely over wireguard.

Any help would be greatly appreciated! Thank you very much!


Last edited by dartleader on Fri Apr 09, 2021 12:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Fri Apr 09, 2021 3:02 am    Post subject: Reply with quote

Is there a firewall on your server or on your client machine? Firewalls can cause 'closed' ports in the output of nmap.

Please run the commands below and post only the '5900/tcp' line of the output:
  1. On your client machine:
    Code:
    nmap -d 192.168.1.101

  2. On your server:
    Code:
    nmap -d 192.168.1.101

  3. On your server:
    Code:
    nmap -d 127.0.0.1
Back to top
View user's profile Send private message
dartleader
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2019
Posts: 118

PostPosted: Fri Apr 09, 2021 4:40 am    Post subject: Reply with quote

Hi Mike, output of nmap:

From client:
nmap -d 192.168.1.101 -p 5900 | rg 5900
Code:
5900/tcp closed vnc     conn-refused


From server:
nmap -d 192.168.1.101 -p 5900 | rg 5900
Code:
5900/tcp closed vnc     conn-refused


nmap -d 127.0.0.1 -p 5900 | rg 5900
Code:
5900/tcp open vnc     syn-ack


Evidently it's open to the localhost but refuses other connections.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Fri Apr 09, 2021 10:24 am    Post subject: Reply with quote

Thanks for the data.

What happens if you start vncviewer on your client machine with
Code:
vncviewer -via <your_username>@192.168.1.101 127.0.0.1::5900

That should work :)
Back to top
View user's profile Send private message
dartleader
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2019
Posts: 118

PostPosted: Fri Apr 09, 2021 12:25 pm    Post subject: Reply with quote

mike155 wrote:
What happens if you start vncviewer on your client machine with
Code:
vncviewer -via <your_username>@192.168.1.101 127.0.0.1::5900

That should work :)


Works great! Thanks for your help Mike!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum