how to access/ping the host on LAN by hostname instead of ip

Here is my simple network scenario, in which mikrotik is everything(firewall,dhcp,dns etc).

I am able to ping/access the hosts on LAN by their ip but i can’t be able to access them or ping them by using hostname.
can somebody tell me how i can accomplish this task please?

thanks

First you need to make sure the machines on your LAN use your router as their primary DNS.

Then, for anything with a static address:

/ip dns static add address=192.168.1.10 name=server1

For machines that get their address via DHCP you would need to write a script that scans through your DHCP leases and maps client-id to assigned address. Someone posted an example of this not to long ago so a search should turn it up pretty quickly.

I already did this but it didn’t make any difference. i still can’t be able to access the host by its hostname but still can access by ip.

any idea?

thanks

Do the names show up if you list the static DNS entries and the cached entries?

/ip dns static print
/ip dns cache print

If you use nslookup and specify the name server as your router does it resolve the names?

nslookup YOUR_HOSTNAME_HERE YOUR_ROUTER_IP_HERE

Here is the result of all the commands that you mentioned:

Note: (srv is a ubuntu 10.04 LTS server)

Also Wireshark capture, may be it will give some hint!

thanks in advance

I am able to solve this problem and here is what i did.

*I simply install the samba on ubuntu server using (sudo apt-get install samba smbfs), by doing this, i am able to ping ubuntu server from my windows host.

  • To ping my windows host from ubuntu server, i simply install winbind by using (sudo apt-get install winbind) and after that i am able to ping all of my windows clients from ubuntu server.

I hope this will help the other, who faced the same/similar problem.

thanks

I believe if you use a single name such as “srv” it will look for the IP via NETBIOS and will fail. If your server has a fully qualified domain name, such as srv.local and then were to add srv.local in the Mikrotik DNS server, I think you will have better luck as it will then use DNS correctly?

we can integrate the Mikrotik router with Windows 2k8 Active Directory?

what do you mean ‘integrate’? It can’t replace the DNS server within 2k8, no.

Like, I want that my mikrotik act as dhcp server and Win2K8 R2 act as DNS with the role of DC and my mikrotik automatically update DNS record on it (a.ka. A record).

I believe that without some scripting, Dynamic DNS updates from the DHCP server is not possible