|
69 | 69 | ] |
70 | 70 | ``` |
71 | 71 |
|
| 72 | +### Shared Address Ranges (Shared AR) for Virtual IPs |
| 73 | + |
| 74 | +Marking an Address Range as `SHARED` converts its IPs into **Virtual IPs**. This allows **multiple VMs** to use the same IP address. |
| 75 | + |
| 76 | +To mark an Address Range as `SHARED`, add the `SHARED` attribute in the AR definition: |
| 77 | + |
| 78 | +```default |
| 79 | +AR=[ |
| 80 | + TYPE = "IP4", |
| 81 | + IP = "10.0.0.211", |
| 82 | + SIZE = "3", |
| 83 | + SHARED = "YES" |
| 84 | +] |
| 85 | +``` |
| 86 | + |
| 87 | +The option to create a Shared AR is also available through a checkbox in the Sunstone UI in the **Add Address Range** dialog. |
| 88 | + |
| 89 | +Shared Address Ranges behave slightly differently from regular Address Ranges: |
| 90 | + |
| 91 | +- Same IP, multiple VMs: The same IP address from a Shared AR can be used by more than one VM. |
| 92 | +- Explicit request required: Shared IPs are not assigned automatically. They must be explicitly requested in a NIC or NIC Alias ([more details](#using-virtual-ips)). |
| 93 | +- Attribute `USED_LEASES` shows how many different shared IPs are in use, not how many VMs are using them. |
| 94 | + |
| 95 | +{{< alert title="Important" color="success" >}} |
| 96 | +The `SHARED` attribute of an Address Range can't be changed after creation. The default value is `NO`. {{< /alert >}} |
| 97 | + |
72 | 98 | ### Guest Configuration Attributes (Context) |
73 | 99 |
|
74 | 100 | To set up the guest network, the Virtual Network may include additional information to be injected into the VM at boot time. These contextualization attributes may include, for example, network masks, DNS servers, or gateways. For example, to define a gateway and DNS server for the Virtual Machines in the Virtual Network, simply add: |
@@ -392,6 +418,30 @@ Any attribute supported by an NIC attribute can be also used in an alias except |
392 | 418 | {{< alert title="Important" color="success" >}} |
393 | 419 | The [Security Groups]({{% relref "../../virtual_machines_operation/virtual_machines_networking/security_groups#security-groups" %}}) and IP/MAC spoofing filters from the NIC network will be applied to the NIC_ALIAS. Those ones belonging to the NIC_ALIAS network won’t apply.{{< /alert >}} |
394 | 420 |
|
| 421 | +### Using Virtual IPs |
| 422 | + |
| 423 | +To request a Virtual IP (VIP) from a [Shared Address Range](#shared-address-ranges-shared-ar-for-virtual-ips) you must explicity request the IP in a `NIC` or `NIC_ALIAS` attribute. The most natural way of using Shared Address Ranges for VIPs is to define a primary NIC in the network with a regular IP and a NIC Alias with the VIP, this way you get a single network interface with two different IPs. The procedure is described below: |
| 424 | + |
| 425 | +1. Define the primary NIC and give it a `NAME` so aliases can refer to it: |
| 426 | + |
| 427 | +```default |
| 428 | +NIC = [ NETWORK = "private", NAME = "main" ] |
| 429 | +``` |
| 430 | + |
| 431 | +2. Add a `NIC_ALIAS` that **explicitly requests the shared IP** from the Shared AR (you must include the `IP` attribute): |
| 432 | + |
| 433 | +```default |
| 434 | +NIC_ALIAS = [ NETWORK = "private", PARENT = "main", IP = "10.0.0.211" ] |
| 435 | +``` |
| 436 | + |
| 437 | +This will result in the VM having a **single network interface** (the parent NIC) with **two IPs** configured: |
| 438 | + |
| 439 | +- The IP assigned to the main NIC |
| 440 | +- The explicitly requested shared IP from the `NIC_ALIAS` |
| 441 | + |
| 442 | +{{< alert title="Important" color="success" >}} |
| 443 | +Requesting a Shared IP from a Shared AR **without** using `NIC_ALIAS` will create a **new interface** in the VM, with a random MAC assigned by OpenNebula.{{< /alert >}} |
| 444 | + |
395 | 445 | ### Configuring the Virtual Machine Network |
396 | 446 |
|
397 | 447 | Hypervisors will set the MAC address for the NIC of the Virtual Machines, but not the IP address. The IP configuration inside the guest is performed by the contextualization process, check the [contextualization guide]({{% relref "../../virtual_machines_operation/virtual_machines/vm_templates#context-overview" %}}) to learn how to prepare your Virtual Machines to automatically configure the network |
|
0 commit comments