Please see my setup here:
NAT is set up here:
Host-only adapter is enabled here:
network for virtual box is configured here:
then I set up interface on the server like this:
then I run sudo netplan apply and I should be all set. I can ping myself on the server:
but can't ping the server from my local computer:
Hence the network isn't actually connected to the Internet. What am I doing wrong here ?
update:
network connection is now set to "bridged":
81 Answer
The answer is Yes if you assign a static ip from your router for your virtual box virtual machine. (This need specific ip address from your local router).
The answer is No if you aren't assign a static ip from your router for your virtual box virtual machine.
If not how can we access the virtual machine via our laptop terminal ?
This is the method how to do that !
Keep in mind this is temporary method and all settings are reset after you restart the virtual machine . This will also enable internet access on your virtual box sever.
According to your question ,
First configure NAT (Network Address Translation) setting for Network Adapter 1
Then configure Host-only Adapter setting for Network Adapter 2
After that manual IP address assignment
Here don't enable the DHCP server as below
These are the settings for your server virtual machine hardware (assume that your are using a Ubuntu server virtual machine) !
After that install the Ubuntu server on the virtual hard disk ...
After you log on to the Ubuntu server (i think you provided administrative credentials ) , you have to do the followings.
First issue the following command to see the ip settings assigned for network adapters on the virtual Ubuntu server
ubuntu@vagrant:~$ ifconfigOn my test server there are eth0 , eth1 network interface cards , I have selected eth1 for this because eth0 is already assigned with an ip address by system default.
On Ubuntu server switch to the root user as ,
ubuntu@vagrant:~$ sudo -iThen the appear root user prompt as below ,
root@vagrant:~#Then issue the following command
root@vagrant:~# ifconfig eth1 192.168.188.101 netmask 255.255.255.0Once you done this exit from the root user by typing exit
Here don't turn off the virtual machine !
Then minimize the virtual machine and fireup a local terminal
After that issue ifconfig on the local terminal . Here you can see the various network adapters including the host only adaptor.
Then try to ping the ip address of the virtual machine as below
user@user-laptop:~$ ping 192.168.188.101If this ping is success you can now ssh to the your virtual Ubuntu server as below
user@user-laptop:~ ssh ubuntu@192.168.188.101Here you can provide the virtual server password .
So I think this method is worked for you if you are interested .