dns script

hi guys
anyone can help me with a script copy all the sites from the dns cache and adds it to dns static ?
thank you

Something like

:foreach a in=[/ip dns cache find static=no] do={
  /ip dns static add address=[/ip dns cache get $a address] name=[/ip dns cache get $a name]
}

should add all entries from the cache that not already are static to the static list…

Not really tested, the usual warnings apply :wink:

Best regards,
Christian Meis

hi christian ,
thank you for the script
it really works

regards

Hi cmit

1- Could you ensure the static DNS will faster than the dynamic?

2- Where the static DNS address save in MT?

Dose it save in memory?

to 2 - they should be saved on your flash/harddisk (so they will be there after a reboot)

to 1 - I’m not sure I understood what you meant. If there IS a static entry, the DNS service will ONLY ever answer with that static entry. Or what do you mean by “faster”?

Best regards,
Christian Meis

cmit,

If I could understand it and would like to learn from the experts.

Why do you need to put the dns cache into static list ? Is there a good reason for this ?

Does this mean the static list is lookup first then only the cache

Thanks,

Actually I don’t know why :wink:
I just produced the script he asked for …

Best regards,
Christian Meis

Actually I don’t know why :wink:
I just produced the script he asked for …

Best regards,
Christian Meis

cmit

Thank you for your answer.

What I meaning is that after I make the dynamic DNS cache ip to static ip in my MT, it would make my NAT speed faster than befor?

HTTP require—> MT —>DNS resolve the web site to IP---->MT NAT the require to target IP.

Such as http://www.abc.com =1.2.3.4
when I first access it, DNS will tracert it from internet and get the real ip of web site
But I can make it as the static IP in my MT

So my question is : after I made it, would it faster than dynamic DNS tracert?

Thank you for your answer.

What I meaning is that after I make the dynamic DNS cache ip to static ip in my MT, it would make my NAT speed faster than befor?

HTTP require—> MT —>DNS resolve the web site to IP---->MT NAT the require to target IP.

Such as http://www.abc.com =1.2.3.4
when I first access it, DNS will tracert it from internet and get the real ip of web site
But I can make it as the static IP in my MT

So my question is : after I made it, would it faster than dynamic DNS tracert?

First, DNS requests aren’t answered by doing a “dns tracert”, but by DNS queries. This would only have a SMALL benefit after rebooting, when the dynamic dns cache is empty.
When the dns name is resolved once, it’s put into the static cache. From then on (until a reboot - the dynamic cache is held in RAM only - or a manual cache clear) resolving speed will be the same for static and/or dynamic dns entries.

Best regards,
Christian Meis

how to add scripts to wiki?

Say pretty please. And hope the maintainer of the Wiki notice it.