How to fix the network error while connecting to your VPS after a restart.

Login using the VNC button

If using Ubuntu 18+ run the following command

nano /etc/netplan/50-cloud-init.yaml​

Once you run the command, add the line

on-link: true​

The file should now look something like this

# File is autogenerated by Cloud-Init and will be recreated after each boot
network:
version: 2
ethernets:
eth0:
match:
macaddress: 52:54:00:29:71:04
set-name: eth0
addresses:
- 51.158.47.157/24
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
mtu: 1400
routes:
- scope: link
to: 163.172.21.84/32
via: 0.0.0.0
- to: 0.0.0.0/0
via: 163.172.21.84
on-link: true​


You can see the new line at the bottom.
Once you do this save the file and restart the VPS. It should now have a network connection.
Was this article helpful?
Cancel
Thank you!