The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing Server IP

Discussion in 'General Discussion' started by paulredpath, Aug 5, 2003.

  1. paulredpath

    paulredpath Member
    PartnerNOC

    Joined:
    Feb 6, 2003
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    We have recently been allocated our own IP range and have to move off the old one.

    I am wondering if anyone could give me a step by step guide to changing the IP of our cpanel server.

    Ideally i would like to keep the old IP's on the server as well so the changeover is as seamless as possible. So say the dns servers would still answer on the old IP's but give the new ip for teh sites who would answer on that new IP.

    Any help would be much appriciated.

    cPanel.net Support Ticket Number:
     
  2. bert

    bert Well-Known Member

    Joined:
    Aug 21, 2001
    Messages:
    602
    Likes Received:
    0
    Trophy Points:
    16
    That's definitely not possible unless you're running dual Ethernet interfaces and even then, it would be lots of work and not practical in any way.

    I would just decrease the refresh interval on your DNS zones to 1800 seconds three to five days prior to the IP address change, then I would change IPs on the box in the middle of the night (2 to 3 AM EDT). This will ensure that propagation will be rather quick, you shouldn't experience more than a couple of hours of downtime (if that). Of course, some DNS servers might cache zones longer, but most of them should pick up the changes in just under an hour.

    As far as a step-by-step IP address change procedure, there is really nothing to it. If you don't want to use ifconfig commands, simply modify the following files accordingly:

    /etc/sysconfig/network-scripts/ifcfg-eth0
    /etc/sysconfig/network
    /etc/wwwacct.conf
    /etc/ips
    /etc/domainips
    /etc/httpd/conf/httpd.conf
    /etc/proftpd.conf
    /etc/named.conf
    /var/named/*.db

    Once you're done modifying the files, reboot your machine and you should be good to go :)

    cPanel.net Support Ticket Number:
     
  3. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    can u explain what you really want to do ??


    Do you want to change your main server ip ?


    Do you want to move domains to use a different ip ??
    : User WHM feature to change ip of existing sites to assign them a new ip.

    Do you want to add new nameservers and use them for setup as well for new domains ??
    : Inside WHM, edit setup, add the new dns servers below your existing ones. Now all 3-4 (how many you have setup) will be used to setup all domains and reflect in their zonefiles.

    Chage existing nameserver's ip's ??
    : Well you can place a request at the registrar where your nameserver domain is registered from and change the ips there. Meanwhile you can also edit your zone files of existing nameservers and change ips inside that (i recommend to use WHM for this). Please remember the namserver ip changes make take some time to propogate / available everywhere (don't think the new changes are reflected everywhere instantenously)

    cPanel.net Support Ticket Number:
     
  4. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Re: Re: Changing Server IP

    heheh while i was typing my post, bert wrote the above, i say much better explanation than mine. :p

    There is a hell of work to do paulredpath, be ready.

    cPanel.net Support Ticket Number:
     
  5. bert

    bert Well-Known Member

    Joined:
    Aug 21, 2001
    Messages:
    602
    Likes Received:
    0
    Trophy Points:
    16
    I guess we wrote at the same time :D

    One more file I missed:
    /etc/hosts

    Also, as anand explained you should change the IP addresses associated with your DNS servers at your registrar. If both DNS hosts are within the same server, you should change one of them first and then after you are finished renumbering the machine you should change the other one.

    cPanel.net Support Ticket Number:
     
  6. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Re: Re: Re: Changing Server IP

    Not entirely true. It's about 2 minutes of using the replace command & time for a reboot to complete.

    cPanel.net Support Ticket Number:
     
  7. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Correct. I am sorry i was wrong, you should only change one ip first and then change the another one. This will give you minimum downtime.

    cPanel.net Support Ticket Number:
     
  8. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Re: Re: Re: Re: Changing Server IP

    Not if you have hundreds of ips to change. From the post i can't make out how many ips are to changed at present. If paulredpath uses shared ip for hosting then its easy, but with dedicated ips it would be a pain. I know i did this on one box of mine with 600 customers and all on dedicated ips. I had to change manually all of them. And hence the reason of my comment:

    cPanel.net Support Ticket Number:
     
  9. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Re: Re: Re: Re: Re: Changing Server IP

    As long as you are swapping a /24 with a /24 or whatever (/23 w/ /23), you should be fine. replace 111.111.111. 222.222.222. -- /path/to/httpd.conf

    and then repeat for the other netblock.

    cPanel.net Support Ticket Number:
     
  10. paulredpath

    paulredpath Member
    PartnerNOC

    Joined:
    Feb 6, 2003
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Is there anyone who would be interested in doing this as tbh im going to be a bit lost. Just email me your price - paul@catalyst2.com

    One question, if i add extra nameservers now on the new IP's will the domains already setup be on the new and old dns servers?

    cPanel.net Support Ticket Number:
     
  11. paulredpath

    paulredpath Member
    PartnerNOC

    Joined:
    Feb 6, 2003
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    If anyone is still following this thread I have a quick question, on previous Redhat boxes I have had issues with the default gateway being different to what I had set it to after the reboot Obviously this leaves the machine relitavely inaccessible. If I am doing this remotely then there is a problem. Have you experienced the same problems, and if so do you know any way around them?

    cPanel.net Support Ticket Number:
     
  12. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Please explain what are you actually planning to do.

    cPanel.net Support Ticket Number:
     
  13. WeMasterz5

    WeMasterz5 Well-Known Member

    Joined:
    Feb 24, 2003
    Messages:
    361
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Miami
    how would this be done

    root@host1 [/]# ifconfig
    eth0 Link encap:Ethernet HWaddr 00:E0:81:20:9C:F8
    inet addr:xxx.xxx.xx.101 Bcast:xxx.xxx.xx.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:14097529 errors:0 dropped:0 overruns:0 frame:0
    TX packets:2723977 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:2146629797 (2047.1 Mb) TX bytes:1053709694 (1004.8 Mb)
    Interrupt:20 Base address:0x5000

    eth0:1 Link encap:Ethernet HWaddr 00:E0:81:20:9C:F8
    inet addr:xxx.xxx.xx.102 Bcast:xxx.xxx.xx.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    Interrupt:20 Base address:0x5000


    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:969158 errors:0 dropped:0 overruns:0 frame:0
    TX packets:969158 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:293935341 (280.3 Mb) TX bytes:293935341 (280.3 Mb)





    right now a test box just has the eth0, out isp tells us they can only to one to one ipmapping, so how is the above done to give the box 2 ips

    cPanel.net Support Ticket Number:
     
  14. bert

    bert Well-Known Member

    Joined:
    Aug 21, 2001
    Messages:
    602
    Likes Received:
    0
    Trophy Points:
    16
    If you're not comfortable with the route command, simply type "setup" (without the quotes) and then select "network" from the menu. This will allow you to change the IP, the mask and the gateway for eth0.

    cPanel.net Support Ticket Number:
     
  15. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Actually I just did this and it worked out great..

    The only issue is how do I change all the accounts i.p.'s the main shared i.p.?

    There is about 300 accounts that need to be changed and 1 by 1 would take a while. There has to be a easier way.

    Also I noticed even with using the #setup command by root you have to change the set up i.p. in cpanel and in the hosts file. just for the record...

    cPanel.net Support Ticket Number:
     
  16. Christleo

    Christleo Well-Known Member

    Joined:
    Mar 13, 2003
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    Wow... if you have over 300 clients, it's crazy to change all the IP!! any other alternative?
     
  17. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    So far you still have to do it manually 1 by 1 unless you know how to make custom script to do them all some how.

    Hopefully some else will know more about it.

    :)
     
  18. bert

    bert Well-Known Member

    Joined:
    Aug 21, 2001
    Messages:
    602
    Likes Received:
    0
    Trophy Points:
    16
    You can just open the files with vi and do a search and replace:

    :%s,original-text,new-text,g
     
  19. rsaylor

    rsaylor Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    160
    Likes Received:
    1
    Trophy Points:
    18
    I am kinda in the middle of this but to update your zone files at once run this:

    Code:
    cd /var/named
    perl -pi -e 's/the_old_ip/the_new_ip/' *
    
     
Loading...

Share This Page