Chapter 3. Install and Configure PowerDNS
These steps install PowerDNS, and then configure integration with DNSaaS.
3.1. Install PowerDNS Copy linkLink copied to clipboard!
1. Install but disable the EPEL repository:
cd /root curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm yum -y install epel-release-7-5.noarch.rpm yum-config-manager --disable epel
# cd /root
# curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# yum -y install epel-release-7-5.noarch.rpm
# yum-config-manager --disable epel
2. Install the PowerDNS and MySQL backends:
yum -y --enablerepo=epel install pdns pdns-backend-mysql bind-utils
# yum -y --enablerepo=epel install pdns pdns-backend-mysql bind-utils
3. Create the PowerDNS database. Update the IDENTIFIED BY 'ComplexAlphanumericPassword' value to suit your environment.
3.2. Configure PowerDNS Copy linkLink copied to clipboard!
1. Update the local-address and mysql-password values in the /etc/pdns/pdns.conf file to suit your environment:
2. Configure the DNSaaS pool target for PowerDNS:
Remember to update your database password as needed. See the portion containing the string: ComplexAlphanumericPassword
openstack-config --set /etc/designate/designate.conf pool_target:$target_id type powerdns openstack-config --set /etc/designate/designate.conf pool_target:$target_id options "connection: mysql://designate:ComplexAlphanumericPassword@192.168.100.20/designate_pdns?charset=utf8" openstack-config --set /etc/designate/designate.conf pool_target:$target_id masters 192.168.100.20:5354
# openstack-config --set /etc/designate/designate.conf pool_target:$target_id type powerdns
# openstack-config --set /etc/designate/designate.conf pool_target:$target_id options "connection: mysql://designate:ComplexAlphanumericPassword@192.168.100.20/designate_pdns?charset=utf8"
# openstack-config --set /etc/designate/designate.conf pool_target:$target_id masters 192.168.100.20:5354
3. Sync your database: This creates the table structure for PowerDNS in its database.
designate-manage powerdns sync $target_id
# designate-manage powerdns sync $target_id
4. Restart DNSaaS to apply the pool changes:
systemctl restart designate-api systemctl restart designate-central systemctl restart designate-mdns systemctl restart designate-pool-manager systemctl restart designate-sink
# systemctl restart designate-api
# systemctl restart designate-central
# systemctl restart designate-mdns
# systemctl restart designate-pool-manager
# systemctl restart designate-sink
4. Start and enable the PowerDNS service:
systemctl enable pdns systemctl start pdns
# systemctl enable pdns
# systemctl start pdns
5. Test PowerDNS:
netstat -tap | grep pdns netstat -tulpn | grep 53 dig @192.168.100.20
# netstat -tap | grep pdns
# netstat -tulpn | grep 53
# dig @192.168.100.20
3.3. Troubleshooting Copy linkLink copied to clipboard!
You can review the DNSaaS logs for any error messages:
3.4. Test DNSaaS integration with PowerDNS Copy linkLink copied to clipboard!
1. Create your DNS server record (don’t forget the . at the end of the --name option)
designate server-list designate server-create --name $(hostname).
# designate server-list
# designate server-create --name $(hostname).
2. Create a domain (don’t forget the . at the end of the --name option)
designate domain-list designate domain-create --name example.com. --email root@example.com
# designate domain-list
# designate domain-create --name example.com. --email root@example.com
3. Create a record and test lookup (don’t forget the . at the end of the --name option)
DOMAINID=$(designate domain-list | grep example.com | awk '{print $2}')
designate record-create --name server1.example.com. --type A --data 1.2.3.4 $DOMAINID
dig +short -p 53 @192.168.100.20 server1.example.com A
# DOMAINID=$(designate domain-list | grep example.com | awk '{print $2}')
# designate record-create --name server1.example.com. --type A --data 1.2.3.4 $DOMAINID
# dig +short -p 53 @192.168.100.20 server1.example.com A
3.5. Configure auto-generation of DNS records (nova fixed and neutron floating) Copy linkLink copied to clipboard!
The DNSaaS Sink listens to Compute and OpenStack Networking notifications, and will take action based on them. You completed the majority of the configuration in the previous steps, however, you need to specify which domain DNSaaS should use for the auto-generation of DNS entries.
1. Modify the DNSaaS configuration for the example domain:
2. Test Compute (nova) record creation:
Here you will follow a normal nova boot procedure. This step can be performed from the OpenStack Dashboard if preferred. Also, any Image Service (glance) image should work.
This step assumes you have already validated that your OpenStack environment works without DNSaaS. You must already be able to boot instances, assign floating IP addresses, and have functional networking.
glance image-list neutron net-list nova boot testserver --flavor m1.tiny --image cirros-0.3.4-x86_64 --key-name yourkey --security-groups default --nic net-id=<Private Net ID>
# glance image-list
# neutron net-list
# nova boot testserver --flavor m1.tiny --image cirros-0.3.4-x86_64 --key-name yourkey --security-groups default --nic net-id=<Private Net ID>
3. Review the Sink log: Make certain your instance has moved into an active status (using nova list; nova console-log testserver). Once up, you should see a create_record entry if it has picked up the notification correctly.
tail /var/log/designate/sink.log
# tail /var/log/designate/sink.log
Check in PDNS:
dig +short @192.168.100.20 testserver.example.com
# dig +short @192.168.100.20 testserver.example.com
If this test doesn’t work as expected, you can also check directly in the database:
mysql
# mysql
use designate_pdns;
show tables;
select * from records;
quit;
3.6. Test OpenStack Networking (neutron) floating IP record creation Copy linkLink copied to clipboard!
Run the command below to test the creation of a floating IP record (replace pubnet1 with a name appropriate for your environment):
FLOATINGIP=$(neutron floatingip-create pubnet1 | grep floating_ip_address | awk '{print $4}')
nova add-floating-ip testserver $FLOATINGIP
DNSRESULT=$(echo $FLOATINGIP |sed 's/\./-/g').example.com
dig +short @192.168.100.20 $DNSRESULT
# FLOATINGIP=$(neutron floatingip-create pubnet1 | grep floating_ip_address | awk '{print $4}')
# nova add-floating-ip testserver $FLOATINGIP
# DNSRESULT=$(echo $FLOATINGIP |sed 's/\./-/g').example.com
# dig +short @192.168.100.20 $DNSRESULT
You should see a create_record event in the log file:
tail /var/log/designate/sink.log
# tail /var/log/designate/sink.log
It is not currently possible to create floating IP addresses by hostname rather than octets. At present, you can instead create a CNAME against this manually. In a future update it is expected that you will be able to create by hostname.
3.7. Cleanup OpenStack Networking and Compute DNS entries Copy linkLink copied to clipboard!
1. Remove the floating IP address created previously:
nova remove-floating-ip testserver $FLOATINGIP
# nova remove-floating-ip testserver $FLOATINGIP
You should see a delete_record event in the log:
tail /var/log/designate/sink.log
# tail /var/log/designate/sink.log
And the record should be removed.
2. Remove the testserver created previously:
designate record-list $DOMAINID nova delete testserver
# designate record-list $DOMAINID
# nova delete testserver
You should see another delete_record event in the log:
tail /var/log/designate/sink.log
# tail /var/log/designate/sink.log
If DNSaaS Sink manages a record it may not be updated manually. There is an option designate --edit-managed record-delete <Domain ID> <Record ID> which was created in Liberty and backported to the Kilo release. However it is not currently available in the generally available release of Red Hat Enterprise Linux OpenStack Platform 7. At present, you will need to manually remove it from your backend DNS and DNSaaS database in the event of any issues.
3.8. Cleanup the PowerDNS configuration Copy linkLink copied to clipboard!
You will not modify the DNSaaS configuration as you will overwrite it when configuring your Bind target.
SERV1ID=$(designate record-list $DOMAINID| grep server1.example.com | awk '{print $2}')
designate record-delete $DOMAINID $SERV1ID
designate domain-delete $DOMAINID
systemctl disable pdns
systemctl stop pdns
# SERV1ID=$(designate record-list $DOMAINID| grep server1.example.com | awk '{print $2}')
# designate record-delete $DOMAINID $SERV1ID
# designate domain-delete $DOMAINID
# systemctl disable pdns
# systemctl stop pdns