VirtualBox: SSH from host to guest

To ssh from host PC to guest virtual machine, create a host-only network adapter on virtual machine and enable it (assume that virtual machine has Adapter 1 as NAT).
1. Add network interface for Host-only Networks on host PC
Open Oracle VM VirtualBox Manager, select menu File > Preferences > Network > Host-only Networks (tab), add one if there is none (it should be named vboxnet0 by default).
2. Shutdown virtual machine if it is running, on its Setting > Network, select tab Adapter 2, check on Enable Network Adapter, select Attached to: Host-only Adapter, Name: vboxnet0
3. Start virtual machine, in /etc/sysconfig/network-scripts, in file ifcfg-etho, delete content of HWADDR and UUID entry. Copy ifcfg-eth0 to ifcfg-eth1
4. Restart network: service network restart
5. Check if both interfaces are on and is set IP address.
6. From host PC, ssh to virtual machine via IP of eth0.

If clone the virtual machine above, remember to refresh its MAC address of two adapters in Oracle VM VirtualBox Manager, and delete the file /etc/udev/rules.d/70-persistent-net.rules, and reboot the VM.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: