Configure VirtualBox NAT as Network Adapter on Guest VM and Allow putty ssh Through Port Forwarding

How to configure Virtualbox network for NAT and allow putty/ssh to connect from host to guest Linux virtual machine that has ssh daemon/server running. For some of you, mouse cursor cannot show in your VM; or vm windows too small in Virtualbox, therefore, unable to get into VM, there is a quick and dirty solution, is not to go into VM at all! As we prefer to use ssh/putty to connect VM and all works are to be done with putty/ssh.
This solution/workaround is only for VM is a Linux or any Unix flavor OS that has ssh daemon already started upon boot.
Following is the solution:
Run Virtualbox app, make sure VM is powered off.
Click setting icon, click network, and change network adapter from bridged adapter to NAT.
Some basic concept:
What is bridged adapter?
Bridged adapter is to use the network adapter (such as wireless network interface of your notebook). If setting bridged adapter, VM will get the IP address from DHCP server, therefore, the IP address is dynamic.
What is NAT?
Network Address Translation (NAT)
NAT gives a virtual machine access to network resources using the host computer's IP address. In Virtualbox, it has IP address fixed at VM with NAT will be able to connect to host machine, and if host machine is connected to the internet, VM can connect to internet. However, you can not putty/ssh to VM with NAT. To enable putty/ssh connectivity to VM, you need to setup port forwarding, see below picture
Step 0:
Select network from setting
Step 1:
Change network adapter from Bridged adapter to NAT
Step 2:
Click Advanced
Step 3:
Click Port Forwarding
Step 4:
On the port forwarding pop up window, click Add(+) icon
Step 5:
Enter port forwarding rule:
Procotol: TCP
Host IP: empty (do not enter anything)
Host Port: 30 (you can enter other known unused port)
Guest IP:
Guest port: 22
Note: port 22 is the port ssh daemon (server) listens to on guest VM.
Step 6:
Click OK to close port forwarding window
Step 7:
Click OK on the parent Network window
  1. 1.
    Now start VM, wait until it has started (few minutes later)
Now start putty or ssh on host computer, connect to localhost, but specify port 30, then click open
You connect to VM by ssh through port forwarding from port 30 on your host machine to port 22 of guest machine