New IP not being recognized

I have added a secondary IP for the VPS that’s running mailinabox, and the NS and A records do point to that new IP but the box is still using the old IP.
This currently the IP settings:

eth0 Old IP
eth1 NEW IP

How can I make the MIAB Setup change from using the Old IP in eth0 to the new eth1 NEW IP? Can this be achieved? Or I should stay with the Old IP. Thanks for your guidance and help.

1 Like

theoretically, if you have followed the set up

  1. A record for box.mydomain.com pointing to your IP
  2. Reverse DNS box.mydomain.com should resolve to your IP also.
    it should not have problem working automatically.

the set up will create the config file at /etc/mailinabox.conf which you can see the IP address the box is using. Im not sure whether overwriting this is a good move because not sure whether this file gets overwritten when you update

Assign the new IP to eth0

Thank you so much, I have tried this way but it’s not working.

Thank you for your help, I have made the change but it still recognizing the old ip as primary. Even when on the A record is already the new IP.

I presume that you did a reboot?

Yes and no change.

Primary Hostname: box.safemail.cloud
Public IP Address: 173.82.212.207
Public IPv6 Address: 2607:f130:0:f0::398
Mail-in-a-Box Version: v0.51

And if you check the A record is pointing to 134.195.209.2
I have already tried with /management/tools/dns_update --force but it keeps showing old IP.

I have reverted the DNS to the old IP to keep it working in the meantime I find a solution for this. Thanks for all your help.

How can I make the MIAB Setup change from using the Old IP in eth0 to the new eth1 NEW IP?

Did you change the public ip in /etc/mailinabox.conf before running the setup again? Then rerunning the setup should result in the desired output.

After rerunning setup make sure that the following files contain your new ip:

  • /etc/postfix/outgoing_mail_header_filters
  • /etc/fail2ban/filter.d/jails.conf

P.S. I hope you have good backups - you should always be able to get back to the previous state… :slight_smile:

Thank for the heads up, but editing the mailinabox.conf file and running the setup again ends with the following message:
'seradd: invalid user name 'user-data
And I can’t go any further.

  • Does the normal setup (i.e. without any changes to the config file) run without any errors on the server?
  • Did you only change the IP in mailinabox.conf? Did you make any other changes, i.e. changed line breaks etc.? You should only change the IP, nothing else and you should do it (if possible) on the server itself (e.g. with nano/vi/…)

Your error most likely results from the fact that the mailinabox.conf file got broken. However, we are also trying something unsupported here, so again: keep backups from the running system :slight_smile: