I have linux box which has two network interface, eth0, eth1. from eth1 I can access an internal website, say under port 8080. from outside the box, I can't access that network. my question is, is there a way I set up something so from outside the box, there appears to be a web server running in port 8080 and when I connect to it, it automatically forwards to eht1 the internal site? I tried to enable ip forward and add a static route, but it doesn't work. thanks.
migrated from stackoverflow.com Mar 24 '10 at 7:34
This question came from our site for professional and enthusiast programmers.
Is this box routing the traffic between those interfaces? From what you wrote I assume that on eth0 there is a public network connected to the Internet, while there is a private local network on eth1.
If thats the setup and you want to access webserver on local network from the Internet you have to use Network Address Translation (NAT).
Basicly you need to figure an external IP address on the "outside" interface and add iptables rule:
X.X.X.X is the external address while Y.Y.Y.Y is the internal one running webserver. In that scenario you also have to make sure you are allowing the traffic in the forward chain:
Your box has to have forwarding enabled for this:
Not sure if thats answer your question, but gave very little details in you question.