KNOWNHOST WIKI

User Tools

Site Tools


control-panels:directadmin:how-to-change-the-outgoing-mail-ip

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
control-panels:directadmin:how-to-change-the-outgoing-mail-ip [2020/05/26 09:39]
Karson N.
control-panels:directadmin:how-to-change-the-outgoing-mail-ip [2020/06/01 14:18] (current)
Karson N.
Line 30: Line 30:
  
 You can manually edit these files and restart Exim to make the changes take place. You should have the following settings set in the DirectAdmin configuration for manual outgoing mail IP management (note that these are the same settings as when you are using the default setup of sending mail from the main server IP): You can manually edit these files and restart Exim to make the changes take place. You should have the following settings set in the DirectAdmin configuration for manual outgoing mail IP management (note that these are the same settings as when you are using the default setup of sending mail from the main server IP):
 +<code>
   add_domain_to_domainips=0   add_domain_to_domainips=0
   domainips_default_ip=   domainips_default_ip=
 +</code>
  
 Let's say that 1.2.3.4 is my secondary IP and I want to use my secondary IP as my outgoing mail IP from now on. Currently, the domainips file doesn't exist since domainips_default_ip= is empty in the directadmin.conf file and add_domain_to_domainips is set to 0. I want to manually manage which domains send from the primary and have all others send from the secondary. I would just create the domainips file with the following: Let's say that 1.2.3.4 is my secondary IP and I want to use my secondary IP as my outgoing mail IP from now on. Currently, the domainips file doesn't exist since domainips_default_ip= is empty in the directadmin.conf file and add_domain_to_domainips is set to 0. I want to manually manage which domains send from the primary and have all others send from the secondary. I would just create the domainips file with the following:
  
 <code> <code>
-*:1.2.3.4+  *:1.2.3.4
 </code> </code>
  
-And restart Exim.  +And restart Exim. 
 +<code>
   service exim restart   service exim restart
 +</code>
  
-And viola! I am now sending mail from my secondary IP 1.2.3.4.  +And viola! I am now sending mail from my secondary IP 1.2.3.4.
  
 For a more complex domain-IP setup with a fallback IP, a sample /etc/virtual/domainips file will contain the following: For a more complex domain-IP setup with a fallback IP, a sample /etc/virtual/domainips file will contain the following:
  
 <code> <code>
-*:1.2.3.4 +  *:1.2.3.4 
-domain.com:1.2.3.5 +  domain.com:1.2.3.5 
-other.com:1.2.3.5+  other.com:1.2.3.5
 </code> </code>
  
Line 62: Line 63:
  
 <code> <code>
-1.2.3.4:mail.domain.com +  1.2.3.4:mail.domain.com 
-1.2.3.5:mail.other.com+  1.2.3.5:mail.other.com
 </code> </code>
  
 The IPs on the left side must be unique unless add_domain_to_domainips is set to 2 in the directadmin.conf  The IPs on the left side must be unique unless add_domain_to_domainips is set to 2 in the directadmin.conf 
-((https://www.directadmin.com/features.php?id=1711))[[https://www.directadmin.com/features.php?id=1711|Wildcard for domainips with SpamBlocker]]+((https://www.directadmin.com/features.php?id=1711)) 
 +[[https://www.directadmin.com/features.php?id=1711|Wildcard for domainips with SpamBlocker]]
  
 Remember to restart Exim after making any of these modifications! Remember to restart Exim after making any of these modifications!
Line 75: Line 77:
  
 You also have the option to allow DirectAdmin to manage these files, but this requires that each domain sends from its assigned IP (for any domain created with an IP that is not the server IP). The helo_data will only get owned IPs. This configuration requires the following directadmin.conf setting: You also have the option to allow DirectAdmin to manage these files, but this requires that each domain sends from its assigned IP (for any domain created with an IP that is not the server IP). The helo_data will only get owned IPs. This configuration requires the following directadmin.conf setting:
 +<code>
   add_domain_to_domainips=1   add_domain_to_domainips=1
 +</code>
  
 You can also set a fallback IP. If you want to specify a different fallback IP other than your server IP, you can set in the directadmin.conf with the variable: You can also set a fallback IP. If you want to specify a different fallback IP other than your server IP, you can set in the directadmin.conf with the variable:
 +<code>
   domainips_default_ip=1.2.3.4   domainips_default_ip=1.2.3.4
 +</code>
  
 You can use the following commands to configure this (be sure to replace 1.2.3.4 with the fallback IP you'd like to use): You can use the following commands to configure this (be sure to replace 1.2.3.4 with the fallback IP you'd like to use):
 +<code>
   /usr/local/directadmin/directadmin set add_domain_to_domainips 1   /usr/local/directadmin/directadmin set add_domain_to_domainips 1
   /usr/local/directadmin/directadmin set domainips_default_ip 1.2.3.4  restart   /usr/local/directadmin/directadmin set domainips_default_ip 1.2.3.4  restart
 +</code>
  
 Now, you will need to have DirectAdmin rewrite these Exim configuration files since it will be managing them for you: Now, you will need to have DirectAdmin rewrite these Exim configuration files since it will be managing them for you:
 +<code>
   echo "action=rewrite&value=domainips" >> /usr/local/directadmin/data/task.queue   echo "action=rewrite&value=domainips" >> /usr/local/directadmin/data/task.queue
   echo "action=rewrite&value=helo_data" >> /usr/local/directadmin/data/task.queue   echo "action=rewrite&value=helo_data" >> /usr/local/directadmin/data/task.queue
 +</code>
  
 Finally, confirm that data has been written to these files (these files do not exist by default) and restart Exim.  Finally, confirm that data has been written to these files (these files do not exist by default) and restart Exim. 
 +<code>
   service exim restart   service exim restart
-  +</code> 
 \\ \\
 ===== Final Steps ===== ===== Final Steps =====
  
-You may now be done configuring the domainips and helo_data files, but there are a few more very important considerations when it comes to the mailserver's overall configuration. You must now reconfigure your SPF and PTR records to ensure that they are set to use the correct IP(s)! If you have any questions about how to configure them properly, reference our article regarding email best practices or contact support. ((https://www.knownhost.com/wiki/email/troubleshooting/mailserver-configuration#configuring_dns))[[https://www.knownhost.com/wiki/email/troubleshooting/mailserver-configuration#configuring_dns|KnownHost Wiki Mail Server Configuration]]+You may now be done configuring the domainips and helo_data files, but there are a few more very important considerations when it comes to the mailserver's overall configuration. You must now reconfigure your SPF and PTR records to ensure that they are set to use the correct IP(s)! If you have any questions about how to configure them properly, reference our article regarding email best practices or contact support. 
 +((https://www.knownhost.com/wiki/email/troubleshooting/mailserver-configuration#configuring_dns))[[https://www.knownhost.com/wiki/email/troubleshooting/mailserver-configuration#configuring_dns|KnownHost Wiki Mail Server Configuration]]
control-panels/directadmin/how-to-change-the-outgoing-mail-ip.txt · Last modified: 2020/06/01 14:18 by Karson N.