i've got exim4 on ubuntu server and i-ve got a pool of 20 external IP's.
Is that possible to configure exim4 to use this ip-s rotating to send mail?
I think i could do this with iproute / iptables load balancing with "link stick" but i want to know if this is possible with exim4 internal configuration. Maybe there i should create several external smtp_drivers that will be using one of 20 IP and some random() func ?
You can do this from within exim as well without using perl:
create a lookup file /etc/exim/ips.txt with
Set the transport to:
randint will return a random number between 1-4 which is then looked up in the file and used if you have more ip's just add to the list and increment the randint value to number ips + 1
Can be used by those who have exim built without perl or just don't want to use perl keeping everthing within exim.
I found this article which show how to sets up a random function to pick an IP from a list and then assign it as an output interface to the smtp driver.
Essentially, you have to set up a function:
and modify the smtp driver:
Here's a very easy way
create
/etc/exim.pl
with the following content:Replace the
x.x.x.x
with IP and the hostname ( after colon, which will be used as HELO).Now add this to top of your exim.conf
Now, under
remote_smtp:
section append thisThat's it. Now emails will randomly go through all the IPs you added to Perl script, and will use the valid HELOs.
You will get the following error if you follow topdog's approach.
there are two transports called "remote_smtp"
as you cannot change the STARTTRANSPORT section in exim conf editor.
Even if you try to change exim.conf manually, it will be wiped out and replaced with the default one on restart.
The only solution I could find on the internet was http://forums.cpanel.net/f43/scripts-posteximup-help-205971.html#post845302
I have also posted a ticket to cPanel. lets see how they respond. Will try to update it once I receive a response.