Community discussions

MikroTik App
 
taapo
just joined
Topic Author
Posts: 1
Joined: Sat Jul 31, 2021 8:01 pm

Term/technique for local network lookup of CNAME/A record pointing to local network?

Sat Jul 31, 2021 8:05 pm

I don't know the exact term for it, but I'll explain what I mean:

  • I have a home network and a work network
  • On both networks, I have an IP address 192.168.1.40 that runs a webserver
  • I have set up portforwarding on both routers so that port 80 (192.168.1.40) is visible to the outside world - tested and working
  • I have pointed a CNAME to my publicly available domainname (in my case a Fritz router domain name + a Mikrotik cloud domain name) for home.domain.name and work.domain.name - tested and
  • working from the outside world

Both work fine if I try to reach them from the outside world. So that's no problem. But ...

  • When I try to connect to my home.domain.name from my internal HOME network (Fritz router) it works perfectly
  • When I try to connect to my work.domain.name from my internal WORK network (Mikrotik router) it DOES NOT work

I'm trying to get the name of the "term/technique" that's being used to connect to my own network with a CNAME/A assigned domain name, so I can try and find out why it's working with my Fritz router and not with my Mikrotik router.
 
andriys
Forum Guru
Forum Guru
Posts: 1526
Joined: Thu Nov 24, 2011 1:59 pm
Location: Kharkiv, Ukraine

Re: Term/technique for local network lookup of CNAME/A record pointing to local network?

Sat Jul 31, 2021 11:23 pm

I can think of at least two approaches here.

The first approach is a so called split-horizon DNS. I don't think you can do this on a Mikrotik router, an external DNS server is required.

The second approach is "hairpin NAT". Search the forum, there are plenty of example here.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18958
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Term/technique for local network lookup of CNAME/A record pointing to local network?

Sun Aug 01, 2021 12:39 am

Yes, hairpin nat, one fix is to move the server to a different subnet, problem solved.
as noted lots of examples if you 'search' hairpin nat.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Term/technique for local network lookup of CNAME/A record pointing to local network?

Sun Aug 01, 2021 3:00 am

If on your office the mikrotik routerboard act as dns, simply put on /ip dns static the work.domain.name resolved as internal server IP.
Done.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18958
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Term/technique for local network lookup of CNAME/A record pointing to local network?

Sun Aug 01, 2021 3:11 am

So this is the fourth method of approaching Hairpin NAT then,,,,,,,,,,,as I read a long time ago......but had forgotten?
So what does this do?
Why is the router going to use the static DNS, what happens if you have other servers on the list of DNS servers,
What if peer DNS is allowed?

dnsworkaround.JPG
You do not have the required permissions to view the files attached to this post.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Term/technique for local network lookup of CNAME/A record pointing to local network?

Sun Aug 01, 2021 3:31 am

On image the IP address of local server go to.... address field and the work.domain.name go on... name.

or skip name and add a regexp like (^|www\.)work\.domain\.name$

Static DNS have precedence above any settings on DNS.

If the workstation on office have main server used as main DNS, simply put here the rule.

Who is online

Users browsing this forum: ameliask, Bing [Bot], kvitek79, mikronoob89, normis, Vojta and 98 guests