Community discussions

 
bakiri123
just joined
Topic Author
Posts: 4
Joined: Tue Jul 24, 2012 2:37 pm

nslookup on Mikrotik

Thu Aug 23, 2012 12:26 pm

Is there a Mikrotik command equivalent to the Windows nslookup command?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24048
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: nslookup on Mikrotik

Thu Aug 23, 2012 12:30 pm

to find out the IP address of some domain, just ping it. or you can use the ":resolve" command, if you need it in scripts:

ros code

[admin@MikroTik] > put [:resolve mt.lv]
159.148.147.196
No answer to your question? How to write posts
 
bakiri123
just joined
Topic Author
Posts: 4
Joined: Tue Jul 24, 2012 2:37 pm

Re: nslookup on Mikrotik

Thu Aug 23, 2012 1:38 pm

Thanks. The command also works fine without the colon, i.e. put [resolve mt.lv]
 
User avatar
marria
newbie
Posts: 31
Joined: Sat Jun 04, 2011 8:41 pm

Re: nslookup on Mikrotik

Thu Jul 23, 2015 5:09 am

to find out the IP address of some domain, just ping it. or you can use the ":resolve" command, if you need it in scripts:

ros code

[admin@MikroTik] > put [:resolve mt.lv]
159.148.147.196
This is true, but does not tell which dns server is resolving, which can be helpful...
 
olkba
just joined
Posts: 3
Joined: Wed Oct 21, 2015 12:38 pm

Re: nslookup on Mikrotik

Wed Oct 21, 2015 12:41 pm

you can specify target dns server to query easily:
put [resolve google.com server 8.8.8.8]
 
yottabit
Member Candidate
Member Candidate
Posts: 160
Joined: Thu Feb 21, 2013 5:56 am

Re: nslookup on Mikrotik

Wed Feb 24, 2016 2:14 am

I have a static IP mapping for a host to resolve to an internal IP. However, in my script I want to resolve the public IP by using an external DNS server. Seems simple enough with the ":resolve <host> [server=1.2.3.4]" script command, but it's not working for me. It seems the :resolve command is always using local router DNS and ignoring the server=1.2.3.4 argument. Here's the example:
[admin@rb1.magrathea] > put [:resolve host.fqdn server=8.8.4.4]
172.16.42.25
But it's wrong, for example:
[root@nas1] ~# nslookup host.fqdn 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   host.fqdn
Address: 216.58.218.206
I have no redirect rules on the router, as evidenced by the above host using nslookup on the LAN through that same router.

Ideas?

Edit: version is:
# feb/23/2016 18:17:54 by RouterOS 6.35rc12
 
yottabit
Member Candidate
Member Candidate
Posts: 160
Joined: Thu Feb 21, 2013 5:56 am

Re: nslookup on Mikrotik

Sat Feb 27, 2016 5:58 pm

Friendly bump to see if anyone has tips for forcing the :resolve command to use an external server?
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1229
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: nslookup on Mikrotik

Sun May 07, 2017 1:16 pm

Old thread.

Just confirm that this works fine for me on 6.39
[user@GV-FV155] > put [resolve remote.my-server.com]
10.10.10.32
[user@GV-FV155] > put [resolve remote.my-serve.com server 8.8.8.8]
92.xxx.xxx.134
[user@GV-FV155] >
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
stardm
just joined
Posts: 1
Joined: Wed Nov 01, 2017 7:58 pm

Re: nslookup on Mikrotik

Wed Nov 01, 2017 9:01 pm

Hello, all
you can specify target dns server to query easily:
put [resolve google.com server 8.8.8.8]
NO! How can I discover DNServer? Which server return address? (Yeah, I have a very long list DNS and I am use every server.)

(FREEBSD 9.3 nonroot command line)
$ nslookup g.cn
Server: 8.8.8.8 // WHO tell about adress?
Address: 8.8.8.8#53 // allright, about g.cn google DNS well known. Und das ist fantastisch, I can see NS port number! Mikrotik can it?
Non-authoritative answer:
Name: g.cn
Address: 173.194.73.94

Or is it difficult to implement and understand?
Danke schoen.
 
arashams
newbie
Posts: 33
Joined: Thu Jul 04, 2013 11:20 pm

Re: nslookup on Mikrotik

Mon Jan 01, 2018 10:04 am

when you use nslookup it will give you the DNS name of site (and also resolver IP and name)
what is the nslookup like command in mikrotik
Windows example:
nslookup 8.8.8.8
Server:  *******
Address:  10.5.50.177

Name:    google-public-dns-a.google.com
Address:  8.8.8.8
Linux example
nslookup microsoft.com
...and you would receive a response like this:
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:    microsoft.com
Address: 134.170.185.46
Name:    microsoft.com
Address: 134.170.188.221
Last edited by arashams on Mon Jan 01, 2018 12:43 pm, edited 1 time in total.
 
User avatar
nichky
Long time Member
Long time Member
Posts: 516
Joined: Tue Jun 23, 2015 2:35 pm

Re: nslookup on Mikrotik

Mon Jan 01, 2018 10:30 am

nice one, i thought MT didn't support that one
Nikola Shuminoski
Network Engineer
E-Mail: nikola.suminoski@outlook.com
MikroTik Consultan
MTCRE l MTCWE

!) Safe Mode is your friend;

Who is online

Users browsing this forum: No registered users and 26 guests