Private/Local Network
Using NAT, DNS and a single public IP address on the gateway, what is the simplest way to have multiple machines on the same private network accepting requests to the same port? (e.g. running multiple web servers, all answering port 80, each accessible from the public address).
4 machine example: banana.example.com (gateway - public address) http://apple.example.com (private address) http://orange.example.com (private address) http://grape.example.com (private address) Thanks in advance. |
private network
All the machines on the private network should only answer when their specific hostname is called. You need to add the hostnames and their respective ip addresses into the hosts file located in the /etc directory.
|
We have names running on the gateway but I'm assuming that since all the addresses are private, we must use port forwarding on a port-by-port basis.
Are you suggesting using the hosts file instead without portforwarding? Can you provide any more details? |
dugas, i think what whohasit is wanting is:
if an external client attempts to connect to {apple,orange,grape}.example.com they will all three hit port 80 on the router/firewall/gateway, based on the destination (apple,orange,grape) the rtr/fw/gw will forward the request on to the correct (internal) system whohasit, i believe you can do this if dns resolves correctly so that banana knows what the internal ip to use for apple/orange/grape using iptables. i do not have a setup that i can test so it will just need to be attempted. i believe it would look something like this... assumed: eth0 = Public; eth1 = Private Code:
iptables -t nat -A PREROUTING -s 0/0 -d apple.example.com -i eth0 -p tcp --dport 80 -j DNAT --to apple.example.com:80 hope this helps |
the more i think about this the more skeptical i become about it actually working...
|
mhallbiai,
Thank you -- You are exactly correct regarding what we're trying to do. However these rules (incl. apple) continue to fail: Where I might be wrong? (order?) Code:
iptables --flush Thanks again, |
All times are GMT -5. The time now is 09:06 AM. |