Changing mail IP for an individual account

OLM

Member
Oct 31, 2014
12
1
3
cPanel Access Level
Root Administrator
Hi folks,

Haven't done this before and think I may have missed a step??

Ok so I have a VPS with several domains using the main IP address for outgoing mail.

I want to change one domain/account to use a new IP address for email and the rest to continue as before.

So I have added the IP via WHM Add IP address and can now see it listed.

Then I have gone into the Exim configuration manager/Domains & IPs and set the following to ON:

Reference /etc/mailhelo for outgoing SMTP HELO
Reference /etc/mailips for outgoing SMTP connections

Then in /etc/mailips I have edited it by adding this below:

thisonedomain.com: NEWIP
*: MAINIP

Then in /etc/mailhelo I have edited it by adding this below:

thisonedomain.com: thisonedomain.com
*: vps.maindomain.com

Then I have restarted exim using:

/etc/init.d/exim restart

Ok so that's what I have done so far.

Now when I go into IP Functions > Show IP Address Usage

It shows the Main IP with all the domains under mail usage
It shows the New IP with no domains under mail usage

The question is - shouldn't the changed domain (thisonedomain.com) appear under mail usage for the New IP address??

Have I missed a step or is there some delay?

Bit of a newbie here so any assistance appreciated.

Thanks
 
  • Like
Reactions: thietbixe.com

quietFinn

Well-Known Member
Feb 4, 2006
2,042
553
493
Finland
cPanel Access Level
Root Administrator
The question is - shouldn't the changed domain (thisonedomain.com) appear under mail usage for the New IP address??
No.
You must change that account's IP address, in WHM -> Account Functions -> Change Site's IP Address.

But after the changes you have made mails sent fromthisonedomain.com are sent from IP NEWIP.
 
  • Like
Reactions: OLM

OLM

Member
Oct 31, 2014
12
1
3
cPanel Access Level
Root Administrator
But after the changes you have made mails sent fromthisonedomain.com are sent from IP NEWIP.
Thanks for the reply - the thing is though I have now checked email coming from fromthisonedomain.com and they
are still coming from old IP with the old Helo reference.

It looks to me like Exim is not checking the mailips & mailhelo files as I have selected in Exim configuration.
 

OLM

Member
Oct 31, 2014
12
1
3
cPanel Access Level
Root Administrator
Haven't been able to resolve this as yet and the advice from my hosts seems to be to raise a support ticket with cPanel so will go ahead with that.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,042
553
493
Finland
cPanel Access Level
Root Administrator
Haven't been able to resolve this as yet and the advice from my hosts seems to be to raise a support ticket with cPanel so will go ahead with that.
I was testing this in one of our servers, and it worked as expected.
Maybe it's something in your server or cPanel so it's good idea to open a ticket.
 
  • Like
Reactions: OLM

texo

Well-Known Member
Mar 28, 2007
151
6
168
cPanel Access Level
Root Administrator
In your WHM, got to EXIM CONFIGURATION EDITOR and ensure that "Send mail from the account’s IP address" is enabled.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,042
553
493
Finland
cPanel Access Level
Root Administrator
In your WHM, got to EXIM CONFIGURATION EDITOR and ensure that "Send mail from the account’s IP address" is enabled.
That is not necessarily a good idea. If you do that you must make sure that every account that has own IP has the IP's rDNS configured correctly.
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hello,

It looks like you started off on the right path:

So I have added the IP via WHM Add IP address and can now see it listed.
This is the correct process check2.png
Then I have gone into the Exim configuration manager/Domains & IPs and set the following to ON:

Reference /etc/mailhelo for outgoing SMTP HELO
Reference /etc/mailips for outgoing SMTP connections
Also correct check2.png
Then in /etc/mailips I have edited it by adding this below:

thisonedomain.com: NEWIP
*: MAINIP
Looking good check2.png this is also where I would have stopped

Then in /etc/mailhelo I have edited it by adding this below:

thisonedomain.com: thisonedomain.com
*: vps.maindomain.com
For this modification, you should really have the PTR record for the IP address thisonedomain.com is using set to resolve back to thisonedomain not the hostname - I don't know what you have it set to now, but it's really not necessary to set this if you have a valid PTR record for both IP addresses.

Then I have restarted exim using:

/etc/init.d/exim restart
This is fine though not necessary after making the change to /etc/mailips

Now when I go into IP Functions > Show IP Address Usage

It shows the Main IP with all the domains under mail usage
It shows the New IP with no domains under mail usage

The question is - shouldn't the changed domain (thisonedomain.com) appear under mail usage for the New IP address??
Right, this is the expected behavior, this will only show the domain as being assigned to that IP address if you assign it as a dedicated IP address. For mailips it will not be referenced here.


Once you finish the modification portion up to /etc/mailips modification and send a test email, can you confirm that the headers still reference the shared IP rather than the IP you set for thisonedomain.com?
 

OLM

Member
Oct 31, 2014
12
1
3
cPanel Access Level
Root Administrator
Many thanks for the reply - appreciated!

I can confirm that when an email is sent from thisonedomain.com it is still showing the shared IP address and not the new one. I wasn't initially sure about the changes to mailhelo and have tried with and without any changes but the result is the same.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @OLM

Thanks for getting back to me. Can you tell me what the output of the following is?

Code:
grep custom_mail /etc/exim.conf.localopts
Code:
stat /etc/mailips
 

OLM

Member
Oct 31, 2014
12
1
3
cPanel Access Level
Root Administrator
Hi Lauren - thanks for your help answers below:

Code:
grep custom_mail /etc/exim.conf.localopts
custom_mailhelo=1
custom_mailips=1

Code:
stat /etc/mailips
File: `/etc/mailips'
Size: 56 Blocks: 8 IO Block: 4096 regular file
Device: ca01h/51713d Inode: 3360197 Links: 1
Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 12/ mail)
Access: 2020-02-15 22:15:05.000000000 +0000
Modify: 2020-02-15 22:22:41.000000000 +0000
Change: 2020-02-15 22:22:41.000000000 +0000
Cheers

Steve
 

quietFinn

Well-Known Member
Feb 4, 2006
2,042
553
493
Finland
cPanel Access Level
Root Administrator
@OLM

You could test if you can connect to a mail server using that IP NEWIP:

Code:
telnet -b NEWIP gmail-smtp-in.l.google.com 25