Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multiple Publc IPs

Posted on 2009-04-09
8
Medium Priority
?
195 Views
Last Modified: 2013-12-16
Hi,

My server is having two interfaces eth0 and eth0:1 having different public IPs.

I have two websites under different virtual hosts on different ports 80 and 8080

Both the websites are designed to download contents from different servers which are firewalled . We cannot just use any IP to fetch data because  we need to log the requests for each IP and we also do not want this to mix.

I want that when sites on port 80 fetches data, it gives the public IP A to the other server and site on port 8080 gives public IP B

In my mind iptables NAT is coming but I am not sure what to really use and also I am not clear what options to use.


0
Comment
Question by:mdswireless
  • 4
  • 3
8 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 24114470
> Both the websites are designed to download contents from different servers which are firewalled
You mean some php/cgi-like script is connecting to another webserver acting proxy-like?

If so, then there's nothing You can do - unless You are able to change this php/cgi script and force it to somehow mark it's connections.

Or maybe the cgi/php should act like proxy, setting the Via http header variable - then You could distinguish the traffic based on that variable?
0
 
LVL 14

Expert Comment

by:cjl7
ID: 24127191
DNAT/SNAT is what you are looking for,

http://linux-ip.net/html/nat-dnat.html


is a good place to start.

//jonas

0
 

Author Comment

by:mdswireless
ID: 24129381
Ok, but how to use DNAT based on network interface
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 43

Expert Comment

by:ravenpl
ID: 24129651
Why haven't You answered my questions? If You need this proxy-like app, then NAT no use here, the proxy looses the information about incoming interface(at least kernel cannot match the incoming and outgoing connections as one)
0
 

Author Comment

by:mdswireless
ID: 24129682
No , You cannot say that its kind of proxy, Its a cgi script which automatically fetches data from a remote server on execution.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 24129815
Well, then unless the script is "co-operating", You cannot match those two connections to route the second one.
Can You develop the script? The script could bind it's outgoing socket to given IP, it could mark packets, it could connect to localhost proxy which would route the connection, etc.
0
 

Author Comment

by:mdswireless
ID: 24129855
But, its a same script running twice on different ports and do not have anything to with each other.

So there is no way to use different public IPS using different ports ?

The script is simple bash script, running as CGI, which function can I use to bind public IP like this
0
 
LVL 43

Accepted Solution

by:
ravenpl earned 2000 total points
ID: 24129966
> But, its a same script running twice on different ports and do not have anything to with each other.
But it knows on which port it's running(cgi or env variables)

> The script is simple bash script, running as CGI, which function can I use to bind public IP like this
Hmm, I understand. The bash script has to use some next client to download the data from firewalled servers - what it is? Curl, wget?
Both can set various http headers, which can be used to distinguish the traffic on the server side.
Curl has this --local-port option, which can be usefull(but not bulletproof) for traffic routing.

Or maybe it's the script who should log the traffic-by-ip?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month6 days, 15 hours left to enroll

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question