nemecle.wiki
sysadmin system administration

Use two different IPs on a single web server

Linux tips and notes.

see "two ip one vps":

 1 auto ens3
 2 iface ens3 inet dhcp
 3 
 4 auto ens3:0
 5 iface ens3:0 inet static
 6 address <ip#1>
 7 netmask 255.255.255.255
 8 
 9 auto ens3:1
10 iface ens3:1 inet static
11 address <ip#2>
12 netmask 255.255.255.255

Will say "failed to raise interface", but ip addr shows it works fine

https://docs.ovh.com/gb/en/public-cloud/configure_a_failover_ip/

Configure a failover IP with Debian Configuring the network interface

For example purposes, we’re using the following variables:

Network interface = ens3

Failover IP address = your_ip_address

IP alias = 1

First, connect to your instance via the command line and open up your the network configuration file.

# nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

Next, edit the file with the configuration shown below. This will prevent changes from being made to your network configuration automatically.

# network: {config: disabled}

Next, open the network configuration file for editing with the following command:

# nano /etc/network/interfaces.d/50-cloud-init.cfg

Then edit the file with the following configuration:

auto ens3 iface ens3 inet dhcp

auto ens3:0 iface ens3:0 inet static address your_ip_address 0 netmask 255.255.255.255

auto ens3:1 iface ens3:1 inet static address your_ip_address 1 netmask 255.255.255.255

Restarting the network service

Finally, restart the network service with the following command:

service networking restart