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

Connect to consoleβ
Warning: Permanently added '192.168.1.210' (ECDSA) to the list of known hosts.
Password:
Welcome to the Cube Appliance
Last login: Wed Feb 4 05:26:05 2020 from 192.168.1.22
#
Load server Credentialsβ
# . /etc/admin-openrc.sh
Create a Zoneβ
+----------------+--------------------------------------+
| Field | Value |
+----------------+--------------------------------------+
| action | CREATE |
| attributes | |
| created_at | 2020-02-05T04:54:29.000000 |
| description | None |
| id | 20af6f9c-b9a6-4b1d-a912-487b86fb9c6d |
| masters | |
| name | bigstack.co. |
| pool_id | 794ccc2c-d751-44fe-b57f-8894c9f5c842 |
| project_id | 03525522f7c547cd88627c626896d04a |
| serial | 1580964869 |
| status | PENDING |
| transferred_at | None |
| ttl | 3600 |
| type | PRIMARY |
| updated_at | None |
| version | 1 |
+----------------+--------------------------------------+
[network_id] Show network listβ
# openstack network list
+--------------------------------------+-------------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+-------------+--------------------------------------+
| 62420cb0-67c3-476a-ae7b-09d64698b303 | lb-mgmt-net | fcce41dd-b99a-482c-8117-b6791f6ae743 |
| bdf01063-4500-4266-9363-36414ba6d252 | internet | 3caa9b99-e3a9-453c-9b91-13dd67fa78dd |
| f5050464-a1e4-4e19-8c04-3949a5cf0340 | private | 24d713e8-5db4-4fc5-bac0-747547737bb0 |
+--------------------------------------+-------------+--------------------------------------+
[dns_domain] Set the private network [network_id] default domain as bigstack.co.β
# neutron net-update f5050464-a1e4-4e19-8c04-3949a5cf0340 --dns_domain bigstack.co.
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Updated network: f5050464-a1e4-4e19-8c04-3949a5cf0340
# openstack network show f5050464-a1e4-4e19-8c04-3949a5cf0340
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2020-02-04T06:41:08Z |
| description | |
| dns_domain | bigstack.co. |
| id | f5050464-a1e4-4e19-8c04-3949a5cf0340 |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | None |
| is_vlan_transparent | None |
| mtu | 1450 |
| name | private |
| port_security_enabled | True |
| project_id | 03525522f7c547cd88627c626896d04a |
| provider:network_type | vxlan |
| provider:physical_network | None |
| provider:segmentation_id | 100 |
| qos_policy_id | None |
| revision_number | 6 |
| router:external | Internal |
| segments | None |
| shared | False |
| status | ACTIVE |
| subnets | 24d713e8-5db4-4fc5-bac0-747547737bb0 |
| tags | |
| updated_at | 2020-02-05T05:30:48Z |
+---------------------------+--------------------------------------+
Create a Virtual Machine on a private [network_id]β
# openstack server create --image Cirros --flavor m1.tiny --nic net-id=f5050464-a1e4-4e19-8c04-3949a5cf0340 test-1
+-------------------------------------+----------------------------------------------------------+
| Field | Value |
+-------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | AUTO |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | sky8 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | sky8 |
| OS-EXT-SRV-ATTR:instance_name | instance-0000000f |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2020-02-05T05:32:19.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | private=192.168.100.27 |
| config_drive | |
| created | 2020-02-05T05:32:01Z |
| flavor | m1.tiny (5fb04908-6596-43bd-98e2-9bd3acb7d970) |
| hostId | 56672bf7f406222f8d15759ae92bc92ea3e89098b8cff785ef1133a6 |
| id | e136f2ad-3c33-40c9-9248-11cd5c49411e |
| image | |
| key_name | roy |
| name | test-1 |
| progress | 0 |
| project_id | 03525522f7c547cd88627c626896d04a |
| properties | |
| security_groups | name='default' |
| status | ACTIVE |
| updated | 2020-02-05T05:32:19Z |
| user_id | d23281f2c2d141af983071f86e53fa3c |
| volumes_attached | id='fe6b225e-4ef8-47b0-b9b1-62cf3d9e57ce' |
+-------------------------------------+----------------------------------------------------------+
[port_id] Look up for network port IDβ
# openstack port list
+--------------------------------------+------------------------+-------------------+-------------------------------------------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses | Status |
+--------------------------------------+------------------------+-------------------+-------------------------------------------------------------------------------+--------+
| 982ddbba-05ed-4665-be07-d7bb28311212 | | fa:16:3e:58:df:bb | ip_address='192.168.100.27', subnet_id='24d713e8-5db4-4fc5-bac0-747547737bb0' | ACTIVE |
+--------------------------------------+------------------------+-------------------+-------------------------------------------------------------------------------+--------+
Check show detail of network port by [port_id]β
# openstack port show 982ddbba-05ed-4665-be07-d7bb28311212
+-----------------------+-------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-------------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | sky8 |
| binding_profile | |
| binding_vif_details | port_filter='True' |
| binding_vif_type | bridge |
| binding_vnic_type | normal |
| created_at | 2020-02-05T05:32:05Z |
| data_plane_status | None |
| description | |
| device_id | e136f2ad-3c33-40c9-9248-11cd5c49411e |
| device_owner | compute:nova |
| dns_assignment | fqdn='test-1.cube.local.', hostname='test-1', ip_address='192.168.100.27' |
| dns_name | test-1 |
| extra_dhcp_opts | |
| fixed_ips | ip_address='192.168.100.27', subnet_id='24d713e8-5db4-4fc5-bac0-747547737bb0' |
| id | 982ddbba-05ed-4665-be07-d7bb28311212 |
| ip_address | None |
| mac_address | fa:16:3e:58:df:bb |
| name | |
| network_id | f5050464-a1e4-4e19-8c04-3949a5cf0340 |
| option_name | None |
| option_value | None |
| port_security_enabled | True |
| project_id | 03525522f7c547cd88627c626896d04a |
| qos_policy_id | None |
| revision_number | 9 |
| security_group_ids | 74e6a165-9c94-47b5-89ba-21c8d113df17 |
| status | ACTIVE |
| subnet_id | None |
| tags | |
| trunk_details | None |
| updated_at | 2020-02-05T05:32:19Z |
+-----------------------+-------------------------------------------------------------------------------+
[zone_id] Look for zone ID of domainβ
# openstack zone show bigstack.co.
+----------------+--------------------------------------+
| Field | Value |
+----------------+--------------------------------------+
| action | NONE |
| attributes | |
| created_at | 2020-02-05T08:43:12.000000 |
| description | None |
| id | a475d193-7873-4f2a-9d90-c7792fae6734 |
| masters | |
| name | bigstack.co |
| pool_id | 794ccc2c-d751-44fe-b57f-8894c9f5c842 |
| project_id | 03525522f7c547cd88627c626896d04a |
| serial | 1580898425 |
| status | ACTIVE |
| transferred_at | None |
| ttl | 3600 |
| type | PRIMARY |
| updated_at | 2020-02-05T10:27:10.000000 |
| version | 4 |
+----------------+--------------------------------------+
Check out the record list by [zone_id] (Before)β
# openstack recordset list a475d193-7873-4f2a-9d90-c7792fae6734
+--------------------------------------+-------------------+------+--------------------------------------------------------+--------+--------+
| id | name | type | records | status | action |
+--------------------------------------+-------------------+------+--------------------------------------------------------+--------+--------+
| 0f161f6e-6a8f-4d60-aeb4-56769bcba66c | bistack.co. | NS | sky8.cube.org. | ACTIVE | NONE |
| 33d38c32-eac9-4fb4-a665-fcc0f3c57ac8 | bistack.co. | SOA | sky8.cube.org. c.l.com. 1580898425 3538 600 86400 3600 | ACTIVE | NONE |
+--------------------------------------+-------------------+------+--------------------------------------------------------+--------+--------+
[floating_ip_address] Create a Floating IPβ
# openstack floating ip create internet
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| created_at | 2020-02-06T04:27:21Z |
| description | |
| fixed_ip_address | None |
| floating_ip_address | 192.168.1.143 |
| floating_network_id | bdf01063-4500-4266-9363-36414ba6d252 |
| id | b998ad59-0c9b-4d5a-8702-1df8c8490232 |
| name | 192.168.1.143 |
| port_id | None |
| project_id | 03525522f7c547cd88627c626896d04a |
| revision_number | 0 |
| router_id | None |
| status | DOWN |
| updated_at | 2020-02-06T04:27:21Z |
+---------------------+--------------------------------------+
Attach the [floating_ip_address] to the [port_id]β
# openstack floating ip set --port 982ddbba-05ed-4665-be07-d7bb28311212 192.168.1.143
Check out the record list by [zone_id] (After)β
# openstack recordset list a475d193-7873-4f2a-9d90-c7792fae6734
+--------------------------------------+---------------------+------+--------------------------------------------------------+--------+--------+
| id | name | type | records | status | action |
+--------------------------------------+---------------------+------+--------------------------------------------------------+--------+--------+
| 0f161f6e-6a8f-4d60-aeb4-56769bcba66c | bistack.co. | NS | sky8.cube.org. | ACTIVE | NONE |
| 33d38c32-eac9-4fb4-a665-fcc0f3c57ac8 | bistack.co. | SOA | sky8.cube.org. c.l.com. 1580898425 3538 600 86400 3600 | ACTIVE | NONE |
| 0abfc156-fb0b-441a-af5b-f820ce2bfa0f | test-1.bigstack.co. | A | 192.168.1.143 | ACTIVE | NONE |
+--------------------------------------+---------------------+------+--------------------------------------------------------+--------+--------+
Show your virtual Machineβ
# openstack server list
+--------------------------------------+--------+--------+---------------------------------------+--------+---------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+--------+--------+---------------------------------------+--------+---------+
| e136f2ad-3c33-40c9-9248-11cd5c49411e | test-1 | ACTIVE | private=192.168.100.27, 192.168.1.143 | Cirros | m1.tiny |
+--------------------------------------+--------+--------+---------------------------------------+--------+---------+
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.