Community discussions

MikroTik App
 
kalzcosta
just joined
Topic Author
Posts: 5
Joined: Wed Nov 14, 2012 3:54 am

ip reverse dns lookup

Sun Jun 23, 2013 5:50 pm

Hey friends,


Is it possible to configure a reverse dns lookup (dns server) on mikrotik v6.0 ?
 
letabawireless
Frequent Visitor
Frequent Visitor
Posts: 63
Joined: Thu Jul 26, 2012 5:11 pm

Re: ip reverse dns lookup

Tue Jun 25, 2013 5:38 pm

According to my knowledge, no. You would need to have a proper DNS Server for those type of records. Anyway, the reverse DNS lookup is normally done by the owner of the IP, and that normally is your ISP, not you.
 
pwuk
Frequent Visitor
Frequent Visitor
Posts: 51
Joined: Wed Aug 01, 2012 8:51 pm

Re: ip reverse dns lookup

Sat Dec 21, 2013 8:49 am

Sure

(Private network on 192.168.81.254/24, local pc on .100, usual masquerading)

Set up your router like this
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static
add address=192.168.81.100 name=mypc.me.com
add address=192.168.81.254 name=myrouter.me.com

Then run this on your PC
$ host 192.168.81.100 192.168.81.254
100.81.168.192.in-addr.arpa domain name pointer mypc.me.com

(On windows I believe it's "nslookup 192.168.81.100 192.168.81.254" -- basically ask to resolve 192.168.81.100 using server 81.254)
 
User avatar
SiB
Forum Guru
Forum Guru
Posts: 1891
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: ip reverse dns lookup

Fri Dec 14, 2018 8:31 pm

Is it possible to configure a reverse dns lookup (dns server) on mikrotik v6.0 ?
Still answer is NO, the
:resolve
not support query with types of records like "type=ptr".

WorkARound1 => Tracert to file, read last line and grab second parameter
execute {tool traceroute count=1 use-dns=yes 8.8.8.8} file=tracert.txt
put [file get tracert.txt contents ]
...
6 google-public-dns-a.google.com     0%    1   0.6ms     0.6     0.6     0.6

WorkARound2 => Use HTTP API and grab second parameter
put ([tool fetch url=("https://api.hackertarget.com/reversedns/\?q=8.8.4.4") output=user as-value ] -> "data") 
8.8.4.4 google-public-dns-b.google.com

WorkARound3 => Geo IP from HTTP API (FREE, registration needed) and grab data from JSON format
local key "at_*********************";
local ip "8.8.8.8";
put ([tool fetch url=("https://geo.ipify.org/api/v1\?apiKey=".$key."&ipAddress=".$ip) output=user as-value ] -> "data")
{"ip":"8.8.8.8","location":{"country":"US","region":"California","city":"Mountain View","lat":37.40599,"lng":-122.078514,"postalCode":"94043","timezone":"-08:00"}}
Remember to use "\?" if your URL have got a "?" inside.
Yes,Yes, I know that "sed" & "awk" & "JSONparser" will be perfect :) and the ROSv7 will have all solutions included, new kernel, etc. ...