- Get MaraDNS
MaraDNS is a free, lightweight and relatively easy-to-configure DNS server for Windows and Linux. Download it from here and unzip it to some folder.
- Configure MaraDNS
Open “secret.txt” and change the value to something else (random characters).
The MaraDNS configuration is in the “mararc” file in the same directory. DNS servers have two sets of functionality. They can function as a “Authoritative name server” or a “Recursive/caching name server”.
Authoritative name servers specify IP addresses for domain names. Recursive name servers store information from authoritative name servers and pass on queries in a recursive manner.
We will be configuring both authoritative and recursive functionality in MaraDNS.
2.1 Authoritative configuration
We will configure the server to provide authoritative names of the LAN domain names. Pick any domain, I chose “local.com” (note though that you will not be able to access the actual “local.com” website if you pick an existing domain name).
Add configuration lines to “mararc” like these:
csv2 = {}
csv2["local.com."] = "db.lan.txt"
Where local.com is the domain name you picked, and db.lan.txt is the name of the second configuration file which we will be creating next (change it if you want to name the second configuration file).
Create a new file named “db.lan.txt” in the same directory as MaraDNS.
For each of the computers you want to resolve to a name, add a line to “db.lan.txt”. For example, for two machines, one “dev.local.com” and the other “blog.local.com”, add the following lines:
dev.% 192.168.1.4 ~
blog.% 192.168.1.6 ~
Done!
2.2 Recursive configuration
We will setup MaraDNS to ask your default name servers for all other domains so that you can resolve all other domain names to their correct IP addresses.
Find out your ISP’s DNS server addresses. These are likely to be listed either on the Router status page, or by checking the details on your network adapter.
Now add your ISP’s DNS servers as upstream servers in “mararc”:
upstream_servers = {}
upstream_servers["."] = "xxx.xxx.xxx.xxx, yyy.yyy.yyy.yyy"
Where xxx.xxx.xxx.xxx and yyy.yyy.yyy.yyy are your ISP’s DNS servers.
Done!
- Run MaraDNS and test it using askmara.exe
Double-click “runmara.bat” , and leave the server running.
Open a command prompt, navigate to the MaraDNS directory and try running:
askmara.exe Agoogle.com.
and
askmara.exe Ablog.local.com.
You should get replies like this:
# Querying the server with the IP 127.0.0.1
# Question: Agoogle.com.
google.com. +300 a 74.125.67.100
google.com. +300 a 74.125.53.100
google.com. +300 a 74.125.45.100
# NS replies:
# AR replies:
and:
# Querying the server with the IP 127.0.0.1
# Question: Ablog.local.com.
blog.local.com. +86400 a 192.168.1.6
# NS replies:
#local.com. +86400 ns synth-ip-7f000001.local.com.
# AR replies:
#synth-ip-7f000001.local.com. +86400 a 127.0.0.1
If you get problems with the first query, you messed up the recursive DNS settings (are your ISP DNS server addresses correct?), and if you get an error with the second query, you messed up the authoritative settings.
- Change MaraDNS to reply to queries from your LAN
Shutdown the MaraDNS window, and change the first two lines of “mararc” to something like:
ipv4_bind_addresses = "192.168.1.2
recursive_acl = "192.168.1.0/24"
Where 192.168.1.2 is the IP address of the computer on which the server will be running and the “192.168.1″ part of recursive_acl is the same as on your network (might be 192.168.0.0/24).
Start MaraDNS again, and leave it running.
- Setup your router to hand out your new DNS server
Open your router’s web interface and find the DHCP server settings. There should be an option to set up a DNS server. Write the IP address of the computer on which the DNS server will be running.
For each of your computers, disconnect the network (e.g. by disabling and enabling it in Windows, or by using “ifconfig eth0 down”/”ifconfig eth0 up” on Linux).
That’s it, you should now be able to refer to your LAN computers by their domain names.
Source