CentOS 7
Sponsored Link

OpenStack Queens : Designate 利用方法
2018/03/27
 
OpenStack DNS Service(Designate)の利用方法です。
当例では以下のような環境を例に Designate をインストールしています。
     ------------+---------------------------+---------------------------+------------
                 |                           |                           |
             eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
     +-----------+-----------+   +-----------+-----------+   +-----------+-----------+
     |    [ Control Node ]   |   |    [ Network Node ]   |   |    [ Compute Node ]   |
     |                       |   |                       |   |                       |
     |  MariaDB    RabbitMQ  |   |      Open_vSwitch     |   |        Libvirt        |
     |  Memcached  httpd     |   |   L2_Agent L3_Agent   |   |     Nova_Compute      |
     |  Keystone   Glance    |   |     Metadata_Agent    |   |      Open_vSwitch     |
     |  Nova_API  Cinder_API |   |     Cinder_Volume     |   |        L2_Agent       |
     |  Neutron_Server       |   |        Heat_API       |   |                       |
     |  Metadata_Agent       |   |      Heat Engine      |   |                       |
     |  Gnocchi              |   |   Designate_Services  |   |                       |
     |  Ceilometer_Services  |   |   named               |   |                       |
     +-----------------------+   +-----------------------+   +-----------------------+

[1] Openstack システムを利用可能な任意のユーザーで認証して、DNS エントリを作成します。
作業は、どこでもよいですが、当例ではコントロールノード上で行います。
例として [server.education] の正引きゾーンを作成します。
[cent@dlp ~(keystone)]$
openstack zone create --email dnsmaster@server.education server.education.

+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| action         | CREATE                               |
| attributes     |                                      |
| created_at     | 2018-03-29T02:10:05.000000           |
| description    | None                                 |
| email          | dnsmaster@server.education           |
| id             | 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b |
| masters        |                                      |
| name           | server.education.                    |
| pool_id        | 794ccc2c-d751-44fe-b57f-8894c9f5c842 |
| project_id     | b2e6fbae26044ca085edb25f7004344b     |
| serial         | 1522289405                           |
| status         | PENDING                              |
| transferred_at | None                                 |
| ttl            | 3600                                 |
| type           | PRIMARY                              |
| updated_at     | None                                 |
| version        | 1                                    |
+----------------+--------------------------------------+

# [status] が [ACTIVE] であれば OK

[cent@dlp ~(keystone)]$
openstack zone list

+--------------------------------------+-------------------+---------+------------+--------+--------+
| id                                   | name              | type    |     serial | status | action |
+--------------------------------------+-------------------+---------+------------+--------+--------+
| 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b | server.education. | PRIMARY | 1522289405 | ACTIVE | NONE   |
+--------------------------------------+-------------------+---------+------------+--------+--------+

# A レコードを登録する

[cent@dlp ~(keystone)]$
openstack recordset create --record '192.168.100.10' --type A server.education. www

+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| action      | CREATE                               |
| created_at  | 2018-03-29T02:10:44.000000           |
| description | None                                 |
| id          | 4c46080d-390a-4e69-94c0-7e30d7ee5a1b |
| name        | www.server.education.                |
| project_id  | b2e6fbae26044ca085edb25f7004344b     |
| records     | 192.168.100.10                       |
| status      | PENDING                              |
| ttl         | None                                 |
| type        | A                                    |
| updated_at  | None                                 |
| version     | 1                                    |
| zone_id     | 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b |
| zone_name   | server.education.                    |
+-------------+--------------------------------------+

# [status] が [ACTIVE] であれば OK

[cent@dlp ~(keystone)]$
openstack recordset list server.education.

+--------------+-----------------------+------+------------------------------------------------
| id           | name                  | type | records                                        
+--------------+-----------------------+------+------------------------------------------------
| 31c43b7d-... | server.education.     | SOA  | network.srv.world. dnsmaster.server.education. 
| 82bbd2c4-... | server.education.     | NS   | network.srv.world.                             
| 4c46080d-... | www.server.education. | A    | 192.168.100.10                                 
+--------------+-----------------------+------+------------------------------------------------
-------------------------------+--------+--------+
                               | status | action |
-------------------------------+--------+--------+
1522289444 3516 600 86400 3600 | ACTIVE | NONE   |
                               | ACTIVE | NONE   |
                               | ACTIVE | NONE   |
-------------------------------+--------+--------+

# 確認

[cent@dlp ~(keystone)]$
dig -p 5354 @network.srv.world www.server.education.

; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7_4.2 <<>> -p 5354 @network.srv.world www.server.education.
; (1 server found)
;; global options: +cmd
;; Got answer:
;; -<<>>HEADER<<- opcode: QUERY, status: NOERROR, id: 19692
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 8192
;; QUESTION SECTION:
;www.server.education.          IN      A

;; ANSWER SECTION:
www.server.education.   3600    IN      A       192.168.100.10

;; Query time: 42 msec
;; SERVER: 10.0.0.50#5354(10.0.0.50)
;; WHEN: Thu Mar 27 19:11:44 JST 2018
;; MSG SIZE  rcvd: 65
[2] 例として [192.168.100.0/24] の逆引きゾーンを作成します。
[cent@dlp ~(keystone)]$
openstack zone create --email dnsmaster@server.education 100.168.192.in-addr.arpa.

+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| action         | CREATE                               |
| attributes     |                                      |
| created_at     | 2018-03-29T02:17:08.000000           |
| description    | None                                 |
| email          | dnsmaster@server.education           |
| id             | f3ea2363-4a8d-46f0-a609-d926733fd3e1 |
| masters        |                                      |
| name           | 100.168.192.in-addr.arpa.            |
| pool_id        | 794ccc2c-d751-44fe-b57f-8894c9f5c842 |
| project_id     | b2e6fbae26044ca085edb25f7004344b     |
| serial         | 1522289828                           |
| status         | PENDING                              |
| transferred_at | None                                 |
| ttl            | 3600                                 |
| type           | PRIMARY                              |
| updated_at     | None                                 |
| version        | 1                                    |
+----------------+--------------------------------------+

# [status] が [ACTIVE] であれば OK

[cent@dlp ~(keystone)]$
openstack zone list

+--------------------------------------+---------------------------+---------+------------+--------+--------+
| id                                   | name                      | type    |     serial | status | action |
+--------------------------------------+---------------------------+---------+------------+--------+--------+
| 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b | server.education.         | PRIMARY | 1522289444 | ACTIVE | NONE   |
| f3ea2363-4a8d-46f0-a609-d926733fd3e1 | 100.168.192.in-addr.arpa. | PRIMARY | 1522289828 | ACTIVE | NONE   |
+--------------------------------------+---------------------------+---------+------------+--------+--------+

# PTR レコードを登録する

[cent@dlp ~(keystone)]$
openstack recordset create --record 'www.server.education.' --type PTR 100.168.192.in-addr.arpa. 10

+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| action      | CREATE                               |
| created_at  | 2018-03-29T02:17:53.000000           |
| description | None                                 |
| id          | 6e6f6c92-e45c-4f43-848a-2ed698c9b69e |
| name        | 10.100.168.192.in-addr.arpa.         |
| project_id  | b2e6fbae26044ca085edb25f7004344b     |
| records     | www.server.education.                |
| status      | PENDING                              |
| ttl         | None                                 |
| type        | PTR                                  |
| updated_at  | None                                 |
| version     | 1                                    |
| zone_id     | f3ea2363-4a8d-46f0-a609-d926733fd3e1 |
| zone_name   | 100.168.192.in-addr.arpa.            |
+-------------+--------------------------------------+

# [status] が [ACTIVE] であれば OK

[cent@dlp ~(keystone)]$
openstack recordset list 100.168.192.in-addr.arpa.

+--------------+------------------------------+------+------------------------------------------------
| id           | name                         | type | records                                        
+--------------+------------------------------+------+------------------------------------------------
| cf59c9a4-... | 100.168.192.in-addr.arpa.    | NS   | network.srv.world.                             
| ef975209-... | 100.168.192.in-addr.arpa.    | SOA  | network.srv.world. dnsmaster.server.education. 
| 6e6f6c92-... | 10.100.168.192.in-addr.arpa. | PTR  | www.server.education.                          
+--------------+------------------------------+------+------------------------------------------------
-------------------------------+--------+--------+
                               | status | action |
-------------------------------+--------+--------+
                               | ACTIVE | NONE   |
1522289873 3590 600 86400 3600 | ACTIVE | NONE   |
                               | ACTIVE | NONE   |
-------------------------------+--------+--------+

# 確認

[cent@dlp ~(keystone)]$
dig -p 5354 @network.srv.world -x 192.168.100.10

; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7_4.2 <<>> -p 5354 @network.srv.world -x 192.168.100.10
; (1 server found)
;; global options: +cmd
;; Got answer:
;; -<<>>HEADER<<- opcode: QUERY, status: NOERROR, id: 39962
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 8192
;; QUESTION SECTION:
;10.100.168.192.in-addr.arpa.   IN      PTR

;; ANSWER SECTION:
10.100.168.192.in-addr.arpa. 3600 IN    PTR     www.server.education.

;; Query time: 47 msec
;; SERVER: 10.0.0.50#5354(10.0.0.50)
;; WHEN: Thu Mar 29 11:18:46 JST 2018
;; MSG SIZE  rcvd: 90
[3] レコードやゾーンを削除するには以下のように実行します。
[cent@dlp ~(keystone)]$
openstack recordset list server.education.

+--------------+-----------------------+------+------------------------------------------------
| id           | name                  | type | records                                        
+--------------+-----------------------+------+------------------------------------------------
| 31c43b7d-... | server.education.     | SOA  | network.srv.world. dnsmaster.server.education. 
| 82bbd2c4-... | server.education.     | NS   | network.srv.world.                             
| 4c46080d-... | www.server.education. | A    | 192.168.100.10                                 
+--------------+-----------------------+------+------------------------------------------------
-------------------------------+--------+--------+
                               | status | action |
-------------------------------+--------+--------+
1522289444 3516 600 86400 3600 | ACTIVE | NONE   |
                               | ACTIVE | NONE   |
                               | ACTIVE | NONE   |
-------------------------------+--------+--------+

# www レコードを削除する

[cent@dlp ~(keystone)]$
openstack recordset delete server.education. www.server.education.

+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| action      | DELETE                               |
| created_at  | 2018-03-29T02:10:44.000000           |
| description | None                                 |
| id          | 4c46080d-390a-4e69-94c0-7e30d7ee5a1b |
| name        | www.server.education.                |
| project_id  | b2e6fbae26044ca085edb25f7004344b     |
| records     | 192.168.100.10                       |
| status      | PENDING                              |
| ttl         | None                                 |
| type        | A                                    |
| updated_at  | 2018-03-29T02:32:21.000000           |
| version     | 2                                    |
| zone_id     | 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b |
| zone_name   | server.education.                    |
+-------------+--------------------------------------+

[cent@dlp ~(keystone)]$
openstack recordset list server.education.

+--------------+-------------------+------+------------------------------------------------
| id           | name              | type | records                                        
+--------------+-------------------+------+------------------------------------------------
| 31c43b7d-... | server.education. | SOA  | network.srv.world. dnsmaster.server.education. 
| 82bbd2c4-... | server.education. | NS   | network.srv.world.                             
+--------------+-------------------+------+------------------------------------------------
-------------------------------+--------+--------+
                               | status | action |
-------------------------------+--------+--------+
1522290740 3516 600 86400 3600 | ACTIVE | NONE   |
                               | ACTIVE | NONE   |
-------------------------------+--------+--------+

[cent@dlp ~(keystone)]$
openstack zone list

+--------------------------------------+---------------------------+---------+------------+--------+--------+
| id                                   | name                      | type    |     serial | status | action |
+--------------------------------------+---------------------------+---------+------------+--------+--------+
| 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b | server.education.         | PRIMARY | 1522290740 | ACTIVE | NONE   |
| f3ea2363-4a8d-46f0-a609-d926733fd3e1 | 100.168.192.in-addr.arpa. | PRIMARY | 1522289873 | ACTIVE | NONE   |
+--------------------------------------+---------------------------+---------+------------+--------+--------+

# server.education. ゾーンを削除する

[cent@dlp ~(keystone)]$
openstack zone delete server.education.

+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| action         | DELETE                               |
| attributes     |                                      |
| created_at     | 2018-03-29T02:10:05.000000           |
| description    | None                                 |
| email          | dnsmaster@server.education           |
| id             | 3fb0fe45-95ad-424e-a59a-9ba409a7ac7b |
| masters        |                                      |
| name           | server.education.                    |
| pool_id        | 794ccc2c-d751-44fe-b57f-8894c9f5c842 |
| project_id     | b2e6fbae26044ca085edb25f7004344b     |
| serial         | 1522290740                           |
| status         | PENDING                              |
| transferred_at | None                                 |
| ttl            | 3600                                 |
| type           | PRIMARY                              |
| updated_at     | 2018-03-29T02:35:23.000000           |
| version        | 11                                   |
+----------------+--------------------------------------+

[cent@dlp ~(keystone)]$
openstack zone list

+--------------------------------------+---------------------------+---------+------------+--------+--------+
| id                                   | name                      | type    |     serial | status | action |
+--------------------------------------+---------------------------+---------+------------+--------+--------+
| f3ea2363-4a8d-46f0-a609-d926733fd3e1 | 100.168.192.in-addr.arpa. | PRIMARY | 1522289873 | ACTIVE | NONE   |
+--------------------------------------+---------------------------+---------+------------+--------+--------+
 
Tweet