TechBuzzPro

how to access virtual machine from another computer

· 6 min read · Windows & PC

In this article
  1. What You’ll Need
  2. Step‑By‑Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes—you can access a virtual machine (VM) from another computer by connecting over the network with protocols such as Remote Desktop Protocol (RDP), Secure Shell (SSH), or a VPN tunnel. The VM must have a network address that the remote computer can reach, and the appropriate service must be enabled and allowed through any firewalls.

What You’ll Need

  • A running virtual machine with an operating system that supports remote access (Windows, Linux, etc.).
  • Network connectivity between the host machine (where the VM runs) and the remote computer – either on the same LAN or via the internet.
  • Remote‑access credentials (username/password or SSH key).
  • RDP client (built‑in on Windows, Microsoft Remote Desktop for macOS/iOS/Android) or an SSH client (PuTTY, OpenSSH, Termius, etc.).
  • If you are connecting over the internet, a VPN server or a properly configured router with port forwarding.
  • Administrative rights on the host to adjust firewall or network settings.

Step‑By‑Step

  1. Determine the VM’s IP address. Inside the VM, open a command prompt or terminal and run ipconfig (Windows) or ip a (Linux). Write down the IPv4 address; you will use it as the destination for the remote client.
  2. Enable the appropriate remote service.
    • For a Windows VM, open Settings > System > Remote Desktop and toggle “Enable Remote Desktop”. Confirm the option to allow connections from any version of Remote Desktop if you need compatibility.
    • For a Linux VM, ensure the SSH daemon is installed (e.g., sudo apt install openssh-server) and running (sudo systemctl enable --now ssh).
  3. Adjust the VM’s firewall. Allow inbound traffic on the port used by the remote protocol.
    • Windows: open Windows Defender Firewall > Advanced Settings, create a new inbound rule for TCP port 3389 (RDP).
    • Linux: run sudo ufw allow 22/tcp for SSH, or modify /etc/ssh/sshd_config if you use a non‑standard port.
  4. Configure the host’s network mode. In the virtualization platform (VirtualBox, VMware, Hyper‑V, etc.), set the VM’s network adapter to “Bridged” if you want the VM to obtain its own address on the physical LAN. If you keep “NAT”, you will need to set up port‑forwarding on the host.
    • Example for VirtualBox: Settings > Network > Adapter 1 > Attached to: Bridged Adapter.
  5. Test local connectivity. From another computer on the same LAN, open the RDP client and enter the VM’s IP address, then click Connect. For SSH, run ssh user@VM_IP. If the login prompt appears, the basic connection works.
  6. Set up remote access over the internet (optional).
    • Configure your router to forward the remote‑access port to the VM’s IP address (e.g., forward TCP 3389 to 192.168.1.45 for RDP, or TCP 22 for SSH).
    • Because exposing RDP or SSH directly to the internet can be risky, it is strongly recommended to place a VPN server on the network (e.g., OpenVPN, WireGuard, or the built‑in Windows Server VPN). Connect the remote computer to the VPN first, then use the same local IP address as in step 5.
  7. Connect from the remote location. After the VPN is active (or after port forwarding is verified), launch the same client as in step 5 and use the public IP address of your router (or a dynamic DNS name) followed by the forwarded port if you changed it.
    • Example for RDP with a custom port: myhome.dyndns.org:3390.
    • Example for SSH with a custom port: ssh -p 2222 user@myhome.dyndns.org.
  8. Secure the connection. Change default ports, use strong passwords or SSH keys, enable network‑level authentication (NLA) for RDP, and keep the VM’s OS and remote‑access software up to date.
  9. Document the configuration. Write down the IP address, port numbers, usernames, and any VPN credentials. Store this information in a secure password manager for future reference.

Common Mistakes

  • Leaving the VM in NAT mode without configuring port forwarding, which makes the VM invisible to other devices on the LAN.
  • Forgetting to open the firewall port; the client will time out even though the service is running.
  • Using the host’s IP address instead of the VM’s address when the VM is on a bridged adapter.
  • Exposing RDP on the default port 3389 directly to the internet without a VPN – this invites brute‑force attacks.
  • Not updating the SSH daemon or RDP client, leading to incompatibility or known security vulnerabilities.

Tips

  • Assign a static IP address to the VM (via the OS network settings or a DHCP reservation) to avoid having to look up a new address after each reboot.
  • Use SSH keys instead of passwords for Linux VMs; they are far more resistant to credential stuffing.
  • Enable Network Level Authentication for Windows RDP; it reduces the attack surface and speeds up login.
  • If you need to manage multiple VMs, consider a jump‑box (bastion host) that you SSH into first, then hop to the target VM.
  • Dynamic DNS services (e.g., No‑IP, DuckDNS) let you reach your home network with a memorable hostname even if the public IP changes.

Troubleshooting

If the connection times out: Verify that the VM’s IP address is correct and reachable by pinging it from the remote computer. Ensure the host firewall and the VM firewall both allow the chosen port. Restart the VM’s remote service (e.g., net stop termservice & net start termservice on Windows or sudo systemctl restart ssh on Linux).

If you see a “permission denied” or “authentication failed” message: Double‑check the username and password or SSH key. On Linux, confirm that the sshd_config file permits the authentication method you are using (e.g., PubkeyAuthentication yes). On Windows, verify that the account is a member of the Remote Desktop Users group.

If the remote client reports an “incompatible protocol” error: Make sure the RDP client version supports the server’s RDP version. For older Windows Server versions, you may need to enable “Legacy RDP” in the server’s settings.

If you cannot reach the VM from outside your home network: Confirm that port forwarding is correctly set on the router, and that the router’s public IP has not changed (use a site like whatismyip.com). Test the forward by using a mobile phone on cellular data and connecting to the public address.

If you suspect a firewall rule is blocking traffic: Temporarily disable the host’s firewall to see if the connection succeeds. If it does, re‑enable the firewall and add a specific rule for the remote port rather than leaving the firewall completely off.

If you experience frequent disconnections: Check for network latency or NAT timeout settings on the router. Some routers close idle TCP connections after a few minutes; enabling a keep‑alive interval on the client can mitigate this.

Frequently Asked Questions

Can I use RDP to connect to a Linux VM?

RDP is native to Windows, but you can install an RDP server on Linux (e.g., xrdp). After installation, enable the service and open port 3389, then connect with any standard RDP client.

Do I need a static public IP address to use VPN?

No. A dynamic public IP works as long as you use a dynamic DNS service or the VPN client can discover the current address each time it connects.

Is it safe to forward port 22 (SSH) directly to the internet?

Direct exposure is possible but not recommended. Use a non‑standard port, enforce key‑based authentication, and consider rate‑limiting login attempts with tools like fail2ban.

What if my VM runs on a cloud provider instead of my local machine?

Cloud VMs usually have a public IP already and provide security groups (firewall rules). Open the required port in the provider’s console, then connect exactly as you would to a locally hosted VM.

Can I access multiple VMs with a single RDP client window?

Yes. Use the Remote Desktop Connection Manager (free from Microsoft) or a third‑party tabbed RDP client to store multiple connection profiles and switch between them quickly.

Why does my SSH connection drop after a few minutes?

Many home routers have an idle‑timeout for inbound NAT sessions. Enabling ClientAliveInterval and ClientAliveCountMax in /etc/ssh/sshd_config sends periodic keep‑alive packets to keep the session alive.