Solved

Multiple Publc IPs

Posted on 2009-04-09
8
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

691 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