How to create vrouter with contextualization

vmanyushin

im using this template for vrouter

cat router.tmpl

NAME = r1

NIC = [
  NETWORK     = "vxlan",
  IP          = "10.0.101.254",
  FLOATING_IP = "yes" ]

NIC = [
  NETWORK     = "vxlan-102",
  IP          = "10.0.102.254",
  FLOATING_IP ="yes" ]

NIC = [
  NETWORK     = "portal",
  IP          = "172.16.60.10",
  FLOATING_IP = "yes" ]

CONTEXT = [
  NETWORK                        = "YES",
  ONEAPP_VNF_ROUTER4_ENABLED     = "YES",
  ONEAPP_VNF_ROUTER4_INTERFACES  = "eth0 eth1 eth2",
  ONEAPP_VNF_DNS_ENABLED         = "YES",
  ONEAPP_VNF_DNS_INTERFACES      = "eth0 eth1",
  ONEAPP_VNF_DNS_USE_ROOTSERVERS = "NO",
  ONEAPP_VNF_DNS_NAMESERVERS     = "172.16.60.1 172.16.60.2" ]

onevrouter create router.tmpl
ID: 10

onevrouter instantiate 10 2
There are some parameters that require user input. Use the string <> to launch an editor (e.g. for multi-line inputs)

  • (ONEAPP_VNF_DHCP4_ENABLED) Enable DHCPv4
    Press enter for default (NO).

why it ask me about inputs? they all defined as Optional
how to create vrouter from CLI with predefined contextualization?

Hello @vmanyushin,

Welcome to this Forum, hope we can help you with your questions.

I can offer some links to check if there’s some useful information for you.

I don’t know if you check our documentation about virtual routers:
https://docs.opennebula.io/6.10/management_and_operations/network_management/vrouter.html

Also, this blog could be useful:

And perhaps this topic with the info about the vrouter appliance can help you as well:

If you still cannot run the vrouter, let us know.

Best regards,

i use this docs vr_dns · OpenNebula/one-apps Wiki · GitHub i want set values for router

NAME = r1

NIC = [
  NETWORK     = "vxlan",
  IP          = "10.0.101.254",
  FLOATING_IP = "yes" ]

NIC = [
  NETWORK     = "vxlan-102",
  IP          = "10.0.102.254",
  FLOATING_IP ="yes" ]

NIC = [
  NETWORK     = "portal",
  IP          = "172.16.60.10",
  FLOATING_IP = "yes" ]

CONTEXT = [
  NETWORK = "YES",
  ONEAPP_VNF_ROUTER4_ENABLED     = "YES",
  ONEAPP_VNF_ROUTER4_INTERFACES  = "eth0 eth1 eth2",
  ONEAPP_VNF_DNS_ENABLED         = "YES",
  ONEAPP_VNF_DNS_INTERFACES      = "eth0 eth1",
  ONEAPP_VNF_DNS_USE_ROOTSERVERS = "NO",
  ONEAPP_VNF_DNS_NAMESERVERS     = "172.16.60.1 172.16.60.2"
]

ONEAPP_VNF_DNS_NAMESERVERS tell unbound use custom upstreams

i create router template

> onevrouter create router.tmpl
ID: 55
> onevrouter list
  ID USER     GROUP    NAME
  55 oneadmin oneadmin r1
> onevrouter show 55
VIRTUAL ROUTER 55 INFORMATION
ID             : 55
NAME           : r1
USER           : oneadmin
GROUP          : oneadmin
LOCK           : None

PERMISSIONS
OWNER          : um-
GROUP          : ---
OTHER          : ---

VIRTUAL ROUTER NICS
 ID NETWORK              MANAGEMENT IP
  0 vxlan                NO         -
  1 vxlan-102            NO         -
  2 portal               NO         -

TEMPLATE CONTENTS
CONTEXT=[
  NETWORK="YES",
  ONEAPP_VNF_DNS_ENABLED="YES",
  ONEAPP_VNF_DNS_INTERFACES="eth0 eth1",
  ONEAPP_VNF_DNS_NAMESERVERS="172.16.60.1 172.16.60.2",
  ONEAPP_VNF_DNS_USE_ROOTSERVERS="NO",
  ONEAPP_VNF_ROUTER4_ENABLED="YES",
  ONEAPP_VNF_ROUTER4_INTERFACES="eth0 eth1 eth2" ]
TEMPLATE_ID="2"

VIRTUAL MACHINES

then instantiate vms, cli ask me about parameters that i ALREADY define…

> onevrouter instantiate 55 2
There are some parameters that require user input. Use the string <<EDITOR>> to launch an editor (e.g. for multi-line inputs)
  * (ONEAPP_VNF_DHCP4_ENABLED) Enable DHCPv4
    Press enter for default (NO).
  * (ONEAPP_VNF_DHCP4_INTERFACES) DHCP4 - Listening Interfaces

  * (ONEAPP_VNF_DHCP4_LEASE_TIME) DHCP4 - Lease Time [sec]
    Press enter for default (3600). Integer:
  * (ONEAPP_VNF_DNS_ENABLED) Enable DNS Server
    Press enter for default (NO). YES
  * (ONEAPP_VNF_DNS_INTERFACES) DNS - Listening Interfaces
    eth0 eth1
  * (ONEAPP_VNF_DNS_MAX_CACHE_TTL) DNS - Maximum Caching Time [sec]
    Press enter for default (3600). Integer:
  * (ONEAPP_VNF_DNS_USE_ROOTSERVERS) DNS - Use Rootservers
    Press enter for default (YES). NO
  * (ONEAPP_VNF_HAPROXY_ENABLED) Enable HAProxy
    Press enter for default (NO).
  * (ONEAPP_VNF_HAPROXY_INTERFACES) HAProxy - Interfaces

  * (ONEAPP_VNF_LB_ENABLED) Enable LoadBalancer
    Press enter for default (NO).
  * (ONEAPP_VNF_LB_INTERFACES) LoadBalancer - Interfaces

  * (ONEAPP_VNF_NAT4_ENABLED) Enable NAT
    Press enter for default (NO).
  * (ONEAPP_VNF_NAT4_INTERFACES_OUT) NAT - Outgoing Interfaces

  * (ONEAPP_VNF_SDNAT4_ENABLED) Enable SDNAT
    Press enter for default (NO).
  * (ONEAPP_VNF_SDNAT4_INTERFACES) SDNAT - Mapped Interfaces

this is onevm show output VIRTUAL MACHINE 76 INFORMATIONID : 76NAME : - Pastebin.com there no ONEAPP_VNF_DNS_NAMESERVERS parameter at all, it losing after instantiate

finaly i do it

$ cat router.tmpl
NAME = r1

NIC = [
  NETWORK     = "vxlan",
  IP          = "10.0.101.254",
  FLOATING_IP = "yes" ]

NIC = [
  NETWORK     = "vxlan-102",
  IP          = "10.0.102.254",
  FLOATING_IP ="yes" ]

NIC = [
  NETWORK     = "portal",
  IP          = "172.16.60.10",
  FLOATING_IP = "yes" ]

create router

$ onevrouter create router.tmpl
ID: 73

instantinate it with additional parameters

$ cat router-inst.tmpl
CONTEXT = [
  NETWORK                        = "YES",
  SSH_PUBLIC_KEY                 = "$USER[SSH_PUBLIC_KEY]",
  ONEAPP_VNF_ROUTER4_ENABLED     = "YES",
  ONEAPP_VNF_ROUTER4_INTERFACES  = "eth0 eth1 eth2",
  ONEAPP_VNF_DNS_ENABLED         = "YES",
  ONEAPP_VNF_DNS_INTERFACES      = "eth0 eth1",
  ONEAPP_VNF_DNS_USE_ROOTSERVERS = "NO",
  ONEAPP_VNF_DNS_NAMESERVERS     = "172.16.60.1 172.16.60.2"
]

$ onevrouter instantiate 73 7 router-inst.tmpl
1 Like