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> iaas
controller:iaas> network
controller:network> network_set
Select domain:
1: Default
Enter index: 1
Select tenant:
1: admin
Enter index: 1
Select network:
1: public__network
2: private__network
Enter index: 2
Select type:
1: name
2: description
3: qos-policy
4: no-qos-policy
5: dns-domain
6: no-dns-domain
Enter index: 5
Input value: bigstack.local.
Updated network: 97d17848-d2d3-4400-86cd-6397af9cd555

Check up the dns_domain prefix

controller:network> network_show
Select domain:
1: Default
Enter index: 1
Select tenant:
1: admin
Enter index: 1
Select network:
1: public__network
2: private__network
Enter 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.local
    PING test-2.bigstack.local (192.168.1.47): 56 data bytes
    64 bytes from 192.168.1.47: seq=0 ttl=64 time=0.019 ms
    64 bytes from 192.168.1.47: seq=1 ttl=64 time=0.062 ms
    64 bytes from 192.168.1.47: seq=2 ttl=64 time=0.040 ms
    64 bytes from 192.168.1.47: seq=3 ttl=64 time=0.067 ms
    64 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.