Point of multiple IP addresses?

czerdrill

Well-Known Member
Feb 18, 2011
70
0
56
This might be a strange or stupid question, but I figured I'd ask it anyway. I signed up with a dedicated host and they offer five IP addresses with the server package. So there is a main IP, and then 4 extra ones I can use. What I did was create a separate account in WHM and assigned one of the free IPs to it. So now I have the main domain, with the main IP, and then a WHM account with another domain and another IP. However, when I send email from the second domain I set up, it still shows as sending from the main IP. I asked the host about it, and they said there is no way for mail to appear to be coming from that second IP, that it will always show as coming from the main IP.

So my question is, what is the point of the 5 IP addresses? If the mail will always be shown as coming from the main IP, and rDNS is set for the main IP only, why would I need 5 IP addresses?

Also, is this just a per host thing? Meaning it might just be a policy of my host? Or is this just how it always is? That the main IP will always be the IP that shows as where the mail originated from? Thanks in advance!
 

bhd

Well-Known Member
Sep 20, 2003
149
2
166
JNB ZA
cPanel Access Level
Root Administrator
The real purpose of the additional IP addresses is for setting up things like SSL. Any site with it's own certificate needs a dedicated IP. Generally, you would setup all your other accounts on the main server IP and only use the others when you need them (typicall for SSL).

As for mail. cPanel does allow you to send mail from the IP the account is hosted on -- you set that in the EXIM configuration editor. However, the IP must have revers DNS setup correctly.

Also, not 100% sure on this but I've never managed to get a site send mail on it's own IP if the mail originates on the server. It works fine if the mail is sent from the outside (the originating IP and HELO are the account IP) but when a script sends email, it seems to always come from the main shared IP.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
38
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Also, not 100% sure on this but I've never managed to get a site send mail on it's own IP if the mail originates on the server. It works fine if the mail is sent from the outside (the originating IP and HELO are the account IP) but when a script sends email, it seems to always come from the main shared IP.
Whenever a script uses sendmail rather than SMTP authentication, it isn't using the exim routing options, so you don't end up having the account IP being used to send the email. Only SMTP authentication methods will send the emails via the IP designated in /etc/mailips, /etc/mailhelo and /etc/mail_reverse_dns files.

For those who are not aware how to do so, you can set the dedicated IP to be used to send emails from any account using a dedicated IP in WHM > Exim Configuration Editor > Automatically send outgoing mail from the account’s IP address instead of the main IP address. Warning: If you turn this setting on you should make sure reverse DNS entries match the ones in /etc/mail_reverse_dns
 

czerdrill

Well-Known Member
Feb 18, 2011
70
0
56
Then why does my host say this:

"If we set the RDNS of the main ip to the second domain name we would need the A record of that site to point back to the servers main IP and then all outgoing email would show up as coming from the second domain name."

And also:


"if you need to set the RDNS of the main ip to the second domain, we would need the A record of that site to point back to the servers main IP, but the email would always go out on the main server ip."

Are they just not allowing me to do it, for whatever reason?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
38
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
If you have root login for WHM, then you can choose to log into WHM and enable the option that I've noted, which allows sending via the dedicated IP for accounts with a dedicated IP. I cannot speculate why your host is saying otherwise. I can only state how it works in WHM and with cPanel.
 

czerdrill

Well-Known Member
Feb 18, 2011
70
0
56
Ok, I can do that, as I do have root. The only thing I'm not sure about is the part that says

Warning: If you turn this setting on you should make sure reverse DNS entries match the ones in /etc/mail_reverse_dns

Does that mean I can simply open up /etc/mail_reverse_dns and add a line below what's already there?

what's there now is the main ip: xxx.xxx.xxx.xxx : server.mydomain.com
so can i just add the second ip: xxx.xxx.xxx.xxx : myotherdomain.com below that line and save and it'll be fine? or do I have to edit any other files?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
38
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Correct, you can add entries into /etc/mail_reverse_dns file and put "secondIP#: xxx.xxx.xxx.xxx: myotherdomain.com" but you should have the PTR record (rDNS) match your domain with the dedicated IP. If it doesn't match, ask your provider to change the PTR for that IP to match your domain that has the dedicated IP.
 

czerdrill

Well-Known Member
Feb 18, 2011
70
0
56
Ah see that's where my confusion is. If I change the rDNS doesn't that mean it'll appear that all mail is going from that second domain? Or will mail sent from the main domain/IP still show as the main domain/IP, and mail sent from the second domain/IP show as the second domain/IP?

Pretty much I want to be able to send mail from both IPs and both domains, and show the correct domain/IP in the headers when it is sent
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
38
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
As has been mentioned, you can send mail from a dedicated IP for an account with a dedicated IP. The PTR records do not determine what IP is used for sending the email. The PTR records determine if the email recipient will accept or reject your emails, because your PTR record for the IP (the PTR would be set by your host) must match that of the mailhelo and mail_reverse_dns files in /etc.

Again, you can send from the dedicated IP provided you configure the option that I've mentioned and that bhd also had mentioned in WHM's Exim Configuration Editor to automatically send from the account's IP address. Your PTR record; however, determines not if you can send the email but if that email will be accepted. Ask your hosting provider to set the PTR for the dedicated IP to whatever domain you are setting up in these files to use for it.

The main shared IP should stay that of the server's hostname.