Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have many rules in our internal DNS server and I'd like to use them in my local hosts file. Is there any utility to do this kind of conversion?

Update: The DNS server is Windows Server and the use case is that we have many zones I need to use withouth my DNS being pointed to that server so I need them converted to my local hosts file.

share|improve this question
    
Why do you want to use a host file over DNS? –  Zypher Jun 1 '10 at 7:06
2  
You'll need to provide some examples before you can get a useful answer. Right now the answer is "maybe, but you probably shouldn't". –  ThatGraemeGuy Jun 1 '10 at 7:07
    
Sorry guys, I've now provided some more information. –  Borek Jun 4 '10 at 10:30

2 Answers 2

That depends on what you mean by "rules". Things like TTL settings and MX records aren't going to have an equivalent in the hosts file. Most people want to go the other way around (convert a hosts file into a zone file) and there are a number of utilities to do that. Converting from a zone file back to a hosts file isn't all that difficult, but I wasn't able to find any packaged tools for that. Someone has a blog post with a sed line with a regular expression to pull out A records if you're able to use that (redirect the output to a file or copy and paste the output into the hosts file):

sed "s/\(.*\) *IN A *\(.*\)/\2\t\1/" lan.zone
share|improve this answer
    
Sorry I've now updated the question, it's a Windows Server. –  Borek Jun 4 '10 at 10:31
    
There are several places on the web where you can download sed for Windows. –  Justin Scott Jun 4 '10 at 17:42

Even if there is a sensible reason for the request you really have to give us something to work with, such as which DNS server? What OS?

Given the complete lack of information the only thing I can suggest to get you started is to use dig to dump the information into a text file, from where you can use whatever method you prefer to read the required details.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.