Change EXIM IP Address

Sometimes, may be due to spamming our mail interface IP may get blacklisted. After fixing the spamming issue, you need to change the mail interface IP address to make it functioning instantly. Find the steps below.

Shutdown the exim service.

/etc/init.d/exim stop

Edit your exim configuration file.

vi /etc/exim.conf

Go to “remote_smtp” section under “TRANSPORTS CONFIGURATION”.
By default it would look like below:

driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}

Remove or comment line containing “interface” and “helo_data” and add new “interface” to match with that of your new IP address. It should look like as follows:

driver = smtp
interface = # Your IP address.

Save your changes and exit out from your exim configuration file.

Note : Don’t forget to set read only attributes on Exim configuration file, so that it wont get reset to default automatically. ( If it’s cPanel )

You can do it using following command:

chattr +aui /etc/exim.conf

Start exim service on your server.

/etc/init.d/exim restart

That’s it!! So that’s how you change Exim IP address.

Please note that. Just changing Exim interface IP is not a solution for the spamming issue. It’s only a temporary solution and this new IP will also get blacklisted if you don’t fix the actual issues. Someone can’t keep changing the IP forever. So find and resolve the spamming issue first and then change the Exim IP only if required. If you are having trouble findings what script and files are causing the spamming, run Linux Maldet and ClamAV scan and these Anrivirus, Malware scanners will help you find the scripts. If you need help installing and configuring these scanners, here is the link to install ClamAV and here is the link to install Maldet.


  1. can you give me further information, why you use this command?
    chattr +i /etc/exim.conf

    and what effect if whm have update later?


Please enter your comment!
Please enter your name here