Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Remotely connect the ubuntu virtual machine through the xrdp protocol

Shulou Source: shulou.com Published: 2022-06-01 02:00:09 10月04日 Update

The following will describe how to set up the ubuntu virtual machine to allow other machines to connect remotely. The steps here are for ubuntu12.04.

Step 1: install the xrdp protocol

Sudo apt-get install xrdp vnc4server xbase-clients

Step 2: setting up remote sharing

Open Desktop Sharing in the / usr/share/applications directory and make the following settings:

* for ubuntu14.04 or above, secure access settings are required:

1. Install dconf-editor:

Sudo apt-get install dconf-editor

two。 Invert prompt-enabled and require-encryption:

Step 3: set iptables port mapping

Because the xrdp uses port 3389 to connect, but the external network can not directly connect to the ubuntu virtual machine, it is necessary to set the iptables port mapping in the host.

1. View the network information in the virtual machine:

Terminal call command: nm-tool

You can see the ip address and the gateway address.

two。 Set iptables port mapping rules

Iptables-t nat-I PREROUTING-d host IP address-p tcp-- dport 33899-j DNAT-- to-destination virtual machine IP address: 3389

Iptables-t nat-I POSTROUTING-d virtual machine IP address-p tcp-- dport 3389-j SNAT-- to-source gateway address

* 33899 in the first rule above is not fixed and any unoccupied port can be used.

Step 4: connect the ubuntu virtual machine using the remote connection tool

The address when connecting is: host IP address: 33899

* Note that port 33899 needs to be consistent with the port used in the previous iptables port mapping rules.

Through the above four steps, we can remotely connect to the virtual machine from the external network.

Tags: Address port host rules steps gateway consistency security information commands tools time machines directories terminals networks facets central settings Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Docker MySQL macOS OPPO Reno