Virtual router KVM Alpine

#1

Hello,
I want to add one route on my template of virtual router .
I use the context like this :
TEMPLATE CONTENTS
CONTEXT=[
GATEWAY_IFACE=“ETH1”,
NETWORK=“YES”,
I’m trying differents syntax like : GATEWAY = “192.168.233.1”
But it doesn’t works!
I’m also trying to connect with SSH in the instance. The SSH_PUBLIC_KEY seems good, this works whith other, but it tells me the password.
I just want to add a route.
Thank you for your help
Hugues

(Alejandro Huertas) #2

Hello @hugues

Could you please send me the complete template which is failing for you?

#3

Thank you,
This is my template.

CONTEXT = [
  FILES_DS = "$FILE[IMAGE=\"set-root-password.sh\", IMAGE_UNAME=\"tech1\"]",
  GATEWAY = "192.168.233.10",
  INIT_SCRIPTS = "set-root-password.sh",
  NETWORK = "YES",
  ROOT_PASSWORD = "$ROOT_PASSWORD",
  SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" ]
CPU = "1"
DISK = [
  IMAGE = "alpine-vrouter (KVM)",
  IMAGE_UNAME = "oneadmin" ]
GRAPHICS = [
  LISTEN = "0.0.0.0",
  TYPE = "VNC" ]
HYPERVISOR = "kvm"
INPUTS_ORDER = "ROOT_PASSWORD"
LOGO = "images/logos/linux.png"
MEMORY = "1024"
MEMORY_UNIT_COST = "MB"
NIC_DEFAULT = [
  MODEL = "virtio" ]
OS = [
  ARCH = "x86_64",
  BOOT = "" ]
USER_INPUTS = [
  ROOT_PASSWORD = "M|password|" ]
VROUTER = "YES"

I’m using this link to configure a password for VNC tty:
https://forum.opennebula.org/t/solved-how-todo-i-provide-ssh-public-key-the-correct-way/1584/2
But it don’t work.
I want to route my host who is in the 192.168.0.0/24 network towards internet.
My vmrouter has two interfaces and i want to add a route like 0.0.0.0/0 via W.X.Y.Z
Or to connect in the VNC console with a password.

Thanks for your help

#4

The template of the VM:

User template

HYPERVISOR = "kvm"
INPUTS_ORDER = "ROOT_PASSWORD"
LOGO = "images/logos/linux.png"
MEMORY_UNIT_COST = "MB"
ROOT_PASSWORD = "12345678"
USER_INPUTS = [
  ROOT_PASSWORD = "M|password|" ]
VROUTER = "YES"

Template

AUTOMATIC_DS_REQUIREMENTS = "\"CLUSTERS/ID\" @> 0"
AUTOMATIC_REQUIREMENTS = "(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES)"
CONTEXT = [
  DISK_ID = "1",
  ETH0_CONTEXT_FORCE_IPV4 = "",
  ETH0_DNS = "",
  ETH0_GATEWAY = "",
  ETH0_GATEWAY6 = "",
  ETH0_IP = "192.168.233.89",
  ETH0_IP6 = "",
  ETH0_IP6_PREFIX_LENGTH = "",
  ETH0_IP6_ULA = "",
  ETH0_MAC = "02:00:c0:a8:e9:59",
  ETH0_MASK = "",
  ETH0_MTU = "",
  ETH0_NETWORK = "",
  ETH0_SEARCH_DOMAIN = "",
  ETH0_VLAN_ID = "",
  ETH0_VROUTER_IP = "",
  ETH0_VROUTER_IP6 = "",
  ETH0_VROUTER_MANAGEMENT = "",
  ETH1_CONTEXT_FORCE_IPV4 = "",
  ETH1_DNS = "",
  ETH1_GATEWAY = "",
  ETH1_GATEWAY6 = "",
  ETH1_IP = "192.168.0.1",
  ETH1_IP6 = "",
  ETH1_IP6_PREFIX_LENGTH = "",
  ETH1_IP6_ULA = "",
  ETH1_MAC = "02:00:c0:a8:00:01",
  ETH1_MASK = "",
  ETH1_MTU = "",
  ETH1_NETWORK = "",
  ETH1_SEARCH_DOMAIN = "",
  ETH1_VLAN_ID = "10",
  ETH1_VROUTER_IP = "",
  ETH1_VROUTER_IP6 = "",
  ETH1_VROUTER_MANAGEMENT = "",
  FILES_DS = "/var/lib/one//datastores/2/3c5965ba667ac770e448e07fb97e1cc9:'set-root-password.sh' ",
  GATEWAY = "192.168.233.10",
  INIT_SCRIPTS = "set-root-password.sh",
  NETWORK = "YES",
  ROOT_PASSWORD = "12345678",
  SSH_PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZGzwYvMA2wBOFMN98qNii31WVrEsVbSUA2uUepUCWBxGUbDhLau3ZtajUMI9u05avz1JLvkudJTV7+aLMbSuzRNFuc4CUG5IiyeEZ//eMu3GVgIpqr9I70Ws2GaOrroU7aXtE4nCmdTLenx/X+KZcvtL1DR5ek2KOxVsyIPJEsnPAtriGb1SdkzxRz+dlefp5Ud1r4b2p2q6UdL18rEqxqR5AE1mCgii8hGiUsiAR6hITg21W46rckDRGLfyi8qFtD+05U04pEH1jYT3oh5iEspGt3OzPTCyMT9r63w76/SeemU9No2xbmiRu3KUQ80ythK9/ncla1fLudISPBnBF root@opennebula1",
  TARGET = "hda",
  VROUTER_ID = "32",
  VROUTER_KEEPALIVED_ID = "32" ]
CPU = "1"
DISK = [
  ALLOW_ORPHANS = "NO",
  CLONE = "YES",
  CLONE_TARGET = "SYSTEM",
  CLUSTER_ID = "0",
  DATASTORE = "images",
  DATASTORE_ID = "100",
  DEV_PREFIX = "vd",
  DISK_ID = "0",
  DISK_SNAPSHOT_TOTAL_SIZE = "0",
  DISK_TYPE = "FILE",
  DRIVER = "qcow2",
  IMAGE = "alpine-vrouter (KVM)",
  IMAGE_ID = "76",
  IMAGE_STATE = "2",
  IMAGE_UNAME = "oneadmin",
  LN_TARGET = "NONE",
  ORIGINAL_SIZE = "256",
  READONLY = "NO",
  SAVE = "NO",
  SIZE = "256",
  SOURCE = "/var/lib/one//datastores/100/20fec74ecd5c30be655f55679c83c4ea",
  TARGET = "vda",
  TM_MAD = "shared",
  TYPE = "FILE" ]
GRAPHICS = [
  LISTEN = "0.0.0.0",
  PORT = "5994",
  TYPE = "VNC" ]
MEMORY = "1024"
NIC = [
  AR_ID = "1",
  BRIDGE = "ovsbr0",
  CLUSTER_ID = "0",
  IP = "192.168.233.89",
  MAC = "02:00:c0:a8:e9:59",
  MODEL = "virtio",
  NETWORK = "Int router",
  NETWORK_ID = "8",
  NIC_ID = "0",
  SECURITY_GROUPS = "0",
  TARGET = "one-94-0",
  VN_MAD = "ovswitch" ]
NIC = [
  AR_ID = "0",
  BRIDGE = "ovsbr0",
  CLUSTER_ID = "0",
  IP = "192.168.0.1",
  MAC = "02:00:c0:a8:00:01",
  MODEL = "virtio",
  NETWORK = "int_vm_router_vlan10",
  NETWORK_ID = "10",
  NIC_ID = "1",
  SECURITY_GROUPS = "0",
  TARGET = "one-94-1",
  VLAN_ID = "10",
  VN_MAD = "ovswitch" ]
NIC_DEFAULT = [
  MODEL = "virtio" ]
OS = [
  ARCH = "x86_64",
  BOOT = "" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "OUTBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "INBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
SUBMIT_ON_HOLD = "YES"
TEMPLATE_ID = "41"
VMID = "94"
VROUTER_ID = "32"
VROUTER_KEEPALIVED_ID = "32"

Thanks
Hugues

(Alejandro Huertas) #5

Hello @hugues

The problem is that you don’t have a nic in your template. You need to create a virtual network, there you can define a gateway for your router, then when you deploy the router the context section will be well formed.

So please:

  • Create a virtual network and set all the parameters properly.
  • When instantiating the virtual router select that virtual network.
  • Wait until the virtual router is running and check the connectivity.

For more information you can go here.

Best,

Álex.