Friday, August 8, 2008

Remote Desktop to a Virtual Machine

A little while ago I tried to Remote Desktop to a Windows XP Virtual Machine (hosted on a Gentoo Linux system) from work, and it wouldn't connect. I knew I could Remote Desktop from my WinXP workstation, so I found out that I could still get in by Remote Desktopping to my workstation, then using Remote Desktop on the workstation to get to the VM.

That's a terrible work-around though, so I looked around for a proper solution. One of my friends told me a possible fix, I tried it, and it worked. You have to write "1" to /proc/sys/net/ipv4/ip_forward. This makes it so that the host OS will accept traffic not intended for itself, and forward it to the VMware net interfaces.

Here is the /etc/init.d script I used to make this happen automatically:
#!/sbin/runscript
start() {
ebegin "Starting ${SVCNAME}"
echo 1 >> /proc/sys/net/ipv4/ip_forward
eend $?
}

stop() {
ebegin "Stopping ${SVCNAME}"
eend $?
}

Haven't had an issue since.