Re: [exim] How to choose the outgoing IPs for an E-Mail

Top Page
Delete this message
Reply to this message
Author: Luca Bertoncello
Date:  
To: exim-users
Subject: Re: [exim] How to choose the outgoing IPs for an E-Mail
Phil Pennock <exim-users@???> schrieb:

Hi, Phil!

> Exim looks up the addresses to try, and filters the available source
> address to be one for that family. If you only provide an IPv4 address,
> then a connection to an IPv6 endpoint will not have a forced chosen IPv6
> source address.


That's right! I just forgot that... :(

> You can disable IPv6 in the configuration, with "disable_ipv6" in the
> main configuration section. You can also set "dns_ipv4_lookup" there,
> to point to domains that IPv6 lookups should be avoided for, if you know
> of broken servers.
>
> On a Router, you can use "ignore_target_hosts" to disable either IPv4 or
> IPv6, by specifying the relevant "any" address as the value.
>
> So you might use a forany/forall check against the result of the
> existing config file, combined with isip4/isip6, to decide if you have
> chosen an appropriate source address for that destination, and then set
> ignore_target_hosts appropriately. It will be a little convoluted to
> read. Or you might have the system which generates the existing lookup
> file also generate a different lookup file. Or you might duplicate the
> Router, make the first one IPv4-only with ignore_target_hosts set to a
> fixed string instead of a lookup but do the same forall/isip4 check,
> this time in a "condition" rule.


Yes, it will be very complicated...

I decided to do that:

My tranport:

remote_smtp:
driver = smtp
helo_data = $smtp_active_hostname
interface =
${lookup{$sender_address_domain}lsearch{/etc/exim/mailouts}{$value}{<;
DEFAULT_IPv4 ; DEFAULT_IPv6}}

My /etc/exim/mailouts uses this format:

domain.tld: <; 12.34.56.78 ; 2001:1234::1
ipv4.domain.tld: <; 12.34.56.78 ; ::2

If I try to send an E-Mail from any address @ipv4.domain.tld Exim tries first
to bind to ::2 and it cannot, then it tries using 12.34.56.78.
I get a warning in my exim_mainfile, but I think, this is acceptable...
I don't think, I will use too much the option to just use IPv4, even if it
can be possible to use IPv6... It was just if in the future, I want to have a
domain that only use IPv4...

Thanks again!
Luca Bertoncello
(lucabert@???)