I have an email server configured with multiple-instance of sendmail running each on different IPv4 and IPv6 addresses.
Everything is running smooth until a point where for some domains/emails (apparently random) sendmail try to send the email from the IPv6 address instead of the IPv4 and I begin to receive messages like:
SYSERR(root): makeconnection: cannot bind socket [IPv6:2001:db8::2]: Address family not supported by protocol
to=<xxx@bad-domain.example>, delay=04:23:07, xdelay=00:00:00, mailer=esmtp, pri=11918385, relay=bad-domain.example. [198.51.100.5], dsn=4.0.0, stat=Deferred: Address family not supported by protocol
The IPv6 and IPv4 addresses was obfuscated.
What I observed, but I'm not sure that this is the issue, the MX record for the bad-domain is a CNAME instead of direct A or AAAA record.
I'm using Sendmail 8.14.5 on Fedora 16 all the IP's are statically configured (IPv4 + IPv6)
If the base issue can't be solved there is a way to instruct sendmail to use only IPv4 for a list of specified domains ?
An extract from the sendmail.mc:
CLIENT_OPTIONS(`Family=inet,Addr=192.0.2.2')dnl
CLIENT_OPTIONS(`Family=inet6,Addr=2001:db8::2')dnl
DAEMON_OPTIONS(`Name=MTA-v4,Family=inet,Addr=192.0.2.2')dnl
DAEMON_OPTIONS(`Name=MTA-v6,Family=inet6,Addr=2001:db8::2')dnl
some example for bad-domain:
donpac.ru, montevideo.com.uy, dalia-ingenierie.fr, opela.cz, orange.net, poisl.com.br, tamil.com, zerong.cn
LE:
all seems to have a CNAME as MX record and no one of the CNAME's resolv to IPv6
Best Answer
Whilst the comments above seem to suggest that this isn't a v4-by-domain issue, I had cause to need to do exactly what you describe, today, and found this question whilst searching.
The method I found to force v4 delivery on a domain-by-domain basis is to enable mailertable, by having
in my sendmail.mc (if it's already there, you don't need to add it again). Then I force v4-based delivery by overriding the DNS And instructing delivery to go to a v4 address in the mailertable file; this is from
/etc/mail/mailertable
:I don't normally redact domain names, but I don't wish to embarrass the colleagues who have wrongly implemented smtp-over-ipv6, and thus need me to force delivery over v4. The IP address is obviously false, also; but in production it's the v4 address of their primary MX, taken from the DNS.