vr_quick - OpenNebula/one-apps GitHub Wiki

Quick Start

A newly-created Virtual Router (VR) is simply a resource in OpenNebula, and as such does not perform any networking tasks by itself. To work with VR, you must first instantiate Service Virtual Router Virtual Machines.

Let's assume you have two OpenNebula Virtual networks public and private, and you want to deploy a Virtual Router with failover capabilities so the VMs in the private network can reach the Internet. The topology will be as follows:

public network
───────────────────┬─────────────
                   β”‚ FLOATING_IP (3.27.6.5)
 β”Œβ”€ ─ ─ ─ ─ ─ ─ ─ ─┼ ─ ─ ┐
 β”‚ Virtual Router  β”‚     β”‚
 β”‚ β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β” β”‚
 β”‚ β”‚        β”‚ β”‚        β”‚ β”‚
 β”‚ β”‚  VR-1  β”‚ β”‚  VR-2  β”‚ β”‚
 β”‚ β”‚        β”‚ β”‚        β”‚ β”‚
 β”‚ └──eth1β”€β”€β”˜ └──eth1β”€β”€β”˜ β”‚
 β”‚     β”‚           β”‚     β”‚
 β”‚  10.0.0.2    10.0.0.3 β”‚
 β”‚                 β”‚     β”‚
 └─ ─ ─ ─ ─ ─ ─ ─ ─│─ ─ β”€β”˜
                   β”‚ FLOATING_IP (10.0.0.1)
───────────────────┼──────────┬──────────┬───────
Private Network    β”‚          β”‚          β”‚
(10.0.0.0/24)      β”‚          β”‚          β”‚
                 β”Œβ”€β”΄β”€β”€β”     β”Œβ”€β”΄β”€β”€β”     β”Œβ”€β”΄β”€β”€β”
                 β”‚ VM β”‚     β”‚ VM β”‚     β”‚ VM β”‚
                 β””β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”˜

Here's a procedure to get you started:

  1. Download the Service Virtual Router:

    $ onemarketapp export 'Service Virtual Router' vr1 --datastore default
    IMAGE
        ID: 0
    VMTEMPLATE
        ID: 0
    
  2. Adjust the VM template to meet your needs (e.g. CPU, MEMORY) and enable NAT'ing on the public interface:

    $ onetemplate update vr1
    ...
    
    
  3. Create the VR:

    $ onevrouter create <<'EOF'
    NAME = "vr1"
    NIC = [
      NETWORK = "public",
      FLOATING_IP = "YES",
      FLOATING_ONLY = "YES" ]
    NIC = [
      NETWORK = "private",
      FLOATING_IP = "YES",
      FLOATING_ONLY = "NO" ]
    CONTEXT = [
      NETWORK = "YES",
      SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]",
      ONEAPP_VNF_NAT4_ENABLED = "YES",
      ONEAPP_VNF_NAT4_INTERFACES_OUT = "eth0" ]
    EOF
    ID: 0
    
  4. Create VR instances:

    $ onevrouter instantiate vr1 vr1 --multiple 2
    ...
    
  5. Update the private Virtual Network so the DEFAULT_GW points to the VROUTER_IP in the private network.