HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   CentOS 6.3 - Change From Single Private IP To Multiple Public IP Block (http://www.howtoforge.com/forums/showthread.php?t=60551)

Unfaiir 13th February 2013 20:22

CentOS 6.3 - Change From Single Private IP To Multiple Public IP Block
 
I'm using CentOS 6.3 and ISPConfig 3 and have been up and running on this particular server for several months.

Currently I use a single private IP: 192.168.2.xxx

I just bought a new block of 3 public IPs from my ISP: xxx.xxx.xxx.[xx0-xx2]

I've been scouring the forums trying to find out the best way to go about doing this and can only find vague details here and not necessarily for CentOS, so I'm going to create this thread both for asking questions on the right way to do this in ISPConfig, and also I will summarize it up for everyone (including myself for later) as an update to this initial post.

Note: I used 3 IPs, but this information is relevant to any type of IP change.

Here is what I have so far (Note: you can use system-config-network if you want, but I personally find it much easier to do manually. Also, system-config-network doesn't have a delete feature, so you'll have to do it manually anyway if you're consolidating IPs rather adding IPs):

Part I: Server IP Config
********************
1.) Add a new line in /etc/hosts for each new IP address with the same server name as the current IP
Code:

vi /etc/hosts
2.) Update your nameservers:
Code:

vi /etc/resolv.conf
2.) Copy the network interface config for your network card into 2 alias network interface config files, starting with
Code:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1

3.) Open all 3 network interface files and update the IP addresses, network masks, and gateways to the new ones:
Code:

vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
vi /etc/sysconfig/network-scripts/ifcfg-eth0:1

4.) Restart the network service:
Code:

service network restart
5.) Verify that everything is up and running
Code:

ifconfig | more
Part II: Service IP Config (UPDATE: You can skip to the bottom for Part II if you don't care about the details)
************************************************** **********************************

This is where I'm a bit stuck. What all needs to be updated now? From this post I found (http://www.howtoforge.com/forums/showthread.php?t=26737) These seem to be the next steps to take:

Quote:

Change the IP in /root/ispconfig/httpd/conf/httpd.conf
Change the IP in /etc/postfix/main.cf
Change the IP in /etc/proftpd.conf
Change the IP in the includes too
Change the IP through ISPConfig interface
Re-save the hosted sites with the new IP
So, I have some questions though and I hope that someone will have some answers:

1.) In CentOS there is no /root/ispconfig/httpd/conf/httpd.conf. Is this just the normal Apache httpd.conf file that is located in /etc/httpd/conf/httpd.conf or is this a separate file that needs to be modified?

2.) my /etc/httpd/conf/httpd.conf, /etc/postfix/main.cf and my /etc/pure-ftpd/pure-ftpd.conf (the CentOS guide doesn't use proftpd) don't have IP addresses in them, so I'm guessing this can be skipped in my case?

3.) Pure FTP doesn't seem to have includes to change. Is that a Pro FTP only thing?

4.) Changing the IP through the ISPConfig 3 interface is a little confusing too. I've added the IPs using System->Server IP Addresses but what do I do about System->Server Config->server1.mydomain.com? There is only room for one IP here, which IP do I use?

Additonally, the gateway and dns server IPs are not the one's I setup in the system... ever... They say:

Gateway: 192.168.0.1
Nameservers: 192.168.0.1,192.168.0.2


So what do i do about these? Do I leave them alone? Do I change them to the Gateway & Nameservers for my new IP Block?

Can someone please shed some light on these 4 questions? I'm really confused and I would prefer not to break anything if I don't have to.

UPDATE:
*********

I did a bit of testing and a lot of waiting (For DNS cache to clear), but finally all sites are back up and using the new IP Block. First I'll answer my own questions from above, and then I'll write out the steps for Part II.

1.) In CentOS there is no /root/ispconfig/httpd/conf/httpd.conf so I checked /etc/httpd/conf/httpd.conf but there was no IPs listed so I left it alone.

2.) I checked all of these configuration files but there were no IPs listed so I left them alone too.

3.) The "be sure to modify the includes too" doesn't apply to PureFTP apparently, just ProFTP so I skipped this step as well

4.) This took some testing. I used the main IP from eth0 here and not any of the aliases. I then filled in the netmask, gateway, and nameservers from eth0 here as well but then nothing was loading so I put the netmask, gateway and name servers back to what they were but left the new IP, though looking back, it may have been just the DNS cache hadn't cleared for my sites yet.

So in conclusion, here are the steps I for completing the IP change and/or adding multiple IPs:

Part II: Service IP Config
**************************

1.) Check your config files for anywhere that the old IP may be hanging around, though I followed the Perfect Server Guide for CentOS 6.3 and I didn't have to edit any of these. You should still check to be sure though:

Code:

vi /etc/httpd/conf/httpd.conf
vi /etc/postfix/main.cf
vi /etc/pure-ftpd/pure-ftpd.conf

2.) Log into ISPConfig and update your IP list with all of the new IPs and also your server IP using the main IP from eth0:

System->Server IP Addresses - ALL IPs
System->Server Config->server1.mydomain.com - ONLY set the MAIN IP (whatever you used in eth0)
(NOTE: I'm not sure if you can set the netmask, gateway, or nameservers on teh System->Server Config->server1.mydomain.com form or not, it didn't seem to be working so I changed it back except for the new IP. This could have just been because I hadn't written step 5 yet...)

3.) Open your sites one by one in ISPConfig and then save them. (Note: I also opened each of my alias domains and saved those, but I don't think that was required)

4.) Update your nameservers. I use external nameservers still, so I changed the zone files there to point to my new IPs for all of my sites.

5.) BE PATIENT! I was questioning whether what I did actually worked, but I was able to login to ISPConfig interface using any of the IP's. Slowly the sites began to work over the next 4 hours. It may have been 2-3 hours for me, I spent the last two watching American Idol and the beginning of Green Lantern so I don't know exactly, but after 4 hours they were definitely all back up. I'm pretty sure it can be up to 48 hours sometimes, so I guess I'm lucky here that it was only 2-4 hours.

I hope you've all enjoyed my tale of how the little IP grew up to become a big block of 3 IP's and that you found at least one thing in here helpful somehow or other. :cool:

till 14th February 2013 09:27

Quote:

1.) In CentOS there is no /root/ispconfig/httpd/conf/httpd.conf. Is this just the normal Apache httpd.conf file that is located in /etc/httpd/conf/httpd.conf or is this a separate file that needs to be modified?
This file you refer to here is from a different controlpanel (ispconfig 2) and not ispconfig 3. So the guide you followed is not related to the configuration and system of your server.

Quote:

2.) my /etc/httpd/conf/httpd.conf, /etc/postfix/main.cf and my /etc/pure-ftpd/pure-ftpd.conf (the CentOS guide doesn't use proftpd) don't have IP addresses in them, so I'm guessing this can be skipped in my case?
I guess you use some wrong info again as a ispconfig 3 server never uses proftpd. So if you found some info that refers to proftpd, then this info can not be for a ispconfig 3 server.

Quote:

3.) Pure FTP doesn't seem to have includes to change. Is that a Pro FTP only thing?
Thats right. The IP is not set in pure-ftpd

Quote:

4.) Changing the IP through the ISPConfig 3 interface is a little confusing too. I've added the IPs using System->Server IP Addresses but what do I do about System->Server Config->server1.mydomain.com? There is only room for one IP here, which IP do I use?
The change in ispconfig is straight forward, just add one IP after another under System > server IP. Thats all.

You dont have to set the gateway or nameservers of the additional IP block.

Unfaiir 14th February 2013 10:00

Thanks Till!

You posted this just as I was adding my update to my original post.

The information I was referring to was from: http://www.howtoforge.com/forums/showthread.php?t=26737

I now see this is indeed ISPConfig 2 steps, but the same basic principals applied.

One question though. You wrote:
Quote:

The change in ispconfig is straight forward, just add one IP after another under System > server IP. Thats all.

You dont have to set the gateway or nameservers of the additional IP block.
What about the IP in System->Server Config->server1.mydomain.com ?
Does that need to be updated too? I noticed that before I changed IPs it had my old IP, so I put the new main IP there from eth0 and left the rest alone and it is working for me. Are you saying that even the IP here doesn't need to be changed?

Also, you do still have to go through the sites in ISPConfig 3 one by one and re-save each one after changing the IPs correct?

till 14th February 2013 10:18

Quote:

What about the IP in System->Server Config->server1.mydomain.com ?
Thats the main IP of the server. If your new subnet is a additional subnet, then you dont have to update it. If the old IP does not exist anymore, then you put the first IP address of your subnet there and the additional IP's under System > Server IP.

Quote:

Also, you do still have to go through the sites in ISPConfig 3 one by one and re-save each one after changing the IPs correct?
yes.


All times are GMT +2. The time now is 16:19.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.