# Activate an Additional Private IPv4 Address

After assigning additional private IPv4 address to your elastic compute instance, you need to access the instance and configure the private IPv4 to make it effective.

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

* <mark style="color:blue;">The configuration process may vary slightly depending on the operating system and its version. Please configure accordingly based on your specific circumstances. The following steps are for reference only.</mark>
* <mark style="color:blue;">All the examples use the network interface</mark> <mark style="color:blue;">`eth0`</mark> <mark style="color:blue;">as an example. Replace the name with your actual connection name.</mark>
  {% endhint %}

## Configure Private IPv4 on Linux Instance

### **RHEL Series Operating Systems**

**Applicable operating systems**: CentOS, AlmaLinux, etc.

1. **Check current network information**:
   * View current network details on the cloud server and use `route -n` to check the default gateway.

     ```sh
     route -n
     ```
2. **Modify network configuration file**:
   * If configuring a single private IPv4 address, edit the following file:

     ```sh
     sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
     ```
   * Sample configuration file content:

     ```sh
     DEVICE=eth0:0
     BOOTPROTO=static
     HWADDR=00:0C:29:6F:62:A7
     ONBOOT=yes
     IPADDR=172.16.2.6       # Additional private IPv4
     NETMASK=255.255.255.0   # Subnet mask
     GATEWAY=172.16.2.1      # Gateway
     ```
3. **Activate network interface or restart network service**:
   * Activate the network interface:

     ```sh
     sudo ifup eth0:0
     ```
   * Or restart the network service:

     ```sh
     sudo systemctl restart network
     ```
4. **Verify configuration**:
   * Check the configuration using `ifconfig` or `ip addr show`.

     ```sh
     ifconfig
     ```

### **Rocky Operating System**

For Rocky, you can use the `nmcli` command-line tool provided by NetworkManager to configure additional private IPv4 addresses.

1. **Disable cloud-init network configuration:**
   * Cloud-init may override network settings on instance restart. To prevent configuration failures, create a file to disable cloud-init network configuration:

     ```sh
     sudo vim /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
     ```
   * Add the following configuration to the file:

     ```yaml
     network: {config: disabled}
     ```
2. **Check current network connections:**
   * Run the following command:

     ```bash
     nmcli con show
     ```
   * The network connection name varies across different distributions. A sample is shown below:

     <div align="left"><figure><img src="/files/JreKnkL0AVSUpFPVvJhB" alt="" width="563"><figcaption></figcaption></figure></div>
3. **Configure additional private IPv4 addresses and gateway:**
   * Run the following commands to configure the additional private IPv4 addresses, default gateway, and subnet mask of `eth0`:

     ```shell
     sudo nmcli con modify "System eth0" ipv4.addresses 172.16.2.1/24,172.16.2.3/24,172.16.2.5/24   # Additional private IPv4
     sudo nmcli con modify "System eth0" ipv4.gateway 172.16.2.1      # Gateway
     ```
4. **Activate the network configuration:**
   * Apply the changes by running:

     ```shell
     sudo systemctl restart NetworkManager
     ```

     If no messages are returned, the configurations take effect.
5. **Verify configuration**:
   * Check the configuration using `ip addr show`.

     ```sh
     ip addr show
     ```

### **Debian Series Operating Systems**

**Applicable operating systems**: Ubuntu, Debian.

1. **Check current network information**:
   * View current network details on the cloud server and use `route -n` to check the default gateway.

     ```sh
     route -n
     ```
2. **Modify network configuration file**:
   * Edit the network configuration file:

     ```sh
     sudo vi /etc/network/interfaces
     ```
   * Sample configuration file content:

     ```sh
     auto eth0:0
     iface eth0:0 inet static
     address 172.16.2.2      # Additional private IPv4
     netmask 255.255.255.0   # Subnet mask
     gateway 172.16.2.1      # Gateway
     ```
3. **Restart network service**:
   * Restart the network service:

     ```sh
     sudo systemctl restart networking
     ```
4. **Verify configuration**:
   * Check the configuration with `ifconfig` or `ip addr show`.

     ```sh
     ifconfig
     ```

### **SLES Series Operating Systems**

**Applicable operating systems**: OpenSUSE.

1. **Modify network configuration file**:
   * Edit the network configuration file:

     ```sh
     sudo vi /etc/sysconfig/network/ifcfg-eth0
     ```
   * Sample configuration file content:

     ```sh
     IPADDR_0=172.16.2.8     # Additional private IPv4
     NETMASK_0=255.255.255.0 # Subnet mask
     ```
2. **Restart network service**:
   * Restart the network service:

     ```sh
     sudo systemctl restart network
     ```
3. **Verify configuration**:
   * Check the configuration with `ifconfig` or `ip addr show`.

     ```sh
     ifconfig
     ```

## Configure Private IPv4 on Windows Instance

1. **View network information**:
   * Open **Windows PowerShell** and run the following command to view IP address, subnet mask and default gateway information:

     ```sh
     ipconfig /all
     ```
2. **Open Network and Sharing Center**:
   * Go to **Control Panel** > **Network and Internet** > **Network and Sharing Center**, and click on the **Ethernet** adapter to edit.
3. **Edit Ethernet properties**:
   * In the **Ethernet Status** dialog, click on **Properties**.
4. **Configure IPv4 settings**:
   * Select **Internet Protocol Version 4 (TCP/IPv4)** and click on **Properties**.
5. **Fill in network information**:
   * Fill in the following fields with the values obtained in step 1:
     * IP address
     * Subnet mask
     * Default gateway
     * Preferred DNS server
     * Alternate DNS server (if applicable)
6. **Configure additional private IPv4**:
   * Click on **Advanced** and add the additional private IPv4.
   * In the **Advanced TCP/IP Settings** dialog, click on **Add** under the IP addresses section.
   * Fill in the additional private IPv4 and subnet mask, then click **Add**.
7. **Save and verify configuration**:
   * Click **OK** to save the settings in all dialogs.
   * In the **Ethernet Status** dialog, click **Details** to view the configured IP information.
8. **Test connectivity**:
   * Test the connectivity of the additional private IPv4 from other instances within the same global VPC using ping.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/elastic-compute/get-started/manage-instances/activate-an-additional-private-ipv4-address.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
