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.
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):
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.
No real tool for exporting out of one and into another.
If you editing the host file a lot you can always use a tool like Host File Editor.
https://github.com/scottlerch/HostsFileEditor
Personally I prefer to edit the host file in Notepad or if I am feeling fancy Notepad++, but for speed a tool like the above will let you copy and paste entries (I guessing what you referred to as rules i am guessing.)