I can't SSH or reach the server when i restart networking service?

Hey there,

I have a strange issue. I can’t SSH or reach the server when i restart networking service inside a debian based server. I am using vagrant, virtual box. Any help would be really appreciated!

My Environment

Vagrant 2.2.19
Virtualbox 6.1.36 r152435 (Qt5.6.3)

$ sw_vers
ProductName:	macOS
ProductVersion:	12.5.1
BuildVersion:	21G83

Vagrant file

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/debian10"
  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "public_network"

  config.vm.provision "shell", inline: <<-SHELL
    export DEBIAN_FRONTEND=noninteractive
    apt-get update
    apt-get upgrade -y
    apt-get install nginx -y
  SHELL
end

Run these commands

$ vagrant up
$ vagrant ssh

---

  $ sudo su
  $ sudo /etc/init.d/networking restart

Try to curl from the host.

$ curl http://127.0.0.1:8080