Screwed my DNS UP

Mecca

New member
Joined
Sep 7, 2011
Messages
8
Hi everyone,
I have multiple servers and logged into the wrong one by accident, I deleted bind9 ( apt-get -purge remove bind9 ) and then reinstalled it. Then i realized which machine I was on. So anyway the bind db files still seem to be there, but all the sites on the server are unreachable. what can i do as id say directadmin has its own bind setup ?????
 
Hello,

If your named.conf was lost, but .db files are still there, then you'd only need to re-fill the new named.conf.

We can do this from the data in /etc/virtual/domains.

1) Make a backup of your named.conf:
Code:
cd /etc/bind
cp named.conf named.conf.backup
2) Dump in all zone lines:
Code:
for i in `cat /etc/virtual/domains`; do { echo "zone \"$i\" { type master; file \"/etc/bind/$i.db\"; };" >> /etc/bind/named.conf }; done;
Check the file to ensure there are not any duplicates.

3) Restart named and see what happens:
Code:
killall -9 named
/etc/init.d/named start
Check /var/log/syslog for clues if there are issues.

John
 
Thanks :)

Thanks for that mate, but since i know little about bash scripting and nothing about bind, I got an error when I ran this part

PHP:
for i in `cat /etc/virtual/domains`; do { echo "zone \"$i\" { type master; file \"/etc/bind/$i.db\"; };" >> /etc/bind/named.conf }; done;

-bash: syntax error near unexpected token `done'


i looked but am unsure of the fix, but I really appreciate your help
 
Ah, sorry typo. Missing semi-colon.
PHP:
for i in `cat /etc/virtual/domains`; do { echo "zone \"$i\" { type master; file \"/etc/bind/$i.db\"; };" >> /etc/bind/named.conf; }; done;
 
Thankyou

I can not thank you enough :D:D:D:D
Worked like a charm !!!
and on that note im off to learn about bash scripting and bind,lol
Thanks again :)
 
Back
Top