problem in sending data with second ip

LAZer

Well-Known Member
Jan 18, 2010
78
2
58
at net :D
Hi , my server (vps ) had a main ip of 15, then because of a change I had to change the main ip of the vps to 106.
then after changing the license and having the ping of this new ip , I did service network restart , and service ipaliases restart.
cpanel added the old ip to the network and the ping of the old IP returned and websites on the old ip started functioning.

now I have a problem with bank gateways, I have some bank gatewats on the old IP , and it seems that server is using the new IP to send the invoice form data to the bank gateway.
in cpanel user host , the old ip is shown for shared IP and it seems to be ok.
also in phpinfo on that domains/hosts , the SERVER_ADDR , is showing as the old IP as I need. but why is it sending the data to bank gateways from main server ip and not the old ip?

should I add any specific route or something for example to have the output data from this site to the bankgatwway using the old ip?
 

LAZer

Well-Known Member
Jan 18, 2010
78
2
58
at net :D
Hi , I found the solution in this link :
by default cpanel adds the second ip with subinterfaces which is a method of adding additional IP addresses.
eth0:cp1 , and to change the outbound default ip I used this tutorial :
http://www.anova.be/blog/controlling-which-outbound-ip-use

from console I executed this commands :
ip route del default
ip route add dev eth0 default <gateway ip 254> src <old ip 15>
so now for outbound instead of having default new main ip 106 , I have the old 15.

and then continued the tutorial to make this default ip changing permanent. :) thanks to the writer of that gr8 tutorial "Joris".
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Hello :)

I'm happy to see you were able to find a suitable solution. Thank you for updating us with the outcome.