This article goes you through the steps you need to perform to add into DNSmanager the domain names that are already specified in the BIND configuration file.
- A domains zone must be assigned to a user in DNSmanager. Create a new user, enter his Username and DNS name space. Learn more in the article How to add a new user.
-
Open the BIND configuration file:
Debian: /etc/bind/named.conf
CentOS: /etc/named.conf -
Every DNSmanager user is assigned view in the configuration file. view name corresponds to the DNS name space that you specified earlier. All the user's domain zones are included into view. E.g.:
view "hoster.me" { allow-transfer { 127.0.0.1; }; match-destinations { 149.154.66.80; }; transfer-source 149.154.66.80; zone "company.my" { type master; file "/etc/bind/hoster.user/company.my"; }; };
Move the domain zones in the configuration file into view of the newly created user. -
Open DNSmanager database using sqlite:
sqlite3 /usr/local/mgr5/etc/dnsmgr.db
-
Get the user id from the database:
select id from user where name='<username>';
-
Get the user name space id from the database:
select id from namespace where name='<name space>';
-
Get the id that you can use for the newly created domain:
select max(id)+1 from domain;
-
Add a record about the domain into the database:
insert into domain ([id],[name],[namespace_id],[user],[dtype]) values ('<id>','<name>','<namespace_id>','<user>','<dtype>');
View details -
If you need to add a large number of records into the database, you can automate this process:
- Provide all the domain names in the file.
-
Create a file with the script.
#!/bin/bash count=<id> for domain in `cat <file>`; do echo "insert into domain ([id],[name],[namespace_id],[user],[dtype]) values ('$count','$domain','<namespace_id>','<user>','<dtype>');" | sqlite3 /usr/local/mgr5/etc/dnsmgr.db count=$((count+1)) done
View details - Start the script.
-
Restart DNSmanager:
/usr/local/mgr5/sbin/mgrctl -m dnsmgr exit