Cannot RDP to CentOS 7 Host (Headless)

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Novice2016
Posts: 4
Joined: 5. Dec 2016, 10:23

Cannot RDP to CentOS 7 Host (Headless)

Post by Novice2016 »

Hi,
I have created my Windows XP VM and it can boot into the DVD. However, I am unable to connect to my Windows XP VM (Guest) on my CentOS (Host) machine from my Windows 8 using Remote Desktop. I used tcpdump on the port 5000 on CentOS and I can see there is an incoming connection from my Windows 8 machine. After three tries, my Windows 8 's Remote Desktop gives up. Same thing happened if I try to connect using telnet on my Windows 8 Machine.

My question is: are we supposed to run only VMs with their operating systems installed? the VM I am trying to connect to does not have its XP installed yet.
I wonder if that is why no response to the Remote Desktop.

Please help...


Thanks


Novice
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Cannot RDP to CentOS 7 Host (Headless)

Post by Perryg »

vRDP is a special protocol that VirtualBox uses for just this kind of communications and it requires you setup the port in the guest settings and then you us the host IP + the user defined port to access the guest to allow for this kind of setup.
Extension pack must be installed on the host. See http://www.virtualbox.org/manual/ch07.html
Novice2016
Posts: 4
Joined: 5. Dec 2016, 10:23

Re: Cannot RDP to CentOS 7 Host (Headless)

Post by Novice2016 »

Recap:
CentOS 7 is the host OS running on a PC
Windows XP is the Guest OS using bridged network
I am trying to connect to Windows XP (Guest) from a Windows Machine (Client) using Remote Desktop, but failed after 3 tries.
I also try to connect using "telnet 192.168.138.120 5000", but failed after 3 tries.


I did installed the expansion pack and setup the port. I am using root for simplicity sake.
Here is the list of commands:

Download the VirtualBox Expansion Pack
Download from VirtualBox: /virtualbox/5.1.10/Oracle_VM_VirtualBox_Extension_Pack-5.1.10-112026.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.1.10-112026.vbox-extpack

Verify Expansion pack is installed
VBoxManage list extpacks -> It shows Usable is true


Set VM directory
VBoxManage setproperty machinefolder /virtualbox

Create a VM
VBoxManage createvm --name "Windows XP 64 Bit" --ostype WindowsXP_64 --register


Specify the boot device and network settings
VBoxManage modifyvm "Windows XP 64 Bit" --memory 1024 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 enp4s0


Create a VM 's hard drive
VBoxManage createhd --filename "WindowsXP64.vdi" --size 10000

Add a SATA Controller to the new VM
VBoxManage storagectl "Windows XP 64 Bit" --name "SATA Controller" --add sata


Set the VDI file created above as the first virtual hard disk of the new VM:
VBoxManage storageattach "Windows XP 64 Bit" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "WindowsXP64.vdi"

Attach the ISO file that contains the operating system installation that you want to install later to the virtual machine, so the machine can boot from it:
VBoxManage storageattach "Windows XP 64 Bit" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium /root/download/VirtualBox/WindowsXP64.iso

Enable VirtualBox remote desktop extension (the VRDP server):
VBoxManage modifyvm "Windows XP 64 Bit" --vrde on

Start the virtual machine using VBoxHeadless:
VBoxHeadless --startvm "Windows XP 64 Bit"

Change the listening port to between 5000 to 6000 instead of the default 3369
VboxManage modifyvm "Windows XP 64 Bit" --vrdeport 5000-6000

Connect to the Windows XP (Guest) from the Windows 8 (Client):
mstsc 192.168.138.120:5000


Monitor any incoming connection to the CentOS Host:
tcpdump -i any -v port 5000


I have not added root to the vboxusers group, but I don't think it matters (at least not yet) since all I am doing is trying to RDP with only 192.168.138.120:5000 as the parameter, but no connection is established.

Are there any additional steps that I need to do such as configuring the bridged network or if the guest (Windows XP) is assigned a different IP address (I don't have a firm grasp of these different networking modes)?


Please help

Novice...
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Cannot RDP to CentOS 7 Host (Headless)

Post by Perryg »

First never run Linux as root. You don't need it and it will make your life harder not to mention the security aspect. Since you must go through the host to actually install the guest this way you need to make sure what ever port you are using is actually open. Most likely it is not since CentOS turns off all ports by default.
Novice2016
Posts: 4
Joined: 5. Dec 2016, 10:23

Re: Cannot RDP to CentOS 7 Host (Headless)

Post by Novice2016 »

Perryg wrote:First never run Linux as root. You don't need it and it will make your life harder not to mention the security aspect. Since you must go through the host to actually install the guest this way you need to make sure what ever port you are using is actually open. Most likely it is not since CentOS turns off all ports by default.
It works now! you fixed my problem! :D
I actually had done this before, but it did not work earlier. The issue was I have to add --permanent at the end of the firewall-cmd. Without it, the rule will not be applied successfully even after I ran "firewall-cmd --reload".


Thanks again!

Novice
Post Reply