I want to do some tests on linux. I want to put a small web server on a machine with IP: 184.108.40.206 (assumption) and when a DNS query is made for a specific URL : kitty.myweb.com I want to return this IP address.
- When I open a browser(firefox or whatever), I input the URL kitty.myweb.com and the browser will do the DNS query
- I want to write a program which does the DNS query for kitty.myweb.com
I know that each computer has a local DNS resolver which caches some entries; a call to a URL will query the local DNS resolver first, and if there is no corresponding entries it will send the query to an external DNS resolver on the LAN or Internet.
What I want to is to add an entry(kitty.myweb.com : 220.127.116.11) to the local DNS resolver, so that for the 2 scenarios above, the DNS response will be 18.104.22.168 without having to make an external query.
Is it possible to do this on linux, and if so, how? Are there perhaps any C code snippets that would do this?