how to connect from win11 to linux server using openvpn

177 views Asked by At

I want to connect from win-11 to a linux server, using openvpn. Here are the following things that I have tried, each step having its unique errors:

(a) First, I installed openvpn from community-downloads [https://openvpn.net/community-downloads/], that version is 2.6.7-amd64.msi. That is not connecting to the server. I looked up for solutions, one person said this is a known problem and the x86 version works, but my win11 refuses to install the x86 msi.

(b) Then I installed version 3.4.2 from https://openvpn.net/client/client-connect-vpn-for-windows/ This also did not connect. After searching a bit, I found a solution that I have to enter the line "disable-dco" in the ovpn file. After entering that line, it connected. Then I opened "cmd", and using "ssh -X [email protected]" opened a terminal on my linux server. But when I opened a GUI application, I got the error: Cannot open display. DISPLAY not set.

(c) Then I tried to use wsl2(ubuntu22.04) to install and use openvpn. I installed with "sudo apt install openvpn", the version installed was 2.5.5. Then I tried to connect using "sudo openvpn --config myfile.ovpn". Now this version gave error: "unrecognized option disable-dco". So I deleted that line for using with wsl, and tried again, and this worked. However, when I tried to run a GUI application on the server, I got the same error for DISPLAY.

(d) for setting DISPLAY on the wsl option (c above), I did the following:

- on local windows-wsl: hostname --> the name given was "my-win"
- on server, after connecting and opening a terminal in wsl-ubuntu: export DISPLAY=my-win:0.0
- I also tried export DISPLAY=":0.0" - that also did not work
- But even with that I am getting the same display error.

Now for my question: I could connect from win11 to linux using openvpn. But how do I set DISPLAY to get it working for my GUI applications?

1

There are 1 answers

0
R71 On

While debugging the problem, I also tried to see if x11 apps were running on my wsl-ubuntu. So I installed x11-apps, and then tried to run xeyes - again the same problem - "Cant open DISPLAY".

So the problem was local, and nothing to do with openvpn. I found the solution here. After implementing those suggestions, the problem was solved.