Previous Section Next Section

$=w

List of our other names All versions

Before the sendmail program reads its configuration file, it calls gethostbyname(3) or getipnodebyname(3) to find all the known aliases for the local machine. The argument given to gethostbyname(3) or getipnodebyname(3) is the value of the $w macro that was derived from a call to gethostname(3) ($w).

Depending on the version of sendmail you are running, the aliases that are found will be either those from your /etc/hosts file or those found as additional A or AAAA records in a DNS lookup. Then, depending on the DontProbeInterfaces option (DontProbeInterfaces), sendmail will round out that picture by examining (probing) each network interface and extracting from it the associated IP address or hostname.

To see the aliases that sendmail found, or to see what it missed and should have found, use the -d0.4 debugging switch (-d0.4). Any aliases that are found are printed as:

aka: alias

Depending on your version of sendmail, each alias is either a hostname (such as rog.stan.edu) or an IPv4 address (such as [123.45.67.8]), or an IPv6 address (such as [IPv6:2002:c0a8:51d2::23f4]).

Many sendmail.cf files use the $=w class macro to define all the ways users might reference the local machine. This list must contain all names for the local machine as given in the /etc/hosts file, all names for the local host as listed in DNS (including CNAME and MX records), and the names associated with your network interfaces. For example:

# All our routing identities
Cw server1 server2
# All our local aliases
Cw localhost mailhost tops-link print-router loghost
# DNS records
Cw serv-link
# We are a bitnet registered node
Cw bitserver

The correct way to add these domains to $=w in your mc file is with LOCAL_DOMAIN, like this:

LOCAL_DOMAIN(`server1 server2')
LOCAL_DOMAIN(`localhost mailhost tops-link print-router loghost')
LOCAL_DOMAIN(`serv-link')
LOCAL_DOMAIN(`bitserver')

Another correct way to add hostnames to class $=w is with the use_cw_file feature (FEATURE(use_cw_file)).

In addition to hostnames, you can also add addresses to the $=w class. To do so, just surround each address with square braces:

LOCAL_DOMAIN(`[123.45.67.8]')               IPv4 address
LOCAL_DOMAIN(`[IPv6:2002:c0a8:51d2::23f4]') IPv6 address

Note in the second example that you must prefix any IPv6 addresses with a literal IPv6: expression. That prefix signals to sendmail that it is dealing with an IPv6 address.

    Previous Section Next Section