In OracleVMVirtual, CentOS automatically obtains the IP address settings. for details, refer to use CentOS to configure enable the NIC to automatically obtain the IP address at CentOS startup:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Change ONBOOT = "no" to ONBOOT = "yes"
After saving: service network restart
View IP: ifconfig eth0
Then, the port forwarding function (port forwarding) of the Oracle VM VirtualBox is used to implement communication between the host and the client through the virtual Nic of the virtual machine.
Open virtualboxSetWindow>Network->Nic1. enable network connection-> connection method: NAT-> access network cable->Port Forwarding, Set as follows
Configure the ing between the virtual nic ip address and the client IP address: Port 22. in the figure, the host port of the client is set to 2200. then, the system on the VM can be connected through the putty client tool,
Note that Port is set to 2200