How to catch and redirect queries for non-existing domains?

I have changed nameserver records for some of my domains, but have no plans for creating virtual servers for them yet. Can I configure BIND via Virtualmin (or for that matter without it directly on command line) to redirect queries for such not yet created domains redirect to temporary warning page as I can do with OpenDNS?

I have set on Forwarding and Transfers (https://my_ip:10000/bind8/conf_forwarding.cgi) page an ip of the warning page, but unfortunately nothing happened. If I type the domains address on browser, it gives Oops! Google Chrome could not find mysite.tld. And its nameservers have already propagated and pointing to my server.

“Forwarding and transfers” in BIND has nothing to do with “forwarding queries to some web page”. It means: “forward DNS queries for zones not under this server’s control to another DNS server”, and “allow incoming zone transfer requests”. :slight_smile:

If the nameserver records in question resolve to the IP of your VMin host, the easiest thing to do would be set up Apache’s “default catch-all virtual host for unknown hostnames” properly.

You might create a dummy VServer, without BIND feature and Email and that stuff, and set Server Configuration -> Website Options : Default website for IP address? to Yes. Internally, this will make the VServer in question be the first to be parsed by Apache, and set its listen IP to the host’s external one. Those are the requirements for an Apache vhost to be the default one.

Locutus, could you please explain the last piece of your instructions about “setting its listen IP to the host’s external one”? At what page I set it at?

I use only one IP for all of my websites and I have set default website for IP address per your instructions. However, all other domains whose nameservers are pointed to my server still do not resolve to default page. Chrome still gives: Oops! Google Chrome could not find anotherofmysites.tld

dig anotherofmysites.tld gives:

;; global options: printcmd
;; connection timed out; no servers could be reached

I wonder how OpenID catches queries for non-yet-created virtual servers.

Sure: Go to Webmin -> Servers -> Apache Webserver -> {Virtual Server in question} and scroll down to Virtual Server Details. There you enter the external IP address and click the radiobutton next to it, instead of “Default” or “Any”.

Reason is: I found that virtual servers with explicit IP address can take precedence over those with “any address” setting.

Oh, about the DNS resolution problem: Can you name one of the domains in question please? “No servers could be reached” rather sounds like a local name resolution problem on your test machine. What does dig siteinquestion.tld NS output? Are you sure the domains in question are already registered with the NIC *1 in question?

*1 NIC here means “network information center”, as in the domain registry, not “network interface card”. :wink:

Locutus,

Surely I am talking only registered domain names.

dig siteinquestion.tld from my laptop gives:

; <<>> DiG 9.6.0-APPLE-P2 <<>> siteinquestion.tld
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 34708
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;siteinquestion.tld. IN A

;; Query time: 197 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Oct 30 16:04:21 2010
;; MSG SIZE rcvd: 28

However from my server gives:

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> siteinquestion.tld
;; global options: printcmd
;; connection timed out; no servers could be reached

I would love you to ping it by yourself, but really do not want to post my domain name in open space. Could we communicate via e-mail, skype?

Learning to use Virtualmin better with you. Amazing how it is flexible.

I went to that page and found out, that I already have Default Server listening to

Type Address Port Server Name Document Root URL
Default Server Any Any host.mysite0.tld:80 /var/www/html Open…
Virtual Server host.mysite0.tld 80 xxx.xxx.xxx.xxx /home/mysite0/public_html
Virtual Server xxx.xxx.xxx.xxx 80 mysite1.net /home/mysite1/public_html Open…
Virtual Server xxx.xxx.xxx.xxx 80 mysite2.com /home/mysite2/public_html Open…

Virtual Server Any 443 host.mysite.tld:80 /var/www/html

I wonder is my server configured incorrectly, because on this page 3 instances seem strange to me:

  1. For default server under ‘Port’ column I have ‘Any’, but then under ‘Server Name’ my hostname has been bound to port 80 after semicolon. So 80 here is preceding Any, right? Should I delete this 80 here?

  2. For default server I have ‘/var/www/htm’ under Document Root, but all of my sites are created in /home directory. Should I change document root for default server?

  3. Immediately after default server my hostname listed and in its line host.mysite0.tld is listed under Address and my IP xxx.xxx.xxx.xxx under Server Name. Interchange?

Pay close attention to the command I asked you to execute: dig siteinquestion.tld NS :slight_smile:

The NS is important. It will query the configured nameserver to tell you the responsible nameservers for the domain.

Are you using any other instant messenger? ICQ, Trillian Astra, MSN, Yahoo, Jabber?

I can’t really judge if your server is configured incorrectly there, since I don’t know your site setup, and all those "x"es also make it a little hard to understand that structure. IP addresses are not so much of a secret usually, nor are domain names. :slight_smile:

Note: “Default server” stands for the directives in the Apache config which appear outside of any virtual server definition. If/since name-based virtual hosts are used, the “default server” will not configure any website, but just give generic directives.

  1. As far as I understand it, entries with explicit ports override those with generic ones, but only if there is a “conflict”. If every virtual server has a unique ServerName, it should not matter. In addition, the first configured one will be used for unknown host names.

  2. See “note” above. Directories given in the default server section should be ignored when name-based virtual hosts are in use. This might be a problem with your config.

  3. Can’t tell, sorry.

Useful info about how Apache handles name-based virtual hosts can be found here: http://httpd.apache.org/docs/2.2/en/vhosts/name-based.html

And here’s info about how Apache handles selection of which vhost to use: http://httpd.apache.org/docs/2.2/en/vhosts/details.html

Pardon. From home it gives: siteinquestion.tld NS

; <> DiG 9.6.0-APPLE-P2 <> siteinquestion.tld NS ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5135 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;siteinquestion.tld. IN NS

;; Query time: 280 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Oct 30 18:03:36 2010
;; MSG SIZE rcvd: 28

From the server it mostly gives:

dig siteinquestion.tld NS

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> asiopa.com NS
;; global options: printcmd
;; connection timed out; no servers could be reached

I have run the command several times and occasionally it gives:

dig siteinquestion.tld NS

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> siteinquestion.tld NS
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 56569
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;siteinquestion.tld. IN NS

;; Query time: 2997 msec
;; SERVER: xxx.xxx.xxx.187#53(xxx.xxx.xxx.187)
;; WHEN: Sat Oct 30 18:13:54 2010
;; MSG SIZE rcvd: 28

xxx.xxx.xxx.186 is my main IP and ns1, xxx.xxx.xxx.187 is my ns2.

I use icq: 300793

Thanks for helping!

“SERVFAIL” when querying the NS record for your “siteinquestion” is not a good sign. Sounds like some rather considerable misconfiguration somewhere. I’ll contact you via ICQ. (Whoa, a 6-digit ICQ number? You must be a real old-schooler! :wink: )