[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

FQDN via DHCP, then used in exim4



Hi All, just joined this mailing list after years of lurking :-)

On my home network I run approx. 10 clients, mostly Debian powered (from a fileserver and several laptops and desktops to NSLU2s and a Raspberry PI). It is set-up such that the router (Billion 7800N) also serves as a DHCP and as the local DNS server. Most clients on the LAN are assigned a fixed IP address, and I achieve that by providing a list of MAC addresses, hostnames and corresponding IP address on the router. Further, the router also knows and serves my domain name (something like 'my-domain-name.me.uk'), and the DHCP clients request all this info. Works a treat.
This is an example of a file in /var/lib/dhcp:

$ cat /var/lib/dhcp/dhclient.eth0.leases
lease {
  interface "eth0";
  fixed-address 192.168.0.77;
  option subnet-mask 255.255.255.0;
  option routers 192.168.0.1;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.0.1;
  option dhcp-server-identifier 192.168.0.1;
  option host-name "rpi";
  option domain-name "my-domain-name.me.uk";
  renew 4 2013/05/16 02:00:04;
  rebind 4 2013/05/16 02:00:04;
  expire 4 2013/05/16 02:00:04;
}
(...)


The RaspPi (running Raspbian, a version of Wheezy for the ARMHF architecture) also acts as a mail server, talking SMTP to the wider world using exim4. After I got an error message from some strict server telling me

 504 5.5.2<rpi>: Helo command rejected: need fully-qualified hostname


I noticed that exim does NOT use the DHCP-provided domain name.
The unqualified host name is set in /etc/hostname, and in /etc/hosts I intentionally did not set the external IP or
domain name.

$cat /etc/hostname
rpi

$ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    rpi

Now, I can make exim work by manually providing the domain name in /etc/hosts and /etc/mailname,

$ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    rpi.my-domain-name.me.uk rpi

but somehow I had hoped that the DHCP served domain name should suffice for all services? And despite of what it says in the comments inside the exim config file ( /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs )


# Decide which domain to use to add to all unqualified addresses.
# If MAIN_PRIMARY_HOSTNAME_AS_QUALIFY_DOMAIN is defined, the primary
# hostname is used. If not, but MAIN_QUALIFY_DOMAIN is set, the value
# of MAIN_QUALIFY_DOMAIN is used. If both macros are not defined,
# the first line of /etc/mailname is used.
.ifndef MAIN_PRIMARY_HOSTNAME_AS_QUALIFY_DOMAIN
.ifndef MAIN_QUALIFY_DOMAIN
qualify_domain = ETC_MAILNAME
.else
qualify_domain = MAIN_QUALIFY_DOMAIN
.endif
.endif

it is not sufficient to set the domain in /etc/mailname, instead /etc/hosts must contain the FQDN.

Sorry long post. Can anybody shine light on this, and maybe even know how to make use of the DHCP provided
domain name in exim?

Thanks
Klaus


Reply to: