SHARE

it happens when you have dynamic ip on your ubuntu server and suddenly your ip has changed and you have problems connecting with your local services because of ip change. here the solution

sudo apt-get install network-manager

Networking is handled by netplan by default in Ubuntu Server 18. I suggest that you edit the /etc/netplan/01-netcfg.yaml file to read:

nano /etc/netplan/01-netcfg.yaml

and add the next and modify the ip according to your local ip. In my case, my ip was going to be 192.168.0.10

# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.10/24]
      gateway4: 192.168.0.1
      nameservers:
          addresses: [190.113.220.18,192.113.220.51]

Exit and save your changes by running the command:

sudo netplan apply

Please note and follow the spacing and indentation. then restart network

service network-manager restart

Comment out all the ens33 stanzas in /etc/network/interfaces. Reboot.

reboot