Connect to VirtualBox Linux Node using PuTTY

When you run a Linux command-line only virtual machine in VirtualBox, the VirtualBox window can be difficult for prolonged use. For example, there is no copy-and-paste, and no scrolling through past terminal output. Also you cannot change the terminal size and the fonts (when zoomed) are poor quality. To overcome this, I commonly use an external application to SSH into the Linux machine, allowing me to take advantage of the GUI/Terminal capabilities of that external application.

On Linux (or OSX) hosts, a SSH client is built-in. From a terminal on the host, ssh can be used to connect to the virtual machine. On Windows hosts, PuTTY is a good choice.

However for SSH to work, the virtual machine must be running a SSH server and VirtualBox must be configured to accept connections (i.e. port forwarding). Luckily when using virtnet Linux nodes, both conditions are met.

IP Address and Port of virtnet Nodes

Each node in virtnet is configured to run a SSH server (on the standard port 22) and VirtualBox is configured to port forward from another port to 22. The scheme used in virtnet is that the external port is 22 followed by the node number. For example:

To connect from host to virtual machine, the destination IP address is (or localhost).

Connecting via Linux Hosts

To connect to node1, open a Terminal and run the following command:

ssh -l network -p 2201

To connect to a different node, change the port number from 2201 to 22xx, where xx is the node number.

Connecting via Windows Hosts

Assuming PuTTY is installed, start it and set the following in the PuTTY Configuration window if wanting to connect to node1:

Then press the Open button. To connect to a different node, change the port number from 2201 to 22xx, where xx is the node number.

PuTTY Configuration

Security Alert

You may be warned about the server's host key. Since you are connecting within your own computer (and not across a network), there is very little chance of an attack, so you can trust the key. Click Yes to proceed.

PuTTY Security Alert