Help! I'm being evicted! (from my static ip)

Discussion in 'ISPConfig 3 Priority Support' started by craig baker, Feb 4, 2023.

  1. craig baker

    craig baker Member HowtoForge Supporter

    Got a notice from Comcast that my static ip is changing tp a different ip address. Now this is not exactly a small thing - and wonder what changes I have to make in one of my production server's setup? Centos 8, Ispconfig3 of course.
    are there scripts available? surely this has happened to others before! Or am i just special?
    Obviously as I'm running BIND all the DNS entries must change. and various entries at godaddy (as the nameserver is defined there).
    what a nasty thing to do!
    any mass-change to do in the mysql databases documented somewhere?

    why does this keep happening to little old me?
    <grin>
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    No scripts, but some things can be mass changed in the database of course.

    You will need to the DNS records, possibly also the GLUE records at your registrar that you have set for the nameserver A records.
    Besides that, under ISPConfig panel > Server IP addresses you will have to update the records.
    In the database (usually dbispconfg), you can search and replace the old IP with the new IP in the dns_rr table.

    After that, resync your websites and DNS records under Tools > Resync.

    How will this IP change go? Will you have both IP's for a while? Or is it immediate?
     
  3. craig baker

    craig baker Member HowtoForge Supporter

    they are both active now. march 2 my old ip disappears.
     
  4. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    OK, that's the best option. Then make the switch now.
     
  5. craig baker

    craig baker Member HowtoForge Supporter

    ok - just want to run down the checklist before beginning!!

    My server is on an internal static ip - so many steps can be skipped. etc/hosts, /network interfaces/ resolv.conf all are correct as they point to the 192.168.xxx address.
    nameserver ns10 is defined at godaddy. have to change that to new ip.

    now what remains is changing the data in dbispconfig. looks like this is the ticket:
    mysqldump -u root -p dbispconfig > ./dbispconfig.sql

    Run sed command to find/replace target string
    sed -i 's/oldipaddress/newipaddress/g' ./dbispconfig.sql

    Reload the database into MySQL
    mysql -u root -p dbispconfig < ./dbispconfig.sql

    then log back into ispconfig and do the resync under tools.
    now all my dns records have the also notify to point to the secondary dns. will the resync cause those records at the secondary dns to change as well?
    or do I need to do that at that server? (its not an ispconfig system sad).

    Miss anything? maybe this is worthy of a little guide. I'm sure others need to do this from time to time!
     
  6. craig baker

    craig baker Member HowtoForge Supporter

    one more query - already started. but we resync only dns records, right?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Thhat#s quite a brute force method to change things in y mysql database. Why don't you just use phpmyadmin to selectively change IP in dns_rr field via SQL query? Your method might work, but it might break e.g. existing records in sys_datalog.

    With your method, it's not clear what gets changed as you change all kind of things which might contain that given IP as part of a text incl. past config transactions. if you want to alter DNS, then I recommend using phpmyadmin to change records in dns_rr table only and then run a resync on DNS only.
     
    Th0m likes this.
  8. craig baker

    craig baker Member HowtoForge Supporter

    hmm had already done this. how can I check if anything has been adversely affected?
    I had assumed any reference to the old ip would want to change...
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    You can't. It might work nonetheless, but stay away from using the datalog viewer and especially don't use its undo function for at least 30 days.

    The database contains the history of config changes, and you altered that history with your method.
     
  10. craig baker

    craig baker Member HowtoForge Supporter

    I could mysql reimport the originalsql file and then do the dns_rr.
    whats the phpmyadmin command again? dont want to get it wrong!
    than resync again. BOTH dns and websites? thought it was just DNS.
    I think all my websites have * for the IP4 config.
    or is it too late? just did this a few mins ago.
    also - does the Also Notify field take care of updating the backup dns records?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    I would import the old database again and then change it with phpmyadmin. The SQL command to change the IP in DNS records is:

    UPDATE dns_rr SET data = 'newip' WHERE data = 'oldip';

    replace newip and oldip in the above query with the correct IP addresses. Before you resync, check in ispconfig UI in DNS module that the new IP shows up there in the DNS records. Then resync just dns.

    If your backup DNS server obeys these notifications, then it should work as the ersync increases the serial.
     
  12. craig baker

    craig baker Member HowtoForge Supporter

    by your command it is done.
    might I suggest a mini-guide on changing static ips???

    I got the mysqldump and sed commands from someone saying how to perform this change in ispconfig.
    clearly he is unaware of the datalog viewer aspect. come to think of it, so am I :)
     
  13. craig baker

    craig baker Member HowtoForge Supporter

    ok cleaning up a bit more. I notice some of my Allow transfer fields are wrong and reference a dead ip address. I want to change:
    UPDATE dns_rr SET data ='35.169.39.140' WHERE data = '216.117.186.93,35.169.39.140'
    (216.117 is the dead ip) but this is clearly the wrong table.
    and I notice on some zones I have NO allow transfer entry - how can I set ALL of them to be 35.169.39.140? even if nothing is entered currently?
    and some have Also notify to the dead address those should be cleared.
    any nice phpmyadmin commands for me o Great Till? <bows down>
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    The transfer field is in the dns_soa table. Example:

    UPDATE dns_soa SET xfer = 'newip' WHERE xfer = 'oldip';
     
  15. craig baker

    craig baker Member HowtoForge Supporter

    How about the also notify line?
    If current line is blank do we use '' (double single quote ')or Null as old ip?
     
  16. craig baker

    craig baker Member HowtoForge Supporter

    the double singlequote seemed to do the trick :)
    and I found also_notify in same table :) thanks Till!
     
    Last edited: Feb 21, 2023

Share This Page