Use FRP (Fast Reverse Proxy) to Improve Windows MSTSC Access Ubuntu xRDP Experience

Windows RDP program MSTSC has a compatibility issue with xRDP application in Linux.  Based on our testing with previous posts :

RDP experience will have lagging feeling especially the sound delayed a lot. You can feel that when you are playing a YouTube video as show in my previous posts. Actually,  tt is not networking issue, not bandwidth or Oracle ARM platform's CPU or memory related hardware issue. ARM machine provided by Oracle cloud is enough powerful to support YouTube 1080p playback.

After did some research, I found a workaround for this issue. In this post, I am going to show this solution by using FRP program to fix this issue. 

frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. As of now, it supports TCP and UDP, as well as HTTP and HTTPS protocols, where requests can be forwarded to internal services by domain name. frp also has a P2P connect mode.

Architecture

architecture

Download latest FRP package and Extract it

FRP Github Link: https://github.com/fatedier/frp/releases/

a.png

Please find out the right version from the list. Each version release contains both components, frps and frpc. If you use Oracle cloud ARM vm, pleae choose linux_arm64 version. For example, if you use Tencent Cloud as the server, then Tencent Cloud is amd64, and Oracle ARM is arm64. Pay attention to the version when throwing it on your own machine! !

Again, frps is the server and frpc is the client.

Following command is to download version 0.39.0. You can check the Github release to find out latest version.

root@ubuntu:~# wget https://github.com/fatedier/frp/releases/download/v0.39.0/frp_0.39.0_linux_arm64.tar.gz

Configure frpc - Client side

1. Unzip the package and put the following files in the /etc/frp directory

root@ubuntu:~# tar -xvf frp_0.39.0_linux_arm64.tar.gz

6.jpg

2. Modify the frpc.ini file

root@ubuntu:/etc/frp# cp /root/frp_0.39.0_linux_arm64/frps .
root@ubuntu:/etc/frp# ls
frpc frpc_full.ini frpc.ini frps frps_full.ini frps.ini
root@ubuntu:/etc/frp# nano frpc.ini

[common]
server_addr = 127.0.0.1
#(For internal forwarding, use 127.0.0.1. If you use other Cloud provider for server forwarding, fill in their Cloud's IP)
server_port = 7000
token = 12345678


[13389]
type = tcp
remote_port = 13389
local_ip = 127.0.0.1
local_port = 3389

3. Put frpc.service in the systemd folder under /etc/systemd/system.

Copy frpc.server and set permissions

root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cp frpc.service /etc/systemd/system/.
root@ubuntu:/etc/systemd/system# chmod 754 frpc.service

Set to boot to start this service

root@ubuntu:/etc/systemd/system# systemctl enable frpc.service

4. In the /etc/frp directory

root@ubuntu:/etc/systemd/system# cd /etc/frp
root@ubuntu:/etc/frp# ls
frpc frpc_full.ini frpc.ini frps frps_full.ini frps.ini
root@ubuntu:/etc/frp# cp frpc /usr/bin
root@ubuntu:/etc/frp# chmod +x /usr/bin/frpc
root@ubuntu:/etc/frp# systemctl start frpc
root@ubuntu:/usr/bin# ps -ef | grep frpc
root 46955 512 0 18:32 pts/0 00:00:00 grep --color=auto frpc
root@ubuntu:/etc/frp#

Configure frps - Server side

1. Unzip the package and put the following files into the /etc/frp directory

7.jpg

2. Modify the frps.ini file 

root@ubuntu:/etc/systemd/system# nano frps.ini

[common]
bind_port = 7000
token = 12345678

3. Copy  frps.service which is under unzipped systemd folder, into /etc/systemd/system folder

root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cp frpc.service /etc/systemd/system/.
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cd /etc/systemd/system/

Set permissions

root@ubuntu:/etc/systemd/system# chmod 754 frps.service

Enable it start frps.service after boot system.

root@ubuntu:/etc/systemd/system# systemctl enable frps.service
Created symlink /etc/systemd/system/multi-user.target.wants/frps.service -> /etc/systemd/system/frps.service.

4. In the /etc/frp directory

root@ubuntu:/etc/systemd/system# cd /etc/frp
root@ubuntu:/etc/frp# ls
frpc frpc_full.ini frpc.ini frps frps_full.ini frps.ini
root@ubuntu:/etc/frp# cp frps /usr/bin
root@ubuntu:/etc/frp# chmod +x /usr/bin/frps
root@ubuntu:/etc/frp# systemctl start frps
root@ubuntu:/etc/frp# ps -ef|grep frps
nobody 47406 1 12 18:33 ? 00:00:00 /usr/bin/frps -c /etc/frp/frps.ini
root 47412 512 0 18:33 pts/0 00:00:00 grep --color=auto frps
root@ubuntu:/etc/frp#

Configure RDP from Windows MSTSC 

Oracle Security Group Open 13389 Port

Since we are using 13389 port for our RDP connection, which will be redirect to local 3389 port, we will need to open 13389 from our network security group.

Here is an example to create a rule for it. 

All Commands and Outputs

root@ubuntu:~# wget https://github.com/fatedier/frp/releases/download/v0.39.0/frp_0.39.0_linux_arm64.tar.gz
--2022-02-06 18:25:11--  https://github.com/fatedier/frp/releases/download/v0.39.0/frp_0.39.0_linux_arm64.tar.gz
Resolving github.com (github.com)... 140.82.113.3
Connecting to github.com (github.com)|140.82.113.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/48378947/b19b9111-ba77-4f11-a607-03da521c21b8?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220206T232511Z&X-Amz-Expires=300&X-Amz-Signature=58f4a525f7b347bdb08bb10d3a90eeb12ebea1e101fa41503eb6e8ac86b229c0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=48378947&response-content-disposition=attachment%3B%20filename%3Dfrp_0.39.0_linux_arm64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-02-06 18:25:11--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/48378947/b19b9111-ba77-4f11-a607-03da521c21b8?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220206T232511Z&X-Amz-Expires=300&X-Amz-Signature=58f4a525f7b347bdb08bb10d3a90eeb12ebea1e101fa41503eb6e8ac86b229c0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=48378947&response-content-disposition=attachment%3B%20filename%3Dfrp_0.39.0_linux_arm64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8183571 (7.8M) [application/octet-stream]
Saving to: 'frp_0.39.0_linux_arm64.tar.gz'

frp_0.39.0_linux_arm64.tar.gz                              100%[=====================================================================================================================================>]   7.80M  19.0MB/s    in 0.4s

2022-02-06 18:25:12 (19.0 MB/s) - 'frp_0.39.0_linux_arm64.tar.gz' saved [8183571/8183571]

root@ubuntu:~# ls
frp_0.39.0_linux_arm64.tar.gz  install.sh  snap
root@ubuntu:~# tar -xvf archive.tar.gz
tar: archive.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
root@ubuntu:~# tar -xvf frp_0.39.0_linux_arm64.tar.gz
frp_0.39.0_linux_arm64/
frp_0.39.0_linux_arm64/frps
frp_0.39.0_linux_arm64/frps_full.ini
frp_0.39.0_linux_arm64/systemd/
frp_0.39.0_linux_arm64/systemd/[email protected]
frp_0.39.0_linux_arm64/systemd/[email protected]
frp_0.39.0_linux_arm64/systemd/frpc.service
frp_0.39.0_linux_arm64/systemd/frps.service
frp_0.39.0_linux_arm64/LICENSE
frp_0.39.0_linux_arm64/frpc.ini
frp_0.39.0_linux_arm64/frpc_full.ini
frp_0.39.0_linux_arm64/frps.ini
frp_0.39.0_linux_arm64/frpc
root@ubuntu:~# ls
frp_0.39.0_linux_arm64  frp_0.39.0_linux_arm64.tar.gz  install.sh  snap
root@ubuntu:~# cd frp_0.39.0_linux_arm64/
root@ubuntu:~/frp_0.39.0_linux_arm64# ls
frpc  frpc_full.ini  frpc.ini  frps  frps_full.ini  frps.ini  LICENSE  systemd
root@ubuntu:~/frp_0.39.0_linux_arm64# mkdir /etc/frp
root@ubuntu:~/frp_0.39.0_linux_arm64# pwd
/root/frp_0.39.0_linux_arm64
root@ubuntu:~/frp_0.39.0_linux_arm64# cd /etc/frp
root@ubuntu:/etc/frp# ls
frpc_full.ini  frpc.ini  frps_full.ini  frps.ini
root@ubuntu:/etc/frp# cp /root/frp_0.39.0_linux_arm64/frpc .
root@ubuntu:/etc/frp# cp /root/frp_0.39.0_linux_arm64/frps .
root@ubuntu:/etc/frp# ls
frpc  frpc_full.ini  frpc.ini  frps  frps_full.ini  frps.ini
root@ubuntu:/etc/frp# nano frpc.ini
root@ubuntu:/etc/frp#
root@ubuntu:/etc/frp# cd /root/frp_0.39.0_linux_arm64/
root@ubuntu:~/frp_0.39.0_linux_arm64# ls
frpc  frps  LICENSE  systemd
root@ubuntu:~/frp_0.39.0_linux_arm64# cd systemd/
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# ls
frpc.service  [email protected]  frps.service  [email protected]
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cp frpc.service /etc/systemd/system/.
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cd /etc/systemd/system/
root@ubuntu:/etc/systemd/system# ls
 bluetooth.target.wants               dbus-org.freedesktop.ModemManager1.service   display-manager.service   graphical.target.wants        rescue.target.wants       'snap-gnome/x2d3/x2d38/x2d2004-88.mount'    sysinit.target.wants
 cloud-final.service.wants            dbus-org.freedesktop.nm-dispatcher.service   emergency.target.wants    multi-user.target.wants       sleep.target.wants        'snap-gtk/x2dcommon/x2dthemes-1519.mount'   syslog.service
 dbus-fi.w1.wpa_supplicant1.service   dbus-org.freedesktop.resolve1.service        final.target.wants        network-online.target.wants   snap-bare-5.mount          snap-snapd-14553.mount                     timers.target.wants
 dbus-org.bluez.service               dbus-org.freedesktop.timesync1.service       frpc.service              paths.target.wants            snap-chromium-1897.mount   sockets.target.wants
 dbus-org.freedesktop.Avahi.service   default.target.wants                         getty.target.wants        printer.target.wants          snap-core20-1332.mount     sshd.service
root@ubuntu:/etc/systemd/system# chmod 754 frpc.service
root@ubuntu:/etc/systemd/system# ls
 bluetooth.target.wants               dbus-org.freedesktop.ModemManager1.service   display-manager.service   graphical.target.wants        rescue.target.wants       'snap-gnome/x2d3/x2d38/x2d2004-88.mount'    sysinit.target.wants
 cloud-final.service.wants            dbus-org.freedesktop.nm-dispatcher.service   emergency.target.wants    multi-user.target.wants       sleep.target.wants        'snap-gtk/x2dcommon/x2dthemes-1519.mount'   syslog.service
 dbus-fi.w1.wpa_supplicant1.service   dbus-org.freedesktop.resolve1.service        final.target.wants        network-online.target.wants   snap-bare-5.mount          snap-snapd-14553.mount                     timers.target.wants
 dbus-org.bluez.service               dbus-org.freedesktop.timesync1.service       frpc.service              paths.target.wants            snap-chromium-1897.mount   sockets.target.wants
 dbus-org.freedesktop.Avahi.service   default.target.wants                         getty.target.wants        printer.target.wants          snap-core20-1332.mount     sshd.service
root@ubuntu:/etc/systemd/system# systemctl enable frpc.service
Created symlink /etc/systemd/system/multi-user.target.wants/frpc.service -> /etc/systemd/system/frpc.service.
root@ubuntu:/etc/systemd/system# cd /etc/frp/
root@ubuntu:/etc/frp# ls
frpc  frpc_full.ini  frpc.ini  frps  frps_full.ini  frps.ini
root@ubuntu:/etc/frp# cp frpc /usr/bin
root@ubuntu:/etc/frp# cd /usr/bin
root@ubuntu:/usr/bin# ls frpc
frpc
root@ubuntu:/usr/bin# chmod +x /usr/bin/frpc
root@ubuntu:/usr/bin# systemctl start frpc
root@ubuntu:/usr/bin# ps -ef | grep frpc
root       46955     512  0 18:32 pts/0    00:00:00 grep --color=auto frpc
root@ubuntu:/usr/bin# cd /root/frp_0.39.0_linux_arm64/systemd/
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# ls
frpc.service  [email protected]  frps.service  [email protected]
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cp frps.service /etc/systemd/system
root@ubuntu:~/frp_0.39.0_linux_arm64/systemd# cd /etc/systemd/system/
root@ubuntu:/etc/systemd/system# ls
 bluetooth.target.wants               dbus-org.freedesktop.ModemManager1.service   display-manager.service   getty.target.wants            printer.target.wants       snap-core20-1332.mount                     sshd.service
 cloud-final.service.wants            dbus-org.freedesktop.nm-dispatcher.service   emergency.target.wants    graphical.target.wants        rescue.target.wants       'snap-gnome/x2d3/x2d38/x2d2004-88.mount'    sysinit.target.wants
 dbus-fi.w1.wpa_supplicant1.service   dbus-org.freedesktop.resolve1.service        final.target.wants        multi-user.target.wants       sleep.target.wants        'snap-gtk/x2dcommon/x2dthemes-1519.mount'   syslog.service
 dbus-org.bluez.service               dbus-org.freedesktop.timesync1.service       frpc.service              network-online.target.wants   snap-bare-5.mount          snap-snapd-14553.mount                     timers.target.wants
 dbus-org.freedesktop.Avahi.service   default.target.wants                         frps.service              paths.target.wants            snap-chromium-1897.mount   sockets.target.wants
root@ubuntu:/etc/systemd/system# chmod 754 frps.service
root@ubuntu:/etc/systemd/system# ls
 bluetooth.target.wants               dbus-org.freedesktop.ModemManager1.service   display-manager.service   getty.target.wants            printer.target.wants       snap-core20-1332.mount                     sshd.service
 cloud-final.service.wants            dbus-org.freedesktop.nm-dispatcher.service   emergency.target.wants    graphical.target.wants        rescue.target.wants       'snap-gnome/x2d3/x2d38/x2d2004-88.mount'    sysinit.target.wants
 dbus-fi.w1.wpa_supplicant1.service   dbus-org.freedesktop.resolve1.service        final.target.wants        multi-user.target.wants       sleep.target.wants        'snap-gtk/x2dcommon/x2dthemes-1519.mount'   syslog.service
 dbus-org.bluez.service               dbus-org.freedesktop.timesync1.service       frpc.service              network-online.target.wants   snap-bare-5.mount          snap-snapd-14553.mount                     timers.target.wants
 dbus-org.freedesktop.Avahi.service   default.target.wants                         frps.service              paths.target.wants            snap-chromium-1897.mount   sockets.target.wants
root@ubuntu:/etc/systemd/system# systemctl enable frps.service
Created symlink /etc/systemd/system/multi-user.target.wants/frps.service -> /etc/systemd/system/frps.service.
root@ubuntu:/etc/systemd/system# cd /etc/frp
root@ubuntu:/etc/frp# ls
frpc  frpc_full.ini  frpc.ini  frps  frps_full.ini  frps.ini
root@ubuntu:/etc/frp# cp frps /usr/bin
root@ubuntu:/etc/frp# chmod +x /usr/bin/frps
root@ubuntu:/etc/frp# systemctl start frps
root@ubuntu:/etc/frp# ps -ef|grep frps
nobody     47406       1 12 18:33 ?        00:00:00 /usr/bin/frps -c /etc/frp/frps.ini
root       47412     512  0 18:33 pts/0    00:00:00 grep --color=auto frps
root@ubuntu:/etc/frp#


版权声明:
作者:玉兰
链接:https://www.techfm.club/p/19930.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>