How to set hostname for a specific static IP

I want to use hostnames to access computers on my network instead of IP.
Alternative to this is using hostfiles on the Windows machines, but there are lots of machines on the network so hostfile is not an option.

What I want has been exactly answered on Stack Exchange for Tomato firmware (http://unix.stackexchange.com/a/16901/182487)
I want help on how to achieve the same thing on the mikrotik RouterOS firmware.

I need help on the section of the RouterOS interface where I can set a specific hostname for a specific mac address of a machine.

First, determine what domain suffix your computers are using on the lan
(e.g. example.com)

Whatever that is, you can create host names in the Mikrotik’s DNS proxy:
/ip dns static add address=192.168.10.14 name=myhost.example.com

Then you need to either assign the Mikrotik as the LAN’s DNS server address, or else use a dstnat rule to intercept (redirect) outbound DNS queries to the Mikrotik itself:
/ip firewall nat add chain=dstnat protocol=tcp dst-port=53 action=redirect
/ip firewall nat add chain=dstnat protocol=udp dst-port=53 action=redirect

And make sure sure that your DNS service allows remote requests:
/ip dns set allow-remote-requests=yes

AND MOST IMPORTANTLY:
Make sure that your firewall filter’s input chain will drop incoming requests to port 53 from the Internet

You can test your firewall rules by going to http://openresolver.com/ and entering your router’s public IP address.

/ip firewall nat add chain=dstnat protocol=tcp dst-port=53 action=redirect
/ip firewall nat add chain=dstnat protocol=udp dst-port=53 action=redirect

This rule is not resolving dns for bypassed users.

ZeroByte please how do I “determine what domain suffix [my] computers are using on the LAN”? (or do you mean I should rather arbitrarily “choose” the domain suffix?)

Also, by “[making] sure that [my] DNS service allows remote requests”, I don’t quite get the interpretation of that. Does that mean that computers on my LAN will be able to make remote requests or my router will be able to accept remote requests?
Because all I want is to locally resolve names to IP for computers on the LAN.

Thanks!

You specify this in the DHCP server’s options for the local network.

You can simply determine it on a Windows client by opening a command prompt and issuing the “ipconfig” command. It reveals the connection-specific DNS suffix.

In this case, remote = “from outside the router” - in other words, if you don’t enable this, the router will not respond to DNS queries directed at it - it only uses the DNS cache for its own local processes. When you enable remote - this means that the router now listens for requests and responds to them. This is not limited to any particular interface, or IP range. ANY request reaching the router’s DNS proxy process will be serviced. It is now up to your firewall input rules to place limitations on this service.

Make sure the DNS service has “allow remote requests” set to yes, and check for any firewall filter rules which could be blocking requests from the bypassed users.

Thanks Zerobyte. Input rule was blocking external dns request for bypassed user. for me it’s solved now.