I'm in the middle of migrating and configuring a web server with two domains (with one more in the future), and no sub-domains so far, but using a single IP address (for now). This type of configuration should be able to accommodate many corporate email accounts created under one domain, and just a few associated under the other one (an e-store). I have doubts about how to set up this on an old Debian Squeeze 6 (Apache 2.2.16, BIND 9.7.3, Exim 4.72, Dovecot 1.2.15).

I've took some pointers from these sites:

But I still can't find a good resource for the BIND configuration with many domains using only one IP. So, I want to be sure everything is in place before shutdown one server and start using the newly configured one, so any advice about multiple domains and multiple emails with one IP address, on the same server, would be appreciated.


This is very common. BIND can easily service multiple domains. Just create a zone file for each domain and then add each domain to your named.conf file like this:

zone "domain1.com" {
    type master;
    file "dynamic/domain1.zone";

zone "domain2.com" {
    type master;
    file "dynamic/domain2.zone";

There may be other options you may need in the zone {} block. BIND does not care that you are using the same IP in more than one domain or zone.

  • Yes, I know that's how I did it but, what about the reverse zones? I've read that those are irrelevant except in case of the Mail Exchanger. – abiyi Sep 25 '15 at 0:22
  • most MTA's don't care about the reverse lookup, just that there is one (and that it don't contain something like "dsl" or "dynamic"). You can also use one generic name for multiple names, there's no rule that the MX for a domain needs to have a name that's in that domain; e.g. if you use Google to host your mail the MX is a google name and that works perfectly. The MX for microsoft.com is something.outlook.com. – wurtel Sep 25 '15 at 6:51
  • @wurtel so, there's no need for a reverse zone for every single zone? do I need just one in any case? As I said, I only need two domains (which I have right now) but there's a third one on its way. I'm not sure about that one, but the first two goes with a lot of emails addresses associated. If I don't a reverse zone for those MX records, it's perfectly fine for me. – abiyi Sep 25 '15 at 13:06
  • There must be a reverse lookup for your mail server's IP address, and the forward lookup of that name must match the IP address (so that you don't fill in a reverse that points to "apple.com" for example). However, apart from that there is no need for the name to have anything to do with the domain name used for the mail, so you can use one IP address for many mail domains. – wurtel Sep 25 '15 at 13:51
  • Well, finally I got to the point of reloading bind, and this is what I get: # /etc/init.d/bind9 reload Reloading domain name service...: bind9rndc: connection to remote host closed This may indicate that * the remote server is using an older version of the command protocol, * this host is not authorized to connect, * the clocks are not synchronized, or * the key is invalid. failed! – abiyi Sep 26 '15 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.