We would be using a Windows PC with Virtual Box installed.
Also make sure that you have the latest Virtual Box extentions installed!
First we need to add a Virtual Box NAT network for the given PC.
Open the Preferences from the Virtual box window.
Go to the Network Fold and select NAT Netowkrs
Tab
And add the following:
Configurer it as:
This would configure the NAT network.
Next we need to set the Local IP static for network interfaces.
Note until you finish configuring the Network adapters also this window should not be closed else settings would be lost.
To Remove the Error we saw in the eariler image
Go to the Network Fold and select Host-only Networks
Tab
Select each of the Virtual Box network adapters :
Then configure each adapter:
After doing a unique IP address for each adapter you can click OK
button to save the settings.
Now this should display along with some WCL
to change Adapter settings
First we need to change the Settings in the Corresponding VM as follows:
Finally start the VM.
Then in Network Configuration
change the following:
One needs access to certian ports of the running VM.
This can be done by again going to Preferences from the Virtual box window.
Go to the Network Fold and select NAT Netowkrs
Tab
Open the NAT Network details:
Add a configuration:
Name: VM1SSH
Protocol: TCP
Host IP: <blank>
Host Port: 61022
Guest IP: 10.0.2.2 As per your configuration, in our case this would be the correct one.
Guest Port: 22
Note Make sure to fix the address for the adapters (VirtualBox Host-Only Ethernet...) else the settings would not be saved. This is same as in the previous steps.
This setting allows to access teh SSH from outside the VM in the Host PC.
An Important catch here is that the Port 22 from the VM is mapped to Host PC Port 61022.
So its a tunnel access not direct access to the port. Hence on the PC side one needs to open 127.0.0.1:61022
to access the VM's SSH.
This completes the settings for VM to use a local NAT network.