How to Set Up a Mail Host
A mail host resolves email addresses and reroutes mail within your domain. A good candidate for a mail host is a system that connects your network to the outside world or to a parent domain. The following procedure shows you how to set up a mail host.
Become superuser on the mail host system or assume an equivalent role.
For information about roles, refer to "Using Privileged Applications" in System Administration Guide: Security Services.
Stop sendmail.
# /etc/init.d/sendmail stop
Verify the host-name configuration.
Run the check-hostname script to verify that sendmail can identify the fully qualified host name for this server.
% /usr/lib/mail/sh/check-hostname hostname phoenix OK: fully qualified as phoenix.example.com
If this script is not successful in identifying the fully qualified host name, you need to add the fully qualified host name as the first alias for the host in /etc/hosts.
Update the /etc/hosts file.
Choose the step that is appropriate for you.
- (Optional)
If you are using NIS or NIS+, edit the /etc/hosts file on the system that is assigned to be the new mail host.
Add the word mailhost and mailhost.domain after the IP address and system name of the mail host system.
IP_address mailhost mailhost mailhost.domain loghost
IP_address
Use the assigned IP address.
mailhost
Use the system name of the mail host system.
domain
Use the expanded domain name.
The system is now designated as a mail host. The domain should be identical to the string that is given as the subdomain name in the output of the following command.
% /usr/lib/sendmail -bt -d0 </dev/null Version 8.12.0+Sun Compiled with: LDAPMAP MAP_REGEX LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS NISPLUS QUEUE SCANF SMTP USERDB XDEBUG ============ SYSTEM IDENTITY (after readcf) ============ (short domain name) $w = phoenix (canonical domain name) $j = phoenix.example.com (subdomain name) $m = example.com (node name) $k = phoenix ========================================================
See the following example of how the hosts file should look after these changes.
# cat /etc/hosts # # Internet host table # 172.31.255.255 localhost 192.168.255.255 phoenix mailhost mailhost.example.com loghost
- (Optional)
If you are not using NIS or NIS+, edit the /etc/hosts file on each system in the network and create the following entry.
IP_address mailhost mailhost mailhost.domain loghost
- (Optional)
Select the correct configuration file to copy and rename.
The following command copies and renames the /etc/mail/main.cf file.
# cp /etc/mail/main.cf /etc/mail/sendmail.cf
Restart sendmail.
# /etc/init.d/sendmail start
Test your mail configuration.
See "How to Test the Mail Configuration" for instructions.
For further information about mail hosts, refer to "Hardware Components" in Chapter 26, Mail Services (Reference).
How to Set Up a Mail Gateway
A mail gateway manages communication with networks outside your domain. The mailer on the sending mail gateway can match the mailer on the receiving system.
A good candidate for a mail gateway is a system that is attached to Ethernet and phone lines or a system that is configured as a router to the Internet. You can configure the mail host or another system as the mail gateway. You might choose to configure more than one mail gateway for your domain. If you have UNIX-to-UNIX Copy Program (UUCP) connections, you should configure the system (or systems) with UUCP connections as the mail gateway.
Become superuser on the mail gateway or assume an equivalent role.
For information about roles, refer to "Using Privileged Applications" in System Administration Guide: Security Services.
Stop sendmail.
# /etc/init.d/sendmail stop
Select the correct configuration file to copy and rename.
The following command copies and renames the main.cf file.
# cp /etc/mail/main.cf /etc/mail/sendmail.cf
Verify the host-name configuration.
Run the check-hostname script to verify that sendmail can identify the fully qualified host name for this server.
# /usr/lib/mail/sh/check-hostname hostname phoenix OK: fully qualified as phoenix.example.com
If this script is not successful in identifying the fully qualified host name, you need to add the fully qualified host name as the first alias for the host in /etc/hosts. If you need help with this step, refer to Step 4 of "How to Set Up a Mail Host".
Ensure that your name service has been started.
- (Optional)
If you are running NIS, use this command.
# ypwhich
For more information, refer to the ypwhich(1) man page.
- (Optional)
If you are running NIS+, use this command.
# nisls
For more information, refer to the nisls(1) man page.
- (Optional)
If you are running DNS, use this command.
# nslookup hostname
hostname
Use your host name.
For more information, refer to the nslookup(1M) man page.
- (Optional)
If you are running LDAP, use this command.
# ldaplist
For more information, refer to the ldaplist(1) man page.
- (Optional)
Restart sendmail.
# /etc/init.d/sendmail start
Test your mail configuration
See "How to Test the Mail Configuration" for instructions.
For more information about the mail gateway, refer to "Hardware Components" in Chapter 26, Mail Services (Reference).