# Configure Additional Elastic IPs

For non-/32 elastic IP blocks, only the **gateway IP** is automatically assigned to the instance.\
The remaining IPs must be manually configured inside the operating system before they can be used.

Currently supported operating systems:

* Ubuntu
* CentOS
* ESXi

Before you start, make sure you have:

* The allocated EIP block (e.g., `203.0.113.16/28`)
* The gateway IP (automatically assigned)
* The subnet mask (e.g., `/28` → `255.255.255.240`)
* The primary network interface name (e.g., `wan0`)

You can check the interface name using:

```bash
ip addr
```

## Ubuntu Configuration

> Applies to Ubuntu 18.04+ (Netplan-based systems)

#### Step 1: Edit Netplan configuration

```bash
sudo nano /etc/netplan/00-installer-config.yaml
```

#### Step 2: Add additional IPs under addresses

Example:

```yaml
network:
  version: 2
  ethernets:
    eth0:
      addresses:
        - 203.0.113.17/28
        - 203.0.113.18/28
      gateway4: 203.0.113.16
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]
```

#### Step 3: Apply changes

```bash
sudo netplan apply
```

## CentOS Configuration

> Applies to CentOS 7 / 8

#### Step 1: Edit interface configuration

```bash
sudo nano /etc/sysconfig/network-scripts/ifcfg-wan0
```

#### Step 2: Add secondary IPs

Example:

```
IPADDR1=203.0.113.17
PREFIX1=28

IPADDR2=203.0.113.18
PREFIX2=28
```

#### Step 3: Restart network service

```bash
sudo systemctl restart network
```

Or:

```bash
sudo nmcli connection reload
```

## ESXi Configuration

#### Step 1: Log in to ESXi Web UI

Go to:

```
Networking → VMkernel NICs
```

#### Step 2: Edit the VMkernel adapter

* Add additional IPv4 addresses
* Use the same subnet mask as your elastic IP block
* Ensure gateway is correctly configured

#### Step 3: Save and Apply

## Temporary Configuration (Linux – For Testing Only)

If you want to temporarily assign an additional elastic IP address for testing purposes without making permanent changes, use the following command:

```bash
sudo ip addr add 203.0.113.17/28 dev wan0
```

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

<mark style="color:blue;">This configuration is non-persistent and will be removed after a system reboot.</mark>
{% endhint %}

To remove the IP address manually:

```bash
sudo ip addr del 203.0.113.17/28 dev wan0
```

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

* <mark style="color:blue;">Do not modify the gateway IP assigned by the system.</mark>
* <mark style="color:blue;">All additional elastic IPs must use the same prefix length as the allocated elastic IP block.</mark>
* <mark style="color:blue;">Ensure security groups and firewall rules allow traffic.</mark>
  {% endhint %}
