Sometimes we need to add extra IPs to a network interface to handle HTTPS requested by mechanisms that don’t support SNI. There are many ways to do that but here are the one I prefer.
In order to be able to add an extra IP belonging to another subnet then the one already existing, the suggestion is:
Adding an extra IP and assign it to a ‘virtual’ interface eth0:xtra which is in fact a second name for the interface eth0.
Add the following in /etc/network/interfaces
iface eth0:xtra inet static
In case of adding an extra IP that belongs to the same subnet as the one already existing the suggestion is:
Note: Here I display the full interface configuration but the part to add is only at the end which starts with ‘up’ or ‘down’
In file /etc/network/interfaces
iface eth0 inet static
up /sbin/ip addr add 10.45.13.155/24 dev eth0
down /sbin/ip addr del 10.45.13.155/24 dev eth0