Modify your static IP on Ubuntu server

Nov 22, 2019 by Thibault Debatty | 1980 views

Sysadmin

https://cylab.be/blog/46/modify-your-static-ip-on-ubuntu-server

This seems easy, but… When you modify your static IP address in /etc/network/interfaces, the old IP is not removed. The new IP is simply added to your interface.

You can check this using the command

ip address

To remove the old IP address you can either:

  1. remove the old IP (and you have to specify the correct netmask and interface):
sudo ip addr del 172.20.104.128/16 dev enp0s8
sudo service networking restart
  1. remove all IP’s from the interface (but be careful not to cut your own SSH connection!)
sudo ip addr flush dev enp0s8
sudo service networking restart

This blog post is licensed under CC BY-SA 4.0