How to change server's IP

From Kolmisoft Wiki
Revision as of 07:37, 8 April 2010 by Admin (talk | contribs)
Jump to navigationJump to search

The basic files which should be changed:

  • /etc/asterisk/h323.conf
  • /etc/asterisk/sip.conf
  • /home/mor/config/environment.rb


In /etc/asterisk/h323.conf change bindaddr variable:

bindaddr = YOUR NEW IP

In /etc/asterisk/sip.conf bindaddr and realm

bindaddr = YOUR NEW IP
realm = YOUR NEW IP

Then restart asterisk:

/usr/src/mor/sh_scripts/asterisk_nice_restart.sh


In /home/mor/config/environment.rb change:

Recordings_Folder = "http://YOUR NEW IP/billing/recordings/"
Web_URL = "http://YOUR NEW IP"


Then restart HTTP server:

/etc/init.d/httpd restart

For MOR users who uses more than 1 MOR PRO billing server

If server is Asterisk server and GUI on another server - in GUI's menu: Billing - Asterisk Servers change Hostname and Server IP variables there.
Then open file /etc/asterisk/manager.conf and add the permit=YOUR GUI IP/NETMASK

By default it looks something like this:

[mor]
secret = morsecret
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config

After the change it should look something like that:

[mor]
secret = morsecret
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
permit=123.123.123.123/255.255.255.0 ; This is just an example! permit=YOUR GUI IP/NETMASK
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config
  • If Replication?

Lets say you have servers A and B, and you want to give new ip to server B . Login to MySQL in both servers as root, then stop replication link in server A:

mysql> START SLAVE;

In server A run:

mysql>CHANGE MASTER TO MASTER_HOST='New IP of server B', MASTER_USER='replication_user', MASTER_PASSWORD='replication_pass', MASTER_LOG_FILE='BINLOG', MASTER_LOG_POS=NEW_POSITION;  

An example how it might look (DO NOT USE THIS LINE FOR YOUR SERVER):

CHANGE MASTER TO MASTER_HOST='111.111.111.111', MASTER_USER='rep2', MASTER_PASSWORD='rep2', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=98; 

Then restart replication link:

mysql> START SLAVE;

Check if everything is fine by checking running:

mysql> SHOW SLAVE STATUS\G;

You should see:

Slave_IO_State: Waiting for master to send event
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
  • If Heartbeat?

If you want to change shared ip (also known as virtual IP), you have to stop HeartBeat first (in both servers):

/etc/init.d/heartbeat stop

Then edit /etc/ha.d/haresources file, you will see something like that (in both servers):

MASTER OLD IP asterisk

You need to enter new ip there and start heartbeat again (in both servers):

/etc/init.d/heartbeat start
  • What else?