0

Hey folks from serverfault, new to this network site.

I have a question regarding the configuration of a new server. Ubuntu 16.04 and Apache 2.4 will be running on the server.

We would like to allow external access to the server, which could be done with wildcard subdomains, so that http://testsite.dev.example.com would route to /var/www/testsite. I did that in another environment already with VirtualHost directives and I think I do know how it works.

But: How can I avoid that requesting http://testsite.dev.example.com from the internal network will be handled over the internet? I would like to avoid a speed loss when developing.

Can dnsmasq be used to recognize the *.dev.example.com pattern and handle the request internally?

Thanks in advance!

Mary
  • 103
  • 3
  • 2
    read up on the feature named split-dns. https://en.wikipedia.org/wiki/Split-horizon_DNS Additionally i doubt you own "ourdomain.com" so please use the proper domains for such a case like example.com – Dennis Nolte Oct 29 '18 at 09:51

1 Answers1

1

Welcome!

You want to use the -A/address option in the dnsmasq config:

address=/<domain>/[domain/][<ipaddr>]

or in your case

address=/dev.ourdomain.com/<ipaddr of webserver>

You could also use -A address=/domain/ip, if you rather want command line options.

Fredrik
  • 528
  • 2
  • 10
  • D’oh! Thanks, this is simple. `dnsmasq` will know that `` equals its own IP and now outgoing connection will happen? – Mary Oct 29 '18 at 09:45
  • Exactly. You could also add annoying hosts, for example /doubleclick,net/127.0.0.1 to not even resolv banners/ads to their real IP. – Fredrik Oct 29 '18 at 10:06