I have a Debian 9 server with one IP, If I type ip a I see this:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
(...)
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:ee:e5:7c brd ff:ff:ff:ff:ff:ff
inet x.x.x.x/24 brd x.x.x.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:feee:e57c/64 scope link
valid_lft forever preferred_lft forever
Where x.x.x.x is the IP of the server. And the/etc/network/interfaces file is this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
Then I added a second IP:
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:ee:e5:7c brd ff:ff:ff:ff:ff:ff
inet x.x.x.x/24 brd x.x.x.255 scope global ens192
valid_lft forever preferred_lft forever
inet y.y.y.y/26 scope global ens192:1
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:feee:e57c/64 scope link
valid_lft forever preferred_lft forever
And the/etc/network/interfaces file is:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
iface ens192:1 inet static
address y.y.y.y
netmask y.y.y.192
auto ens192:1
Where y.y.y.y is the new IP.
Then I delete the old IP:
ip addr del x.x.x.x/24 dev ens192
And all works fine with the new IP, the old one does not work anymore. But, if I restart the server, old IP appears and start to work.
What I have to do to delete the old IP forever even if i restart the server?
Thank you