How to Add SSH Port Forwarding Rule to remote Guest Machine running in VirtualBox Manager from Host Machine

Posted on

Introduction

This is an article where the main focus is just to show how to add port forwarding rule in a Guest Machine running in a VirtualBox Manager. Adding a new rule for the port forwarding has a certain purpose. The main purpose is in order that remote access to the Guest Machine running in the VirtualBox Manager is available. The remote access process is using an SSH remote method access. The port forwarding rule is avaiable in order to access the CentOS virtual server via SSH remote method access.

 

Adding SSH Port Forwarding Rule

So, the following are steps to enable remote access to the CentOS virtual server running in VirtualBox application using SSH :

1. First of all, access the VirtualBox Manager. So, the following is the display of the VirtualBox Manager containing the virtual server :

How to Add SSH Port Forwarding Rule to remote Guest Machine running in VirtualBox Manager from Host Machine
How to Add SSH Port Forwarding Rule to remote Guest Machine running in VirtualBox Manager from Host Machine

Actually, the above VirtualBox Manager is empty. But when the virtual server is available, there will be an icon of that virtual server in the left side.

2. Next step, just select the suitable virtaul server in the VirtualBox Manager as exist in the following image :

How to Add SSH Port Forwarding Rule to remote Guest Machine running in VirtualBox Manager from Host Machine
How to Add SSH Port Forwarding Rule to remote Guest Machine running in VirtualBox Manager from Host Machine

3. After selecting the right virtual server, just right click on it to get to the Settings Windows Dialog Box. The following image will appearĀ  :

How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH
How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH

4. Click the Port Forwarding button as in the above image, the following image of the Setting Window Dialog Box will appear :

How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH
How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH

5. So, add a new rule for forwarding incoming request from a port in the Host Machine so it will redirected to a port in the Guest Machine. Port Forwarding is just an utility to be able to access remotely the CentOS virtual server using SSH. Click the Plus Sign, the following image will appear :

How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH
How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH

6. Configure the entry Port Forwarding in the new added line as in the above image as follows :

How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH
How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH

The above definition means that every connection that come from port 9922 in the local host where the VirtualBox application run will be redirected to the Virtual Server IP Address of 10.0.2.15 in port 22. Finally, just try to remote the Guest Machine from the Host Machine using port 9922. The remote process will go through the Guest Machine in port 22. It is the default port for remote access using SSH. This article is supporting another article with the title of ‘How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH’ in this link.

Leave a Reply