Answer: Add af.mil to /var/qmail/control/locals, and tell qmail to read locals. Add af.mil to /var/qmail/control/rcpthosts.
Make sure that there is an appropriate MX record in DNS for af.mil. Here's how to create the MX record using tinydns:
cd /etc/tinydns/root ./add-mx af.mil 220.127.116.11 makeIf you're using BIND, put
af.mil. IN MX 0 a.mx.af.mil. a.mx.af.mil. IN A 18.104.22.168into the appropriate zone file. signal BIND to reload, and check for errors in the appropriate system log. Don't forget the trailing dots.
Answer: Add nowhere.mil:bob to /var/qmail/control/virtualdomains, and tell qmail to read virtualdomains. Add nowhere.mil to /var/qmail/control/rcpthosts.
Now mail for email@example.com will be delivered locally to bob-whatever. Bob can set up ~bob/.qmail-default to catch all the possible addresses, ~bob/.qmail-info to catch firstname.lastname@example.org, etc.
Answer: Add two lines to /var/qmail/control/virtualdomains:
nowhere.mil:bob-nowhere everywhere.mil:bob-everywhereTell qmail to read virtualdomains. Add both nowhere.mil and everywhere.mil to /var/qmail/control/rcpthosts.
Answer: First, choose the domain name where your users will receive mail. This is normally the shortest domain name you control. If you are in charge of *.movie.edu, you can use addresses like email@example.com.
Second, choose the machine that will publish IP address information for movie.edu. Install a DNS server on that machine. Configure the server to handle movie.edu and 25.18.in-addr.arpa. For example, if you are using the tinydns server from the djbdns package:
cd /etc/tinydns/root ./add-ns movie.edu 22.214.171.124 ./add-ns 25.18.in-addr.arpa 126.96.36.199 makeHere 188.8.131.52 is the IP address of the machine. If you're using BIND instead of tinydns, you will have to create new movie.edu and 25.18.in-addr.arpa zone files, each with SOA and NS records.
Third, for each machine on your network, create a host name in DNS:
cd /etc/tinydns/root ./add-host bobshost.movie.edu 184.108.40.206 make(You can do a series of add commands and then a final make.) If you're using BIND instead of tinydns, you'll have to create an A record for each machine in the movie.edu zone file, and a PTR record for each machine in the 25.18.in-addr.arpa zone file.
Fourth, choose a mail exchanger, i.e., a machine that will know what to do with mail for different users at movie.edu. Set up an MX record in DNS to deliver movie.edu messages to the mail exchanger:
cd /etc/tinydns/root ./add-mx movie.edu 220.127.116.11 make
Fifth, install qmail on the mail exchanger. Put movie.edu into /var/qmail/control/rcpthosts so that the machine will accept messages for users at movie.edu. Put
Sixth, make a list of machines where mail should end up, and create ~alias/.qmail-movie-user files on the mail exchanger forwarding messages to those machines. For example, if mail for Bob should end up on Bob's workstation, put
firstname.lastname@example.org ~alias/.qmail-movie-bob. Do the same for other users. If you have many users, you should set up these aliases with fastforward instead.
Seventh, install qmail on each machine where mail should end up. On bobshost.movie.edu, for example, qmail will automatically configure itself to accept messages for email@example.com and deliver them to Bob's mailbox on bobshost.
Eighth, on all your machines, put movie.edu into /var/qmail/control/defaulthost, so that Bob's outgoing mail uses an address of firstname.lastname@example.org.
Scalability notes: You can replicate DNS service across several machines to spread the incoming DNS load. You can replicate mail aliases across several mail exchangers to spread the incoming mail load. You can use tinydns to provide addresses for a huge number of mail exchangers, and optionally to try to select an address close to the client.