Here's how to set up an 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: Set up remote sharing
Open the desktop Sharing in the/usr/share/applications directory and set the following:
650) this.width=650; "src=" Http://img.it610.com/image/info2/dbe5906dcd974fc38aae828edec7862a.jpg "alt=" Remote connection to Ubuntu 14.04 desktop environment via VNC under Windows-2nd picture "/>
* For ubuntu14.04 and above, secure access settings are required:
1. Install Dconf-editor:
sudo apt-get install Dconf-editor
2. Counter-select prompt-enabled and require-encryption:
650) this.width=650; "src=" Http://img.it610.com/image/info2/7f155bf45f6042fd9a0f12f0e38e31b0.jpg "alt=" Remote connection to Ubuntu 14.04 desktop environment via VNC under Windows-4th picture "/>
Step 3: Set iptables port mappings
Since XRDP is connected using port 3389, the extranet is not able to connect directly to the Ubuntu virtual machine, so you need to set up the iptables port mapping in the host.
1. View the network information in the virtual machine:
Terminal Invoke command: Nm-tool
You can see the IP address and the gateway address.
2. 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 33899-j SNAT--to gateway address
* 33899 in the first rule above is not fixed, you can use any unused port
Step 4: Connect an Ubuntu virtual machine using the Remote connection tool
The address at the time of connection is: Host IP address: 33899
* Note 33899 This port needs to be consistent with the ports used in the previous setup Iptables port mapping rules
With the 4 steps above, we can remotely connect to a virtual machine from the outside network
Remotely connect an Ubuntu virtual machine via the XRDP protocol