Re: [exim] Use of ipv4 and ipv6 for sending mails to specifi…

Top Page
Delete this message
Reply to this message
Author: Jan Ingvoldstad
Date:  
To: exim users
Subject: Re: [exim] Use of ipv4 and ipv6 for sending mails to specific domains
On Fri, Jul 22, 2016 at 4:38 PM, Thomas Wilhelm <thomas.wilhelm@???>
wrote:

> Hi list,
>
> Situation:
>
> we want to send emails to some domains only via IPv4 and to other domains
> via ipv4 and ipv6.
>
> I tried to use the "interface"-value in the transport-section, but it
> didn't work.
>
> I set an ip for the inferace-value by hand. The value was ignored and the
> Server used the default-IP for sending the email.
>


You need to make an exception so that your default setup isn't used for
those domains.

Here's how we do it (modified Debian config) in our outgoing authenticated
SMTP:

# List of domains to force IPv4 usage for

domainlist ipv4_force_domains = ${if exists{CONFDIR/ipv4_force_domains}
{CONFDIR/ipv4_force_domains} {}}

dnslookup_relay_to_domains:

debug_print = "R: dnslookup_relay_to_domains for $local_part@$domain"

driver = dnslookup

domains = ! +local_domains : ! +ipv4_force_domains : +relay_to_domains

transport = remote_smtp

same_domain_copy_routing = yes

no_more

# deliver mail directly to the recipient. This router is only reached

# for domains that we do not relay for. Since we most probably can't

# have broken MX records pointing to site local or link local IP

# addresses fixed, we ignore target hosts pointing to these addresses.


dnslookup:

debug_print = "R: dnslookup for $local_part@$domain"

driver = dnslookup

domains = ! +local_domains : ! +ipv4_force_domains

transport = remote_smtp

same_domain_copy_routing = yes

# ignore private rfc1918 and APIPA addresses

ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :\

                        172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16 :\


                        255.255.255.255


no_more


ipv4_force_domains:

debug_print = "R: ipv4_force_domains for $local_part@$domain"

driver = dnslookup

domains = +ipv4_force_domains

transport = ipv4_smtp

# Ignore IPv6 addresses

ignore_target_hosts = <; 0::0/0

ipv4_smtp:

debug_print = "T: ipv4_smtp for $local_part@$domain"

driver = smtp

delay_after_cutoff = false

interface = <; YOUR_LOCAL_IPv4_ADDRESS_HERE

# ... other config for this driver


# And in acl_check_rcpt, just before accepting, in the recipient
verification rules:

accept

    domains = +relay_to_domains : +ipv4_force_domains


    endpass


    verify = recipient



--
Jan