這篇文章主要介紹了怎么用OpenStack Designate構(gòu)建一個(gè)DNS即服務(wù),具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
成都創(chuàng)新互聯(lián)主營巫山網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,app軟件定制開發(fā),巫山h5重慶小程序開發(fā)搭建,巫山網(wǎng)站營銷推廣歡迎巫山等地區(qū)企業(yè)咨詢
Designate 是一個(gè)多租戶的 DNS 即服務(wù),它包括一個(gè)用于域名和記錄管理的 REST API 和集成了 Neutron 的框架,并支持 Bind9。
DNSaaS 可以提供:
一個(gè)管理區(qū)域和記錄的干凈利落的 REST API
自動(dòng)生成記錄(集成 OpenStack)
支持多個(gè)授權(quán)名字服務(wù)器
可以托管多個(gè)項(xiàng)目/組織
Designate's architecture
這篇文章解釋了如何在 CentOS 和 RHEL 上手動(dòng)安裝和配置 Designate 的當(dāng)前版本,但是同樣的配置也可以用在其它發(fā)行版上。
在我的 GitHub 倉庫里,我已經(jīng)放了 Ansible 的 bind 和 Designate 角色的示范設(shè)置。
這個(gè)設(shè)置假定 bing 服務(wù)是安裝 OpenStack 控制器節(jié)點(diǎn)之外(即使你可以在本地安裝 bind)。
1、在 OpenStack 控制節(jié)點(diǎn)上安裝 Designate 和 bind 軟件包:
# yum install openstack-designate-* bind bind-utils -y
2、創(chuàng)建 Designate 數(shù)據(jù)庫和用戶:
MariaDB [(none)]> CREATE DATABASE designate CHARACTER SET utf8 COLLATE utf8_general_ci; MariaDB [(none)]> GRANT ALL PRIVILEGES ON designate.* TO \'designate'@'localhost' IDENTIFIED BY 'rhlab123'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON designate.* TO 'designate'@'%' \IDENTIFIED BY 'rhlab123';
注意:bind 包必須安裝在控制節(jié)點(diǎn)之外才能使遠(yuǎn)程名字服務(wù)控制(RNDC)功能正常。
1、生成 RNDC 文件:
rndc-confgen -a -k designate -c /etc/rndc.key -r /dev/urandom cat <etcrndc.confinclude "/etc/rndc.key";options { default-key "designate"; default-server {{ DNS_SERVER_IP }}; default-port 953;};EOF
2、將下列配置添加到 named.conf
:
include "/etc/rndc.key"; controls { inet {{ DNS_SERVER_IP }} allow { localhost;{{ CONTROLLER_SERVER_IP }}; } keys { "designate"; };};
在 option
節(jié)中,添加:
options { ... allow-new-zones yes; request-ixfr no; listen-on port 53 { any; }; recursion no; allow-query { 127.0.0.1; {{ CONTROLLER_SERVER_IP }}; };};
添加正確的權(quán)限:
chown named:named /etc/rndc.keychown named:named /etc/rndc.confchmod 600 /etc/rndc.keychown -v root:named /etc/named.confchmod g+w /var/named # systemctl restart named# setsebool named_write_master_zones 1
3、把 rndc.key
和 rndc.conf
推入 OpenStack 控制節(jié)點(diǎn):
# scp -r /etc/rndc* {{ CONTROLLER_SERVER_IP }}:/etc/
輸入:
# openstack user create --domain default --password-prompt designate# openstack role add --project services --user designate admin# openstack service create --name designate --description "DNS" dns # openstack endpoint create --region RegionOne dns public http://{{ CONTROLLER_SERVER_IP }}:9001/# openstack endpoint create --region RegionOne dns internal http://{{ CONTROLLER_SERVER_IP }}:9001/ # openstack endpoint create --region RegionOne dns admin http://{{ CONTROLLER_SERVER_IP }}:9001/
1、編輯 /etc/designate/designate.conf
:
在 [service:api]
節(jié)配置 auth_strategy
:
[service:api]listen = 0.0.0.0:9001auth_strategy = keystoneapi_base_uri = http://{{ CONTROLLER_SERVER_IP }}:9001/enable_api_v2 = Trueenabled_extensions_v2 = quotas, reports
在 [keystone_authtoken]
節(jié)配置下列選項(xiàng):
[keystone_authtoken]auth_type = passwordusername = designatepassword = rhlab123project_name = serviceproject_domain_name = Defaultuser_domain_name = Defaultwww_authenticate_uri = http://{{ CONTROLLER_SERVER_IP }}:5000/auth_url = http://{{ CONTROLLER_SERVER_IP }}:5000/
在 [service:worker]
節(jié),啟用 worker 模型:
enabled = Truenotify = True
在 [storage:sqlalchemy]
節(jié),配置數(shù)據(jù)庫訪問:
[storage:sqlalchemy]connection = MySQL+pymysql://designate:rhlab123@{{ CONTROLLER_SERVER_IP }}/designate
填充 Designate 數(shù)據(jù)庫:
# su -s /bin/sh -c "designate-manage database sync" designate
2、 創(chuàng)建 Designate 的 pools.yaml
文件(包含 target 和 bind 細(xì)節(jié)):
編輯 /etc/designate/pools.yaml
:
- name: default # The name is immutable. There will be no option to change the name after # creation and the only way will to change it will be to delete it # (and all zones associated with it) and recreate it. description: Default Pool attributes: {} # List out the NS records for zones hosted within this pool # This should be a record that is created outside of designate, that # points to the public IP of the controller node. ns_records: - hostname: {{Controller_FQDN}}. # Thisis mDNS priority: 1 # List out the nameservers for this pool. These are the actual BIND servers. # We use these to verify changes have propagated to all nameservers. nameservers: - host: {{ DNS_SERVER_IP }} port: 53 # List out the targets for this pool. For BIND there will be one # entry for each BIND server, as we have to run rndc command on each server targets: - type: bind9 description: BIND9 Server 1 # List out the designate-mdns servers from which BIND servers should # request zone transfers (AXFRs) from. # This should be the IP of the controller node. # If you have multiple controllers you can add multiple masters # by running designate-mdns on them, and adding them here. masters: - host: {{ CONTROLLER_SERVER_IP }} port: 5354 # BIND Configuration options options: host: {{ DNS_SERVER_IP }} port: 53 rndc_host: {{ DNS_SERVER_IP }} rndc_port: 953 rndc_key_file: /etc/rndc.key rndc_config_file: /etc/rndc.conf
填充 Designate 池:
su -s /bin/sh -c "designate-manage pool update" designate
3、啟動(dòng) Designate 中心和 API 服務(wù):
systemctl enable --now designate-central designate-api
4、驗(yàn)證 Designate 服務(wù)運(yùn)行:
# openstack dns service list +--------------+--------+-------+--------------+| service_name | status | stats | capabilities |+--------------+--------+-------+--------------+| central | UP | - | - || api | UP | - | - || mdns | UP | - | - || worker | UP | - | - || producer | UP | - | - |+--------------+--------+-------+--------------+
1、為 Designate 服務(wù)配置 iptables:
# iptables -I INPUT -p tcp -m multiport --dports 9001 -m comment --comment "designate incoming" -j ACCEPT # iptables -I INPUT -p tcp -m multiport --dports 5354 -m comment --comment "Designate mdns incoming" -j ACCEPT # iptables -I INPUT -p tcp -m multiport --dports 53 -m comment --comment "bind incoming" -j ACCEPT # iptables -I INPUT -p udp -m multiport --dports 53 -m comment --comment "bind/powerdns incoming" -j ACCEPT # iptables -I INPUT -p tcp -m multiport --dports 953 -m comment --comment "rndc incoming - bind only" -j ACCEPT # service iptables save; service iptables restart# setsebool named_write_master_zones 1
2、 編輯 /etc/neutron/neutron.conf
的 [default]
節(jié):
external_dns_driver = designate
3、 在 /etc/neutron/neutron.conf
中添加 [designate]
節(jié):
[designate]url = http://{{ CONTROLLER_SERVER_IP }}:9001/v2 ## This end point of designateauth_type = passwordauth_url = http://{{ CONTROLLER_SERVER_IP }}:5000username = designatepassword = rhlab123project_name = servicesproject_domain_name = Defaultuser_domain_name = Defaultallow_reverse_dns_lookup = Trueipv4_ptr_zone_prefix_size = 24ipv6_ptr_zone_prefix_size = 116
4、編輯 neutron.conf
的 dns_domain
:
dns_domain = rhlab.dev.
重啟:
# systemctl restart neutron-*
5、在 /etc/neutron/plugins/ml2/ml2_conf.ini
中的組成層 2(ML2)中添加 dns
:
extension_drivers=port_security,qos,dns
6、在 Designate 中添加區(qū)域:
# openstack zone create –email=admin@rhlab.dev rhlab.dev.
在 rhlab.dev
區(qū)域中添加記錄:
# openstack recordset create --record '192.168.1.230' --type A rhlab.dev. Test
Designate 現(xiàn)在就安裝和配置好了。
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“怎么用OpenStack Designate構(gòu)建一個(gè)DNS即服務(wù)”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!