1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

how to use real ip

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by canu, Jul 29, 2011.

  1. canu

    canu Guest

    0
     
    I am using Plesk 9.5. I have two Ip addresses and two sites like that

    domain1.com on 1.1.1.1 (default ip)
    domain2.com on 1.1.1.2

    I am developing 3d payment system and the bank says that i have to use 1.1.1.2 sending http and curl requests but it is using default ip 1.1.1.1. when i ping domain2 it returns 1.1.1.2. All records says that sites ip address is 1.1.1.2 but it uses 1.1.1.1 to send all request from site.

    how can resolve that problem
     
    Last edited by a moderator: Jul 29, 2011
  2. Faris Raouf

    Faris Raouf Silver Pleskian Plesk Guru

    31
    30%
    Joined:
    Mar 15, 2009
    Messages:
    667
    Likes Received:
    17
    Basically, when your server connects to the outside world, it uses the first IP address allocated to eth0 (or it might be the last -- I can't remember, but it doesn't matter because you only have two IPs). DNS has no effect on this at all.

    In order to change from 1.1.1.1 to 1.1.1.2 as being the IP used, you will need to edit your network config.

    How to do this depends on your OS:

    In Centos/Redhat types, look in /etc/sysconfig/network-scripts
    You'll probably see ifcfg-eth0:0 and ifcfg-eth0:1

    If you look at each file, you'll see that 1.1.1.1 is specified in one, and 1.1.1.2 is specified in the other.

    All you have to do is change the IPs around in these files.

    You will then need to restart networking (or reboot server).

    Important: Note that when sending email, the other IP will now also be used for that too, and receiving mailservers will do a reverse lookup on that IP to find the hostname.

    PLEASE be careful though, as an error can screw things up completely. Check your firewall. Check everything to make sure this change will have minimal impact.

    Make sure you have a plan in place to revert to the original settings (using a boot CD or something) if something goes terribly wrong and the system loses its network capabilities. Backup the whole server too, just in case. Be careful!


    Faris.
     
  3. canu

    canu Guest

    0
     
    Thanks for your reply and solution Faris.

    Your solition works if i have only 2 ips. But this was an example. I have 6 sites and ip addresses like that. I really wonder that is a normal server behaviour. I googled it but i havent found any problem like that.

    I think it can be solved with apaches mod_proxy extension. But I really want to learn plesk and apaches behaviour in this stuation. If it normal is there any configuration that i can apply to Centos 5.3 or Plesk 9.5

    Thanks Again
     
  4. Faris Raouf

    Faris Raouf Silver Pleskian Plesk Guru

    31
    30%
    Joined:
    Mar 15, 2009
    Messages:
    667
    Likes Received:
    17
    It is normal, I'm afraid. I'm not aware of any flavour of Linux where the situation is different.

    You can still swap the IPs around even if you have 100IPs -- it is just that the outgoing connection will always be from one particular IP (the first or last -- like I say -- I'm afraid I've forgotten which way raound it is).

    But if you have lots of sites, all with static IPs and all of which need to communicate with the bank from their own IPs then this is a big problem!

    HOWEVER, I did a quick google search and found a thread on this very subject (nothing to do with Plesk, but since this is a generic issue it makes no difference).

    The suggestion was basically to specify the IP address you want when calling the program. For example:

    wget --bind-address=1.1.1.2 bank-ip-address

    You can also use PHP for some low-level stuff, specifying the IP you want.

    $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    socket_bind($sock, $sourceip);


    The full thread can be found here:

    http://www.webhostingtalk.com/showthread.php?t=687545


    Faris.
     
  5. canu

    canu Guest

    0
     
    thanks, i understood that is normal..
     
Loading...