Error trying to use zrok for remote desktop

Hello, ive just started using zrok and i have the standard plan.
I am trying to visit a remote desktop on my linux odroid from a windows computer.
Ive started the share session using:
zrok share private --backend-mode tcpTunnel 192.168.x.x:22 (with my local ip addres of the linux).
I open the share session on the windows using:
zrok access private key
the connection is set up properly.
The problem is when I am trying to connect via the remote desktop application on windows.

I get this error on the windows machine:
-top screen: Wednesday, 14-Aug-24 13:32:08 CEST 127.0.0.1:49980 -> ACCEPT r1x7utarlwuf
-bottom screen: [ 20.366] ERROR zrok/endpoints.TXer: read error '127.0.0.1:49980' -> 'ziti-edge-router connId=1, logical=ziti- sdk[router=tls:f12da3a5-c651-4dbe-ace0-67723a5dda65.production.netfoundry.io:443]': read tcp 127.0.0.1:9191- >127.0.0.1:49980: wsarecv: De externe host heeft een verbinding verbroken.

I get this on the hosting linux machine:
β”‚[7815.942] ERROR zrok/endpoints.TXer: read error '192.168.129.167:22' -> 'ziti-edge-router connId=2147483650, logical=ziti-sdk[router=tls:ad2b1ffe-8cee-465d-b3fc-8d1100bb5f32.production.netfoundry.io:443]': β”‚
β”‚read tcp β”‚
β”‚192.168.129.167:58284->192.168.129.167:22: read: connection reset by peer

sometimes i also get:
β”‚[1170.689] ERROR zrok/endpoints.TXer: read error '192.168.129.167:22' -> 'ziti-edge-router connId=2147483648, logical=ziti-sdk[router=tls:ad2b1ffe-8cee-465d-b3fc-8d1100bb5f32.production.netfoundry.io:443]': β”‚
β”‚read tcp β”‚
β”‚192.168.129.167:40864->192.168.129.167:22: use of closed network connection

Does anybody know what is causing this?

Thanks in advance!

Hi @firn, welcome to the community and to zrok! (and OpenZiti)

You're certain that the "odroid remote desktop" will run on port 22? That's generally the port for ssh, not the port for remote desktop. Windows remote desktop uses 3389 by default, I don't know what odroid remote desktop is using.

I actually didn't know "odriod" was a thing until today, so I've never done this myself but my suspicion is that the zrok private share should not be using port 22.

In the meantime, I'll see if I can find any details on what port that should be, if not 22.

Maybe you are trying to ssh there, not "rdp"?

Hello, thanks for the swift reply!

I am in fact trying to use rdp but i didnt really find a guide for it.
This is also my first time trying to set up rdp so bear with me if i make mistakes :wink:
I kinda followed this: Sharing TCP and UDP Servers | Zrok

I'll try the other port you said.

Thanks!

Yeah, you did the zrok bits right for sure. Now you just need to discover whatever "remote desktop" is at the other end. Do you have the doc for the remote desktop you can share with me? I would guess that it's going to be VNC (port 5900), RDP (port 3389) or it will be some custom port number and some custom protocol.

Have you ever "remotely" conneted to the device? Like, not from zrok? If so what do you use and how did you do it? If I can find the ODROID doc, it should be clear...

Hello,

I am using xrdp on the desktop i want to connect to.
I have never remotely connected before, everything i'm doing here is new so its kinda hard haha.

Thanks,
Firn

Cool. It looks like xRDP uses port 3389 so you should be able to use zrok exactly as you're intending to. Let me know if you share 3389, then access that share and remote desktop doesn't work for you.

I just tried it out.
it says on the host computer:
509.243] ERROR zrok/endpoints/tcpTunnel.(*Backend).handle: error dialing '192.168.129.167:3389': dial tcp 192.168.129.167:3389: connect: connection refused

and on the windows computer still the "use of closed network connection "error.
Could this be because of how my internet is set up?

Thank you!

I just got a different error:
β”‚[ 32.864] ERROR zrok/endpoints.TXer: write error '127.0.0.1:50218' -> 'ziti-edge-router connId=2, logical=ziti- β”‚
β”‚sdk[router=tls:ad2b1ffe-8cee-465d-b3fc-8d1100bb5f32.production.netfoundry.io:443]': calling Write() after CloseWrite()

I'm setting up xRDP on my ubuntu machine and I'll give it a try. Gimme a few to make sure it works on ubuntu at least ...

Alright, thanks!
Take your time :slight_smile:

Ok, I am sure I know what you did wrong and I didn't catch it at first... My bad.

On the host machine

share port 3389:

zrok share private --backend-mode tcpTunnel 127.0.0.1:3389

On the local machine

you need to use --bind to change the port OR you can use the default port :9191 if you wish. I think it'll be more instructive here to change the port to 30000+3389 == 33389:

zrok access private fdd8p1lzbvip --bind 127.0.0.1:33389

Now open RDP and RDP to localhost:33389 and presto you'd be connected... That looks like what you did because I am ALSO getting:

[  16.337]   ERROR zrok/endpoints.TXer: read error '127.0.0.1:3389' -> 'ziti-edge-router connId=2147483648, logical=ziti-sdk[router=tls:def60534-ff9a-44db-bb9e-46b65c67b5ce.production.netfoundry.io:443]': read tcp 127.0.0.1:34404->127.0.0.1:3389: use of closed network connection

RDP seems to be triggering a bug we will have to fix... I'm going to try an older version of zrok to see if it worked before.

I have SSH and XRDP running...

$ sudo ufw status
Status: active

To Action From


3389 ALLOW 188.206.65.132
22/tcp ALLOW Anywhere
3389 ALLOW 188.206.67.6
...
3389 ALLOW Anywhere
...
3389/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
...
3389 (v6) ALLOW Anywhere (v6)
...
3389/tcp (v6) ALLOW Anywhere (v6)

$ ssh 127.0.0.1
firn@127.0.0.1's password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 6.5.0-44-generic x86_64)

$ systemctl status xrdp
● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2024-08-14 06:07:35 UTC; 6h ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Process: 909 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
Process: 928 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 950 (xrdp)
Tasks: 1 (limit: 18779)
Memory: 1.8M
CPU: 13ms
CGroup: /system.slice/xrdp.service
└─950 /usr/sbin/xrdp

I had no problem with ssh'ing from my machine to the remote fwiw. Somehow RDP is triggering some kind of bug though, it seems. I can't get past the login screen. Although I can connect and enter my creds, it fails after that.

do you have any better recomendations?

The more I played with it, the more I think this is actually Windows RDP --> xRDP related. I'm playing around with it right now. I'm gonna tinker with it for a bit to see if i can get it working and I'll follow up in a bit

In fact - this was a problem of my own and it's working fine now: networking - XRDP disconnects immediately after correct credentials - Ask Ubuntu

Based on your description of the problem, this could be due to the fact that you are already logged in into your Ubuntu and you are trying to use the same user account to make your remote desktop connection.

It's not possible (with xRDP software) to use the same user account and login at the same time on Ubuntu locally and perform a remote connection...

So it ended up workign fine, but I needed to log out of my interactive session first.
xrdp

1 Like

Are there better alternatives where this is possible?

No clue. That's outside the scope of using zrok though. It had nothing to do with zrok... it was xrdp + rdp.

how do you start a connection, then close your interactive session?
Also should i keep using the commands i used to start sessions and access them?
Because i saw your command wasnt exactly the same

I used both commands I posted here: Error trying to use zrok for remote desktop - #11 by TheLumberjack

I had started a VM, installed xRDP and then tried to use window's remote desktop client and zrok on windows. It would connect, I would enter my credentials and immediately get disconnected. I got disconnected because xRDP only allows one session. To fix this, I just went to my current ubuntu session and "logged out" of that session. Just like you do in Windows. (Windows has the same 'limit' of one session per user too btw).

I don't know what other virtual desktop type software is out there that might allow you to have more than one desktop session. It's not something I've ever tried. I'd wager there are others out there, I just don't know. If you find one and it works though, let us know! :wink: