Skip to main content
Version: 1.3

Automatically create subdomain with a domain preset whenever a floating IP is assigned to Virtual Machine

Setting the DNS of Network#

Goto Admin > Network > Networks, click on the Network Name from the list of your Networks then hit the action button EDIT SUBNET, go to Subnet Details and type in your DNS Name Servers, it should be your controller IP address or VIP and SAVE

/assets/dns/DNSaaS06.png

Create DNS Zone#

Goto Project > DNS > Zones, click on the CREATE ZONE

  • create zone with a preferred/registered domain name

/assets/dns/DNSaaS07.png

Connect to console#

$ ssh [email protected]Warning: Permanently added '192.168.1.210' (ECDSA) to the list of known hosts.Password:Welcome to the Cube Appliance

Setting a prefix dns_domain on a private network through CLI#

controller> iaascontroller:iaas> networkcontroller:network> network_setSelect domain:1: DefaultEnter index: 1Select tenant:1: adminEnter index: 1Select network:1: public__network2: private__networkEnter index: 2Select type:1: name2: description3: qos-policy4: no-qos-policy5: dns-domain6: no-dns-domainEnter index: 5Input value: bigstack.local.Updated network: 97d17848-d2d3-4400-86cd-6397af9cd555

Check up the dns_domain prefix#

controller:network> network_showSelect domain:1: DefaultEnter index: 1Select tenant:1: adminEnter index: 1Select network:1: public__network2: private__networkEnter index: 2+---------------------------+--------------------------------------+| Field                     | Value                                |+---------------------------+--------------------------------------+| admin_state_up            | UP                                   || availability_zone_hints   |                                      || availability_zones        | nova                                 || created_at                | 2020-02-10T09:24:57Z                 || description               |                                      || dns_domain                | bigstack.local.                      || id                        | 97d17848-d2d3-4400-86cd-6397af9cd555 || ipv4_address_scope        | None                                 || ipv6_address_scope        | None                                 || is_default                | None                                 || is_vlan_transparent       | None                                 || mtu                       | 1450                                 || name                      | private__network                     || port_security_enabled     | True                                 || project_id                | 0aa485a826da47428c8ef5e88f5d1bea     || provider:network_type     | vxlan                                || provider:physical_network | None                                 || provider:segmentation_id  | 100                                  || qos_policy_id             | None                                 || revision_number           | 4                                    || router:external           | Internal                             || segments                  | None                                 || shared                    | False                                || status                    | ACTIVE                               || subnets                   | 1177bafe-cbb2-429c-abcb-6c0cc818a710 || tags                      |                                      || updated_at                | 2020-02-10T09:28:48Z                 |+---------------------------+--------------------------------------+

Associate Floating IP to your Instances#

Goto Project > Compute > Instances, click on the ASSOCIATE FLOATING IP from the Actions

/assets/dns/DNSaaS08.png

An IP 192.168.1.47 has been associated to your instance test-2

/assets/dns/DNSaaS09.png

Check the zone record set of bigstack.local.#

A Record has been created according to your instance's hostname test-2.bigstack.local.

/assets/dns/DNSaaS10.png

Test the DNS#

  • connect your virtual machine and ping test-2.bigstack.local

    $ ssh [email protected]Warning: Permanently added '192.168.1.47' (ECDSA) to the list of known hosts.$ ping test-2.bigstack.localPING test-2.bigstack.local (192.168.1.47): 56 data bytes64 bytes from 192.168.1.47: seq=0 ttl=64 time=0.019 ms64 bytes from 192.168.1.47: seq=1 ttl=64 time=0.062 ms64 bytes from 192.168.1.47: seq=2 ttl=64 time=0.040 ms64 bytes from 192.168.1.47: seq=3 ttl=64 time=0.067 ms64 bytes from 192.168.1.47: seq=4 ttl=64 time=0.035 ms

Summary#

In this use case, the address of a floating IP is published in the external DNS service in conjunction with the dns_name of its associated port and the dns_domain of the port’s network. The steps to execute in this use case are the following:

  • Assign a valid domain name to the network’s dns_domain attribute. This name must end with a period (.).
  • Boot an instance or alternatively, create a port specifying a valid value to its dns_name attribute. If the port is going to be used for an instance boot, the value assigned to dns_name must be equal to the hostname that the Compute service will assign to the instance. Otherwise, the boot will fail.
  • Create a floating IP and associate it to the port.
Last updated on by Roy Tan