more than one IP for EXIM

nisse

Well-Known Member
Nov 11, 2003
87
0
156
If you want to send me the relevant parts of your exim.conf in a PM then I'll take a look at it for you.
 

dianaward

Well-Known Member
Dec 9, 2002
99
0
156
USA
cPanel Access Level
Root Administrator
Twitter
I desperately need to know how to do this...

I have a number of customers who use email lists as a large part of their businesses (legitimate businesses all). If I can set them up with dedicated IPs and safely set the server to send their mail from their own IP, it will stop innocent users of that shared server (including me) from being spamblocked along with them if they have a disgruntled or confused subscriber. Some of these heavy mailing hosting customers are my best and most loyal. Can Anyone tell me how to do this? I'll owe you big time!
 

nisse

Well-Known Member
Nov 11, 2003
87
0
156
You can do it like this:

In the main configuration section of exim.conf, put:

Code:
primary_hostname = host.example.com
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$primary_hostname}}
Then in the remote_smtp part of the transports section, put:

Code:
remote_smtp:
  driver = smtp
  interface = ${lookup{$sender_address_domain}lsearch{/etc/domain_ips}{$value}{$interface_address}} 
  helo_data = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$smtp_active_hostname}}
You need to create two files in /etc for the lookups.

domain_ips contains a list of the domains and their IP addresses, eg:

domain1.com 111.111.111.111
domain2.com 222.222.222.222

If Exim can't find the domain in the file, it will use the current IP instead.

ip_hostnames contains a list of the dedicated IPs and their host names, eg:

111.111.111.111 mail.domain1.com
222.222.222.222 mailserver.domain2.com

If Exim can't find the IP in the file, it will use the current host name instead.

Once you've done all that, restart Exim and it should work. :)
 
Last edited:

ramcjbin

Member
Mar 12, 2005
10
0
151
After doing the above things, should a reverse PTR record need to be added by DC for each IP?
 

tmreyno

Registered
Nov 12, 2006
2
0
151
A modification of NISSE's code seems to work for our servers.

In the Main Configuration section of exim.conf

Code:
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$primary_hostname}}

smtp_banner = "${smtp_active_hostname} ESMTP Exim ${version_number} \
\#${compile_number} ${tod_full} \n\

The transport is the same as NISSE's code:

Code:
remote_smtp:
  driver = smtp
  interface = ${lookup{$sender_address_domain}lsearch{/etc/domain_ips}{$value}{$
  helo_data = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$s$
domain_ips format stays at

domain1.com 111.111.111.111
domain2.com 222.222.222.222
etc....

and ip_hostnames changes from a CNAME mail.domains.com to

111.111.111.111 domain1.com
222.222.222.222 domain2.com
etc....
 

sehh

Well-Known Member
Feb 11, 2006
579
5
168
Europe
I've also been looking for a solution to this problem.

Unfortunately the proposed change isn't "future proof". What i mean is, we have to manually create the above files and update them all the time.

Maybe there is a way to use the existing files generated by cPanel/WHM?

like one of these:

/etc/domainips
/etc/localdomains
/etc/userdomains
/etc/trueuserdomains
/etc/trueuserowners

I believe that /etc/domainips could easily be used instead of the proposed ip_hostnames file.
 

isputra

Well-Known Member
May 3, 2003
575
0
166
Mbelitar
I've also been looking for a solution to this problem.

Unfortunately the proposed change isn't "future proof". What i mean is, we have to manually create the above files and update them all the time.

Maybe there is a way to use the existing files generated by cPanel/WHM?

like one of these:

/etc/domainips
/etc/localdomains
/etc/userdomains
/etc/trueuserdomains
/etc/trueuserowners

I believe that /etc/domainips could easily be used instead of the proposed ip_hostnames file.
I like to know about this solution either. Waiting for response . . . .
 

swampy

Well-Known Member
Jan 30, 2004
148
0
166
Can someone tell me which part is the Main Configuration section of exim.conf is it the very first box of the acl part

I keep getting configure error no matter what box i put the above in

Thanks
 
Last edited:

isputra

Well-Known Member
May 3, 2003
575
0
166
Mbelitar
Can someone tell me which part is the Main Configuration section of exim.conf is it the very first box of the acl part

I keep getting configure error no matter what box i put the above in

Thanks
It's look like all modification discuss in here no longer works with cpanel 11 :D
 

sehh

Well-Known Member
Feb 11, 2006
579
5
168
Europe
You can't use the WHM exim editor to make the above changes, thats why they won't work in any cPanel version.

You have to edit the /etc/exim.conf by hand and remember that any changes will be overwritten in a future exim update. Best solution is to keep a diff patch and apply it when a new exim is installed (not that frequently anyway so this isn't such a big deal).
 

TheStarKillers

Active Member
Jul 15, 2004
28
0
151
You can't use the WHM exim editor to make the above changes, thats why they won't work in any cPanel version.
Incorrect, these changes worked fine with WHM exim editor in cPanel version 10 for a number of servers, including mine.
 

tmreyno

Registered
Nov 12, 2006
2
0
151
Okay this code works fine with these builds of exim and whm.
Exim 4.4, 4.x and 4.6x (currently 4.68)
WHM 10.x.x and 11.x.x (Currenlty 11.12.0)

Second use SSH to "edit etc/exim.conf" because it is by far easier and less confusing.


Find default settings in Main Configuration section of your exim.conf near the top:
Code:
smtp_banner = "${primary_hostname} ESMTP Exim ${version_number} \
\#${compile_number} ${tod_full} \n\
We do not authorize the use of this system to transport unsolicited, \n\
and/or bulk e-mail."
Replace with:
Code:
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$primary_hostname}}

smtp_banner = "${smtp_active_hostname} ESMTP Exim ${version_number} \
\#${compile_number} ${tod_full} \n\
whatever text or message you would like to put in here  about UBE or your service\n\"


next in TRANSPORT CONFIGURATION section near end of exim.conf Find:

Code:
remote_smtp:
  driver = smtp
Replace or comment out with:

Code:
remote_smtp:
  driver = smtp
  interface = ${lookup{$sender_address_domain}lsearch{/etc/domain_ips}{$value}{$interface_address}} 
  helo_data = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$smtp_active_hostname}}
as nisse suggested(per nisse):

create two files in /etc for the lookups.

domain_ips contains a list of the domains and their IP addresses, eg:

domain1.com 111.111.111.111
domain2.com 222.222.222.222

If Exim can't find the domain in the file, it will use the current IP instead.

ip_hostnames contains a list of the dedicated IPs and their host names, eg:

111.111.111.111 mail.domain1.com
222.222.222.222 mailserver.domain2.com

If Exim can't find the IP in the file, it will use the current host name instead.

Once you've done all that, restart Exim and it should work.

Why I like this option to create two new domain and hostname files instead of using suggested ones created by WHM and EXIM is that not all of my clients and sites need this type of service or full disclosure. So to create seperate files give me pure control over automated options.

As for future proof you can lock or backup your exim.conf file from overwrite when WHM or EXIM is upgraded and once upgraded make nessecary changes in less than a minute. The domains_ips and ip_hostnames will stay unchanged (thus no overwrite of settings).

As far as I know the exim syntax and code used for this mod will remain the same through 4.xx and possibly (as far as I know) exim 5 in discussion.

As for the multiple IP's on exim I think with this code you get a mx repsonce with both the domain and it's defined IP from the files domain_ips and ip_hostnames.

regards:)
 
Last edited: