vr_dhcp4 - OpenNebula/one-apps GitHub Wiki

DHCP4

This module implements OpenNebula-compatible DHCP server. IP leases are based on the client MAC address as set by OpenNebula. The lowest 32-bits of the MAC address corresponds to the IP address assigned in OpenNebula.

Virtual Router Configuration

The following attributes control the basic configuration for the DHCP service:

  • ONEAPP_VNF_DHCP4_ENABLED to enable the DHCP service
  • ONEAPP_VNF_DHCP4_INTERFACES list of interfaces to listen for DHCP_DISCOVER messages
  • ONEAPP_VNF_DHCP4_DNS DNS server IP to send as DHCP option
  • ONEAPP_VNF_DHCP4_GATEWAY default gateway IP to send as DHCP option

For example, to configure a Virtual Router as DHCP server and default gateway for the the associated private network:

CONTEXT = [
  ...
  ONEAPP_VNF_DHCP4_ENABLED    = "YES",
  ONEAPP_VNF_DHCP4_INTERFACES = "eth1",
  ONEAPP_VNF_DHCP4_GATEWAY    = "<ETH1_EP0>", # the "global" default
  ONEAPP_VNF_DHCP4_DNS        = "1.1.1.1",    # the "global" default
  ...
]

Note

The MAC address for particular NIC is constructed as a concatenation of 02:00 (default) prefix followed by hexadecimal representation of the allocated IPv4 address 01:02:03:04 (e.g., for 1.2.3.4). The ONEAPP_VNF_DHCP4_MAC2IP_MACPREFIX must match the MAC_PREFIX used in your oned.conf file (02:00 by default), otherwise no IPv4 address will be assigned.

IP Address interpolation for Gateway and DNS

Similarly to the IP Address Placeholders, you can use the same placeholders for defining GW / DNS values, for example:

CONTEXT = [
  ...
  ONEAPP_VNF_DHCP4_ENABLED    = "YES",
  ONEAPP_VNF_DHCP4_INTERFACES = "eth1",

  ONEAPP_VNF_DHCP4_GATEWAY = "<ETH1_EP0>", # the "global" default
  ONEAPP_VNF_DHCP4_DNS     = "1.1.1.1",    # the "global" default

  ONEAPP_VNF_DHCP4_ETH1_GATEWAY = "<ETH1_VIP0>",
  ONEAPP_VNF_DHCP4_ETH1_DNS     = "<ETH1_VIP0>",
  ...
],

Context Configuration Attributes

Parameter Default Description
ONEAPP_VNF_DHCP4_ENABLED NO Enable/Disable DHCP4 feature (YES/NO)
ONEAPP_VNF_DHCP4_INTERFACES all NICs List of NICs to listen on (<[!]ethX> ...)
ONEAPP_VNF_DHCP4_AUTHORITATIVE YES Server authoritativity (YES/NO)
ONEAPP_VNF_DHCP4_LEASE_TIME 3600 DHCP lease time (seconds)
ONEAPP_VNF_DHCP4_DNS none Default nameserver (IP address)
ONEAPP_VNF_DHCP4_GATEWAY none Default gateway (IP address)
ONEAPP_VNF_DHCP4_MAC2IP_ENABLED YES Enable/Disable MAC-to-IP translation (YES/NO)
ONEAPP_VNF_DHCP4_MAC2IP_MACPREFIX 02:00 2-bytes OpenNebula MAC prefix for MAC-to-IP translation
ONEAPP_VNF_DHCP4_ETHx none Custom interface subnet/pool range (<CIDR>:<start IP>-<end IP>)
ONEAPP_VNF_DHCP4_ETHx_DNS none Custom interface pool DNS (<IP> ...)
ONEAPP_VNF_DHCP4_ETHx_GATEWAY none Custom interface pool gateway (<IP> ...)
ONEAPP_VNF_DHCP4_ETHx_MTU none Custom interface pool MTU option (integer)
⚠️ **GitHub.com Fallback** ⚠️