> ## Documentation Index
> Fetch the complete documentation index at: https://gcore-doc-1046.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create and configure a virtual IP address

## What is a virtual IP address?

A virtual IP address (VIP) is an IP address that can be assigned to multiple Virtual Machines or serve as a secondary IP address for a network interface.

## How does it work?

**To use a VIP to create a fault-tolerant system**, you'll need to install and configure Keepalived, which is a system daemon for Linux. Keepalived uses the Virtual Router Redundancy Protocol (VRRP) to manage the VIP. This protocol allows multiple machines to share a common IP address, and Keepalived uses VRRP to pass the VIP address between the primary machine and the backup machines. When the primary machine fails, the VRRP protocol detects the failure and passes the VIP to one of the backup machines, ensuring that the network service remains available.

**To** **use a VIP as a secondary address** for a network interface, you will reserve a VIP and assign it to a Virtual Machine, first in the settings of our system, then in the settings of the machine. As a result, the VIP becomes the address of the Virtual Machine, working in conjunction with its regular IP address, allowing the machine to receive and transmit data on behalf of both addresses.

## Billing

A VIP is billed from the moment you reserve it until the moment you delete it. For example, if you reserve an IP address and then delete it after an hour, you will be charged only for an hour of use, regardless of whether the address was assigned to the Virtual Machine or not.

The monthly price is displayed in the order window.

## Public IP limits

A Virtual Machine has only one public interface, meaning it receives a Public IP from the public network. It also supports multiple Floating IPs from private networks, but quotas limit the number. In a multi-network setup, each subnet can have one Floating IP. Within a single network, multiple subnets can exist, and each subnet of a single machine (VM/BM) is allowed one Floating IP.

By default, Bare Metal servers support up to six attached IPs. A dedicated Bare Metal network removes this limit, allowing unlimited IPs per machine. Unlike standard networks, this type of network lacks port security and can be allocated by request.

## Create a virtual IP address

1\. In the Cloud menu, go to **Networking** → **Reserved IPs** and click **Reserve new IP**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12896827624209.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=25a96755740852fac79e4f8cfd89dfad" alt="Screenshot_2023-02-07_at_14.59_1.png" width="5348" height="2324" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12896827624209.png" />
</Frame>

2\. In the new window, select the type of an IP address depending on the required network interface: public or private.

If you select **Private**, specify the network and subnetwork. If you want to reserve a specific IP address, turn on the **Set IP address** toggle and choose an IP address from the valid CIDR. Otherwise, you will be assigned a random IP address.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12896898220817.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=c9a2d2500d89fd4a7844eb79fc408db1" alt="Screenshot_2023-02-07_at_15.28.15.png" width="523" height="487" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12896898220817.png" />
</Frame>

3\. Go back to the list of reserved IP addresses, find the required IP address, click **⋯** next to it and select **VIP settings**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12896925225233.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=1f08448f6cb7ad4d0d0cefb1810bf759" alt="Screenshot_2023-02-07_at_15.53_1.png" width="1019" height="352" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12896925225233.png" />
</Frame>

4\. In the pop-up window, turn on the **Is VIP** toggle and click **Save**.\
You have reserved a virtual IP address. You can now assign it multiple machines to create a fault-tolerant system or to add as a secondary address for your network interface.

## Assign a virtual IP address to multiple VMs

1\. In the Cloud menu, go to **Networking** → **Reserved IPs**, find the required virtual IP address, click **VIP** in the **Status** column.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946840118161.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=6530d5b99617a0076aff51c237aa2a12" alt="Screenshot_2023-02-13_at_11.27_1.png" width="4064" height="1164" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946840118161.png" />
</Frame>

2\. In the pop-up window, add the required Virtual Machines, specify their ports and click **Save**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12897006107153.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=d9ffb4e639c6cc0ede3bf258bdc37bc6" alt="Screenshot_2023-02-08_at_17.11.42.png" width="534" height="302" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12897006107153.png" />
</Frame>

3\. Install and configure Keepalived on your Virtual Machines using [the official Keepalived documentation](https://keepalived.readthedocs.io/en/latest/installing_keepalived.html).

4\. Change the Keepalived configuration file to set the "MASTER" machine and "BACKUP" machines. Additionally, set the priority to determine the order in which the VIP will be transferred between devices. If the master server fails, the IP address will be transferred to the backup machine with the highest priority. If the second machine fails, the VIP will be transferred to the backup machine with the second-highest priority.

5\. Run Keepalived on your Virtual Machine and add it to the autostart list.

You have configured the VIP for your machines. The fault-tolerant system is now operational.

## Assign a virtual IP address as a secondary address

1\. In the Cloud menu, go to **Networking** → **Reserved IPs**, find the required virtual IP address, click **VIP** in the **Status** column.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946840118161.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=6530d5b99617a0076aff51c237aa2a12" alt="Screenshot_2023-02-13_at_11.27_1.png" width="4064" height="1164" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946840118161.png" />
</Frame>

2\. In the pop-up window, add the required Virtual Machine, specify its port and click **Save**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12897006107153.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=d9ffb4e639c6cc0ede3bf258bdc37bc6" alt="Screenshot_2023-02-08_at_17.11.42.png" width="534" height="302" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12897006107153.png" />
</Frame>

Now you have to configure the VIP in the Virtual Machine settings. Below are two guides for Windows and non-Windows VMs.

## Configure a virtual IP address for non-Windows Virtual Machines

1\. Connect to your Virtual Machine.

2\. Run the following command as an administrator:

```sh theme={null}
ip addr add [VIP]/[mask] dev [interface name]
```

where:\
\- **\[VIP]** is the virtual IP address that you want to add to the interface.\
\- **\[mask]** is the subnet mask associated with the virtual IP address. You can find it in the **Networking** tab of your Virtual Machine.\
\- **\[interface name]** is the name of the network interface where the IP address will be added. To find the name, run the command:

```sh theme={null}
ip addr 
```

The interface name will appear on the left below the loopback interface.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946900210833.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=d55932b133df1fbf7a69a444e56e4628" alt="Screenshot_2023-02-08_at_13.30_1.png" width="968" height="232" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946900210833.png" />
</Frame>

For example, to add the virtual IP address *192.168.1.200* with a subnet mask of *24* to the *eth0* interface, you would use the following command:

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946938150161.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=88e547e6226e944bf268350e752f6d5e" alt="Screenshot_2023-02-08_at_14.04.13.png" width="389" height="29" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946938150161.png" />
</Frame>

Note: **the command assigns the VIP to your machine until it restarts**. After rebooting, run the command to assign the VIP again. To permanently assign a VIP to a Virtual Machine, refer to the official documentation of your OS to add the IP address to the system network settings.

The VIP has been configured. To verify it, [connect to your Virtual Machine via SSH](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh) using your VIP. If the connection fails, there may be an error in the IP assignment command or the IP address may not have been added inside your system. Repeat the Steps again.

### Configure a virtual IP address for Windows Virtual Machines

1\. Open the **Control Panel**.\
2\. Go to the **Network and Sharing Center**.\
3\. Right-click the active network connection that you want to add the virtual IP address to and select **Properties**.\
4\. Select **Internet Protocol Version 4 (TCP/IPv4)** and click **Properties**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946990237457.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=6832b028cc80626356e9b2e2ba0c187d" alt="18.png" width="376" height="489" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12946990237457.png" />
</Frame>

5\. Click **Use the following IP address** option and enter the virtual IP address, subnet mask, and default gateway in the appropriate fields. To find these parameters, run the following command:

```sh theme={null}
ipconfig 
```

You will see the output:

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12947005842961.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=7cb1fbe962a1de9fac052cbde6822fbb" alt="16.png" width="1074" height="494" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12947005842961.png" />
</Frame>

Go back to the **Control Panel**, make sure the values are correct and click **Advanced ....**

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12947053843345.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=14857b1def2d673e33084ddf239d3f1c" alt="19.png" width="417" height="474" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/12947053843345.png" />
</Frame>

6\. In the **IP Settings** tab, find the **IP addresses** section and click **Add ....**

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/20.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=1e757f795ed9e969a64419e3e8152706" alt="20.png" width="496" height="606" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/20.png" />
</Frame>

7\. In the next window, enter your VIP and the subnet mask from the command line. Then click **Add**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1046/o7wA0BxBPtk_BB2L/images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/21.png?fit=max&auto=format&n=o7wA0BxBPtk_BB2L&q=85&s=d829b2ec9e309d1f5c62035f07fe23c7" alt="21.png" width="498" height="608" data-path="images/docs/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address/21.png" />
</Frame>

8\. Click **OK**.

The VIP has been configured. To verify it, [connect to your Virtual Machine via SSH](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh) using your VIP. If the connection fails, there may be an error in the IP assignment command or the IP address may not have been added inside your system. Repeat the Steps.
