I am using Virtual Box and if i lose internet connection or anything happens with my network adapter on host machine i will lose the internet connection on my Virtual Machine.
Even if i connect again, the host is fine but my Virtual Machine can't connect, i need to restart it in order to get internet.
Is there a way to restart networking on the Virtual Machine somehow without rebooting the whole Virtual Machine?
update:
i have tried this command:
sudo /etc/init.d/networking restart
but it just hangs and nothing happens.
Best Answer
This problem is very familiar as it seems and I have experimented a little and it turns out that you can change the network adapter while the VM is running here:
and then change only the
Attached to:
option to NAT or Bridged Adapter (mine was on Bridged adapter so i changed it to NAT).and click OK. And then change it again to which it was before and again click on OK to accept it.
Now go back to your VM terminal and run this command
Update:
for Ubuntu 18|20 run
to restart Networking
And the internet connection will work without reseting the VM.