I was looking for change server IP in the forums, but I did not find anything relevant, so this is the problem I was notified from the hosting that I will have to schedule a maintenance window for a v4 IP change (I have 5 v4 IPs and 3 v6 IPs) using at least 2 or 3 of them in different things. They would change the IPs in the OS (Linux 10 Buster), but I don't know what to take into account or steps to follow for the changes in ISPConfig. I have version 3.2.9p1 installed with several clients, about 20 sites, email accounts, and DNS for all that. NOTE (just in case): I have Roundcube, and when I bought the service one or two of the current IPs came dirty and blocked by some servers, so I think the change is good in that sense. I currently have Postfix configured to use Mailjet's external service for the domains that were blocking the IP (I could probably remove this with the IP change, but I would test it first). I know that there are many records in the DB with IP fields and also all the files that ISPConfig changes or creates that have the IP in their settings like some apache files.... So what would be the best way to make these changes work well on ISPConfig? Thanks in advance for any help. Just tell me if you need more info or I missing something.
See https://forum.howtoforge.com/threads/howto-change-ip-of-ispconfig-server.86955/ and https://forum.howtoforge.com/threads/changing-ips.91211/
OK, that's weird as I find for that before but nothing found. Thanks Th0m. So, based on those topics should be: Update /etc/hosts Update /etc/network/interfaces Update /etc/resolv.conf Update the IP for the server in ISPConfig3 under "Server IP Addresses" Code: ispconfig_update.sh --force First three will be make by the hosting, I would do last two. BUT what about the DNS entries and so on ? For example, I have many records with different IPs for NS... Do you think that after those steps I should do a search and replace in all ISPConfig tables for the old IPs by the new ones?
You have to update every DNS entry that pointed to the old ISPConfig Server/IP Adresse to the new one. All internal as well as all external records that might point to it.
Thanks for the answer. Yes, I understand that, but I am looking for a more optimal way to do it than manually one by one because there are hundreds of records. And I think the ispconfig_update will not modify any records saved by the user.
You can just run a SQL Query on the database that updates the values to the new IP. The tables in question are dns_rr and dns_soa.
This will have a right impact on Bind to take the correct IPs for the DNS records ? Or only affects the DB for ISPConfig ?
Trying to remember how i've done this in the past. You should use the API as ISPConfig will not be aware of the changes directly in the database. I can post a few more details tomorrow if you want
Just trying to make a step by step guide to implement the changes without forgot nothing. After 5 steps I said above... I think... (after read a lot of topics) Maybe Resync Tool --> All services and DNS records would do the work after change the IPs in DB tables ? Yes please, everything is welcome as I am still looking for the right steps among a lot of old and new info.
So with the API you can use it like shown in the following example. Code: $dns_records = $client->dns_a_get($session_id, array('data' => '%10.10.10.10%')); This will return every A record that has the IP 10.10.10.10 set in the data field. So all you have to do is, grab all the records that have to old IP address, loop through them and set the new address. Like so: Code: $dns_records = $client->dns_a_get($session_id, array('data' => '%10.10.10.10%')); foreach($dns_records as $record) { $client_data = $client->client_get_id($session_id, $record['sys_userid']); $record['data'] = '20.20.20.20'; try { affected_rows = $client->dns_a_update($session_id, $client_data, $record['id'], $record); echo " Updated: " . $record['zone']; } catch { echo " Failed: " . $record['zone']; echo $client->_getLastResponse(); die('SOAP Error: '.$e->getMessage()); } } This is untested!
OK, I already have several steps that I believe would make up everything needed for the complete change of IPs. I will try to put it together here for others to use and then update it if I run into problems or find that there are other extra steps. If you see that I have some concept or steps wrong please correct me. From what I understood from Till answer with the Resync tools should not be necessary to do the script with the API calls and it can be done easier with some queries through phpmyadmin and do the resync later. I found these items by making a search in PHPmyadmin, database: dbispconfig These will be repeated for each IP (more or less) Code: Show search criteria Search results for "173.XX.XX.XX" at least one of the words: 22 matches in dns_rr Browse Delete 4 matches in dns_soa Browse Delete 2 matches in monitor_data Browse Delete 2 matches in remote_user Browse Delete 1 match in server_ip Browse Delete 3 matches in sys_datalog Browse Delete Total: 34 matches So, these are the steps that I was gathering: Update /etc/hosts Update /etc/network/interfaces Update /etc/resolv.conf Update the IP for the server in ISPConfig3 under "Server IP Addresses" ispconfig_update.sh --force Change all the IPs by the new ones with queries for Search and replace by table inside PHPmyadmin Do the Resync Tool for All services and DNS records. (Or maybe for all checkboxes there)
Do not replace the content in monitor_data and sys_datalog. The tables dns_rr, dns_soa, remote_user, and server_ip should all be OK to alter with your batch replacement. If you replace the content in server_ip, your step 4 would not be necessary, but it would be better to do step 4 - it would just mean there's nothing to replace in server_ip later on. As you stated that your provider will do the changes in Debian, I don't thin step 2 and 3 are necessary. If this is a slave server, you need to do step 5 and let the script reconfigure permissions for the master database. It might be necessary to create a new MySQL root user with the new source IP in MariaDB. The process for creating those is described here: https://www.howtoforge.com/tutorial...-the-remote-mysql-users-for-our-slave-servers - but if this is a master server, you don't have to reconfigure services.
Thom, excellent, thanks for clarifying everything. This helps a lot. This is simply a standalone server with no slave. So I have to run ispconfig_update.sh --force without to reconfigure services.