LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-20-2009, 06:21 AM   #1
linuxcroco
LQ Newbie
 
Registered: May 2009
Posts: 10

Rep: Reputation: 0
Multiple ips on server configuration issue


Hello,

First, thank you for taking the time and having the patience to look over my issue.

I am running a dedicated server with CentOS v5 and Plesk control panel, Apache as web server. I have one network interface card and 12 ip addresses.

One of these IP addresses is setup as the primary ip address of the server.
Each IP address is set up to serve one individual domain. ( I have 12 domain names ).

I am using different PHP scripts to request data from external APIs for 2 of these 12 websites that I have.

It seems that all my calls register as if they are made from the "Main IP address" of the server: It does not matter if I run "domain10.com/script.php" or "domain01.com/script2.php", I still register at the external API as "Main server IP".

Any help on the issue is most welcomed.

Thank you.

Linuxcroco
 
Old 10-20-2009, 07:24 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
On the host where you're initiating the script:

route add -host <destination hostname or IP> <interface>

e.g. If your destination hostname is domain10 and the interface and the interface on your local host that you want to use is eth3:

route add -host domain10 eth3

Or if your interface is an alias IP like eth0:7:

route add -host domain10 eth0:7

On doing a test just now with ssh that worked to force the traffic over my eth0:10. (Oddly enough though when I ran a netstat -r it just indicated my destination host was going to the default gateway which is the one eth0 has assigned.)

Last edited by MensaWater; 10-20-2009 at 07:26 AM.
 
Old 10-21-2009, 02:32 AM   #3
linuxcroco
LQ Newbie
 
Registered: May 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Hi jlightner,


Thanks for your help. I tried your solution, but it still registers as though the "main server IP" requests the content.

My test setup:
PHP Code:
<?php
$fp
=fopen("/tmp.txt","w");
fwrite($fp,file_get_contents('http://www.whatismyip.com/'));
fclose($fp); ?>
I'm running this script from domain1.com for which I've run the "route add" command.

Any ideas ? Thanks.

Linuxcroco
 
Old 10-21-2009, 09:03 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
It may be that all your outbound traffic is configured to go over a single IP in your network infrastructure. We do that here. No matter what server/workstation you initiate connection from to the outside it will be seen as a single IP via NAT in our firewall devices.

Since you're using outside service to determine your IP this may be the case for you as well. If you have 12 separate IPs from your ISP and those are what you configured it may not be but it may be you'd need to setup some special networking (e.g. via NAT in iptables) but I couldn't really help you with that as the the configuration we use here is handled by our Networking team on firewall devices rather than in iptables.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need help regarding configuration of multiple ssl in one apache server ashishshukla Linux - Server 2 04-09-2009 06:35 AM
Getting things straight: Apache, SSL, Multiple External IPs / Internal IPs robin.com.au Linux - Server 21 10-13-2007 11:39 PM
Multiple Mysql Server issue on Linux rajnair0278 Linux - Software 2 11-08-2006 05:04 AM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 10:06 AM
multiple ips, multiple gateways, one interface drpixel Linux - Networking 6 12-04-2002 12:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration