How Do You Use Putty To Connect To A CentOS Server (A Guest VM running on Oracle VirtualBox on a Windows Host)?

Problem scenario:  You have a Windows 7 host with Oracle VirtualBox.  You have a guest CentOS Linux virtual server.  How do you connect to a CentOS VM using networking?

Miscellaneous:  If you are looking for directions on how to give a Linux guest access to the Internet, these directions will work (assuming the host is running Windows).

#1  In Oracle VirtualBox go to Devices -> Network -> Network Settings.  For Adapter1 have the "Attached to" drop down be configured for "NAT."  Go to "Advanced" and check the box for "Cable Connected."  Click "Ok."

#2  Go to the Linux CentOS server.  Enter this command:

ip addr show | grep inet | grep -v inet6 | grep -v | awk '{print$2}'

Make a mental note of the IP address you find (e.g.,, but you can ignore the CIDR (e.g., /24).

#3  In Oracle VirtualBox go back to Devices -> Network -> Network Settings.  For Adapter1 go to "Advanced" and click the button for "Port Forwarding."  If you find everything has been preconfigured, make a mental note of the Guest IP address and go to step #4.  Otherwise click the icon of the green diamond with a green plus sign to add a rule.  Make sure the rule, under any name, has the following settings:

Protocol: TCP
Host IP:
Host port: 22
Guest IP:
Guest port: 22

"" is just an example of a guest IP address.  The Guest IP you should use should be the IP address found in step #2 above.  Similarly, "" is just an example of a Host IP address.  If you have two or more guest machines, you may want to use "" for one of the servers.  This way you could connect to each of them with Putty.

Click "OK" and click "OK" again.

#4  Open Putty on the Windows host.  Connect to the guest IP address -- in the example above for one server, it would be

Leave a comment

Your email address will not be published. Required fields are marked *