Skip to content


Installing VirtualBox in Windows and Linux

See the following video for a step-by-step procedure about installing VirtualBox in Windows and in Linux.

Duration: 8:54


  • VirtualBox download: link
  • VirtualBox manual: link

Creating a NAT Network in VirtualBox

You can create a NAT network in VirtualBox from the graphical user interface (GUI), as shown in the following video, or from the command line interface (CLI). Both are described as written step-by-step procedures after the video.

Duration: 8:15

Option 1: (GUI)

  1. Go to File > Preferences > Network.

  2. Click the + sign to the right. A new NAT Network will be created. You can use the default IP network if you wish, and the task is complete. If you wish to use a different IP network, then continue to the following optional steps.

  3. Double-click the new NAT Network.

  4. In the Network CIDR field, change the IP scheme to whatever you wish. For example, to use something different than, enter in

  5. Press OK for all open windows.

Afterward, in the VirtualBox VM settings, go to Network, then in the "Attached to:" drop down menu select the NAT network that you just created.

Option 2: (CLI)

In Windows you need to navigate to the following path and run the command below.

C:\Program Files\Oracle\Virtualbox


If you have issues using Powershell, use the Command Prompt instead.

In Mac and Linux you can run the command from any directory:

VBoxManage natnetwork add --netname natnet1 --network "" --enable --dhcp on

Adjust the name of the NAT Network and the IP scheme as you see fit. The name of the NAT Network in the example is “natnet1” and the IP scheme is

Afterward, in the VirtualBox VM settings, go to Network, then in the "Attached to:" drop down menu select the NAT network that you just created.

How to setup SSH capability into a VirtualBox guest on a NAT Network.

Guests on a VirtualBox NAT network can access external systems and the Internet. However, by default, the host computer cannot access the guests. At times, you might want to connect from your host computer to a VirtualBox guest with SSH in the command line. To allow this, add a port forwarding rule in VirtualBox by following the steps below.

  1. Go to File > Preferences > Network, and then double-click the appropriate NAT Network.

  2. In the NAT Network window click Port Forwarding.

  3. Click the + sign to add a new rule, and add the appropriate information, similar to the figure below. The Guest IP address will vary depending on your VM’s IP and your particular NAT Network setup. For example, it could be a different IP address on the network, or on a different NAT network altogether if you created a separate one.

  4. Connect to the guest with SSH using a command similar to the following:

ssh -p 2222 user@


The port number portion (-p 2222) can go before or after 'user@127.0.01'. Be ready to supply the password of the user account on the guest computer.

The connection on the IP address and port 2222 will redirect to the IP address of the guest (in this case, and port 22. That should begin an SSH session.
For every other VM that you want to connect to, simply create a new rule and increase the port number by one. For example, 2223, 2224, and so on.

Figure 1: Port Forwarding Rule in VirtualBox