By default SSH & ping between Virtualbox Guest and Host is disabled. Virtualbox make NAT connection between Host and Guest so we can have internet connection in Guest. To make Host and Guest can communicate in two ways, here are the steps :
1. Create vboxnet0 network device.
If you don’t have this vboxnet, you will have empty in Network Adapter preferences.
So, open Virtualbox and go ” File -> Preferences -> Network “.
Add host-only by press + (plus) button.
2. Create new Network adapter in Guest
Right-click into your Guest Virtualbox, select “Settings”. Go to “Network -> Adapter2″.
Attached into host-only adapter and select name into vboxnet0.
3. Start your Guest
In mine, I use Ubuntu as Guest & Host OS. So, in after login into Guest, you should check if host-only adapter works or not. Do “sudo ifconfig eth1″ :
1 2 3 4 5 6 7 8
| eth1 Link encap:Ethernet HWaddr 08:00:27:97:1c:69 inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe97:1c69/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:53 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1684 (1.6 KB) TX bytes:9659 (9.6 KB) |
192.168.56.101 is your Guest IP.
Now on host, you can do ssh ubuntu@192.168.56.101.
If eth1 doesn’t have any IP, then we should assign static IP by edit “/etc/network/interfaces”
1 2 3 4
| auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0 |
And reboot your Guest. After reboot, check your IP again.
4. For easy mouse and keyboard switch between Guest & Host
Run your Virtualbox Guest machine. On menu Devices, select install guest additions.