How to change external ip address on linux for mail

To change the external IP address on a Linux system for mail, you'll need to update the mail server's configuration files. The specific steps may vary depending on the mail server software you're using. Here are some general steps for popular mail server software:

Postfix

  1. Edit the main.cf file: sudo nano /etc/postfix/main.cf
  2. Update the mydestination parameter to include the new external IP address: mydestination = example.com, 203.0.113.100 (replace example.com with your domain name and 203.0.113.100 with your new external IP address)
  3. Update the mynetworks parameter to include the new external IP address: mynetworks = 127.0.0.0/8 [::1]/128 203.0.113.100/32
  4. Restart the Postfix service: sudo service postfix restart

Sendmail

  1. Edit the sendmail.cf file: sudo nano /etc/sendmail.cf
  2. Update the dnl (define) statement for the mydomain parameter to include the new external IP address: dnl mydomain = example.com, 203.0.113.100
  3. Update the dnl statement for the mynetworks parameter to include the new external IP address: dnl mynetworks = 127.0.0.0/8 [::1]/128 203.0.113.100/32
  4. Restart the Sendmail service: sudo service sendmail restart

Exim

  1. Edit the main.cf file: sudo nano /etc/exim4/conf.d/main.cf
  2. Update the host_lookup parameter to include the new external IP address: host_lookup = 203.0.113.100
  3. Update the remote_smtp parameter to include the new external IP address: remote_smtp = 203.0.113.100
  4. Restart the Exim service: sudo service exim4 restart

Dovecot

  1. Edit the 10-master.conf file: sudo nano /etc/dovecot/conf.d/10-master.conf
  2. Update the listen parameter to include the new external IP address: listen = *:143 203.0.113.100:143
  3. Restart the Dovecot service: sudo service dovecot restart

After updating the configuration files, restart the mail server service to apply the changes. You may also need to update your DNS records to point to the new external IP address.

Remember to replace example.com and 203.0.113.100 with your actual domain name and external IP address, respectively.