• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Change & remove server IP address

R

ramfade

Guest
I have to change the IP of my server as per my hosting provider.

I can't get rid of the old IP address!

I've found some posts on this subject and here is what I've done:

I used /usr/local/psa/bin/reconfigurator.pl map_file to change the IP address of the server. It added the new address, moved the domains over to it, but did not remove the old address. In Plesk it shows both IPs, and I can't remove the old one - the delete check box is disabled.

I tried "/usr/local/psa/admin/bin/websrvmng --remove-ip-address --ip-address=1.2.3.4" but it didn't seem to do anything, even after rebooting.

I deleted the map_file and reran reconfigurator. The file it created had two IP's bound to eth0. So I deleted the old one and ran it again - but it reported there was nothing to do.

I can login on the new ip with Plesk and ssh, pop mail is working. (Webmail doesn't work, but I can wait for DNS to propagate for that. That's not an issue, assuming it will correct itself over time.)

It's a name server and it resolves the new IP correctly - although I don't use Plesk to manage DNS. From another server I use "dig @ns2.domain.com ns2.domain.com", with ns2.domain.com being the server in question.

I think the only thing I should worry about is removing the old IP completely - any ideas?
 
Removing an IP is a tough task and needs some manual work.

First of all you should be sure that the IP is no longer connected to any of your domains or clients:

go to server => IP Addresses. The IP in question should display 0 for hostings and clients.

If that's not the case please change first all hostings containing the old IP number and remove that IP from all clients IP pools.

When all this is done make sure the IP is also no longer in you linux configuration, otherwise Plesk will find it and add it again...

Finally remove the IP from the database with the following command:

echo "DELETE FROM IP_Addresses WHERE ip_address='xxx.xxx.xxx.xxx'" | mysql -u admin -p`cat /etc/psa/.psa.shadow` psa

ATTENTION: This command changes the psa database manually. This is very dangerous and can give you additional problems.

For me this worked perfect.
 
Thanks CoKo!

I have verified there are no domains using the old IP. I'm comfortable with making manual changes to the DB, but I can't find where in Linux to make the changes, I thought it was all done by Plesk.

It's Fedora 3, if anyone can help.
 
Please make also sure that the IP is no longer in any of the clients IP pools.

The linux command to remove the IP from the DB is:

echo "DELETE FROM IP_Addresses WHERE ip_address='xxx.xxx.xxx.xxx'" | mysql -u admin -p`cat /etc/psa/.psa.shadow` psa

where xxx.xxx.xxx.xxx is the IP number you want to remove. This is the same on all linux distributions.

As far as I know there is no other way...
 
Don't forget about making sure the IP has been deleted from the Linux OS itself (like in /etc/sysconfig/network-scripts or wherever your distro keeps the info)

Once that is done, then you can have Plesk re-read the *current* system IPs
 
Thanks ShadowMan - I'll probably remove the old IP tonight or tomorrow - waiting for DNS to propagate the new one first. Then I'll have to dig around a little to make sure I remove the old one completely. It's RedHat FC3, if you have any suggestions.

I've changed the gateway, but ifconfig doesn't show what gateway the server is using. Is there a way to confirm this if the gateway won't reply to a ping?
 
If you cat the ifcfg-ethx files they will show the gateway IP that is set:
]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=xx.yy.zz.aa
IPADDR=xx.yy.zz.bb
NETMASK=255.255.255.0
NETWORK=xx.yy.zz.cc
ONBOOT=yes
USERCTL=yes
PEERDNS=yes
GATEWAY=xx.yy.zz.gw
TYPE=Ethernet

If you still cannot ping the gateway, then there is something else needs fixing somewhere. Verify the GW IP ?

Is there only a single NIC ? or do you have multiples?
 
Thanks to you both for helping me on this! I just got back to it after getting tied up with other projects.

I don't know what I was thinking, the gateway replys fine to a ping.

Anyway, here's what I just finished doing:

1) I had added the new IP using the control panel a few days ago, so I verified that all domains and clients were on the new IP.
I found the gateway IP was actually in /etc/sysconfig/network and changed it there.
At this point I rebooted and I could log in using the new IP.

I made all changes in DNS also.

But ifconfig still showed both IP's bound to the nic, and the control panel still showed both IP's under Server > IP Addresses.

2) Today I found (thanks to ShadowMan!) ifcfg-eth0 and ifcfg-eth0:1 in /etc/sysconfig/network-scripts. So I made the changes in ifcfg-eth0 and deleted ifcfg-eth0:1. Apparently the :1 file was created by Plesk during step one above.

3) Then I deleted the old IP address record from the PSA database - thanks to CoKo for that one! At this point I went into the control panel and found only the new IP under Server > IP Addresses. Also verified it had the correct number of clients/domains bound to it.

4) Then I crossed my fingers and rebooted the server - and it looks like it worked! IFCONFIG shows only the new IP bound to eth0 (there is only one nic). Mail is working and of course I can log in.

5) Maybe the final test will be when my provider stops routing for the old IP in a week or two, but I think I'm good to go!

Thanks again guys for all your help!
 
Back
Top