docker-in-termux icon indicating copy to clipboard operation
docker-in-termux copied to clipboard

Help with VNC connection

Open edemir206 opened this issue 10 months ago • 1 comments

I'm stuck in part 7: qemu-system-x86_64 -machine q35 -m 1024 -smp cpus=2 -cpu qemu64 -drive if=pflash,format=raw,read-only=on,file=$PREFIX/share/qemu/edk2-x86_64-code.fd -netdev user,id=n1,dns=8.8.8.8,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1 -cdrom alpine-virt-3.19.0-x86_64.iso -nographic alpine.img

When I run the command above it says: VNC server running on 127.0.0.1:5900

But I can't access the VNC server using a VNC viewer from my PC using the 192.168.100.X ... address

Am I missing something ?

edemir206 avatar Apr 02 '24 15:04 edemir206

To make the VNC server accessible from your termux, you need to bind it to an IP address that is reachable from your local network. Here's how you can modify the command:

qemu-system-x86_64 -machine q35 -m 1024 -smp cpus=2 -cpu qemu64 -drive if=pflash,format=raw,read-only=on,file=$PREFIX/share/qemu/edk2-x86_64-code.fd -netdev user,id=n1,dns=8.8.8.8,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1 -cdrom alpine-virt-3.19.0-x86_64.iso -nographic -vnc :1 -monitor telnet:127.0.0.1:1234,server,nowait alpine.img

In this modified command:

  • -vnc :1 binds the VNC server to display :1, making it accessible remotely.
  • You can change the :1 to any suitable display number.
  • -monitor telnet:127.0.0.1:1234,server,nowait opens a telnet monitor interface on the localhost. You can use this to manage the virtual machine.
  • Replace 127.0.0.1 with 0.0.0.0 to bind it to all interfaces if you want to access it from any IP on the network.

After modifying the command as shown above, try connecting to the VNC server from your termux using the IP address of the machine where the QEMU virtual machine is running, along with the corresponding display number (e.g., 192.168.100.X:1).

Send error's screenshot if you encounter any further errors.

dev-bittu avatar Apr 02 '24 23:04 dev-bittu