I have an Ubuntu VPS and I want to change its IP address and gateway.

But none of the network commands work on this system.

  • ifconfig works and shows just lo.
  • ifup command not found.
/etc/sysconfig/interfaces

shows ifupdown is replaced by netplan(5)

Then netplan command not found. Also, Network-Manager command not found too.

So how should I restart the network on this machine?
Currently I login using the console.

  • Is this Ubuntu or RHEL or CentOS? – George Udosen Sep 16 at 14:02
  • it is Ubuntu. I could add an IP using this command: sudo ifconfig ens32 up 192.168.1.100 I am trying to add a route.so that I get internet and reinstall packages. – Farzin Sb Sep 16 at 14:08
  • I added gateway and I have internet now: route add default gw 1.2.3.4 . now I should findout the active network module to make this ip permanent after reboots. – Farzin Sb Sep 16 at 14:14
  • Install netplan with sudo apt install netplan – abu_bua Sep 16 at 15:34

If ifconfig did not show your interface then it seems you did not have any valid network configuration for it in netplan. You probably have an existing yaml file under /etc/netplan which you can edit to add your interface and its addresses. This may be as simple as replacing dhcp: true in the config with appropriate addresses: and routes: stanzas.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.