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
 4 auto ens3:0
 5 iface ens3:0 inet static
 6 address <ip#1>
 7 netmask
 9 auto ens3:1
10 iface ens3:1 inet static
11 address <ip#2>
12 netmask

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

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

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

Restarting the network service

Finally, restart the network service with the following command:

service networking restart