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
- Edit the
main.cf
file:sudo nano /etc/postfix/main.cf
- Update the
mydestination
parameter to include the new external IP address:mydestination = example.com, 203.0.113.100
(replaceexample.com
with your domain name and203.0.113.100
with your new external IP address) - Update the
mynetworks
parameter to include the new external IP address:mynetworks = 127.0.0.0/8 [::1]/128 203.0.113.100/32
- Restart the Postfix service:
sudo service postfix restart
Sendmail
- Edit the
sendmail.cf
file:sudo nano /etc/sendmail.cf
- Update the
dnl
(define) statement for themydomain
parameter to include the new external IP address:dnl mydomain = example.com, 203.0.113.100
- Update the
dnl
statement for themynetworks
parameter to include the new external IP address:dnl mynetworks = 127.0.0.0/8 [::1]/128 203.0.113.100/32
- Restart the Sendmail service:
sudo service sendmail restart
Exim
- Edit the
main.cf
file:sudo nano /etc/exim4/conf.d/main.cf
- Update the
host_lookup
parameter to include the new external IP address:host_lookup = 203.0.113.100
- Update the
remote_smtp
parameter to include the new external IP address:remote_smtp = 203.0.113.100
- Restart the Exim service:
sudo service exim4 restart
Dovecot
- Edit the
10-master.conf
file:sudo nano /etc/dovecot/conf.d/10-master.conf
- Update the
listen
parameter to include the new external IP address:listen = *:143 203.0.113.100:143
- 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.