Shared hosting server + NAT + virtualhosts reachability

PDF versionSend to friendPrinter-friendly version

How to make virtualhosts visible to each other on a shared hosting server behind a Firewall.

Situation

You have a web hosting server with lots of virtual hosts running on it.
You also have a a firewall in front of the server.
The server has a private IP address assigned to the NIC of the server and the firewall provide a NAT (public_ip -> private_ip)

Problem

Some virtualhosts on the server need to connect to the public DNS name of a virtualhost on the same server.
The DNS resolution resolve the DNS name to the public IP of the server and according to the routing table the traffic is routed to the firewall that make the connection impossible for a "in-out-interface-problem".

Solution

I think that there are more than one solution:

  1. alias the public ip
  2. nat in OUTPUT chain

I prefer the iptables solution and this worked for me:

ETH0_IP=$(ifconfig eth0 | grep "inet addr" | awk '{print $2}' | awk 'BEGIN {FS=":"} {print $2}')
ETH0_IP_PUBLIC="YOUR.PUBLIC.IP.ADDRESS"
$IPTABLES -t nat -A OUTPUT -d $ETH0_IP_PUBLIC -j DNAT --to-destination $ETH0_IP

Piela

Buy cialis tadalafil http://cialismnrx.com pfizer cialis generic cialis

jurxbgjxhtThynccznu

quetiapine high http://quetiapineseroquelik.com/ - quetiapine 25mg quetiapine 25mg quetiapine side effects seroquel for anxiety

hrfbdfhbeimmitteridjpec

best generic viagra http://sofiapharmku.com/ - cheapest generic viagra is there a generic viagra generic viagra online pharmacy viagra generic date

smedymn

Quick online cash loans http://paydaymyonline.com california payday loan.

jurxbgjxhtThyncikyg

seroquel 200 mg http://quetiapineseroquelik.com/ - quetiapine drug class seroquel for dementia seroquel dosage what is seroquel used for

Orgalia

Generic cialis canada http://cialismdmarx.com cialis cheap.

What does toner do

Thank you so much for the great blog and very beneficial stuff that you have shared with us.
What does toner do

Indica

Thank you for the great article and thank you for sharing your knowledge.
Indica

jurxbgjxhtThynczecy

quetiapine uses http://quetiapineseroquelik.com/ - seroquel sleep quetiapine high quetiapine drug class seroquel high

inilm

Easy loan http://paydaymyonline.com secured personal loan bad credit.

y0jc1p33

pxilwpeu

jurxbgjxhtThynceami

quetiapine fumarate http://quetiapineseroquelik.com/ - quetiapine for sleep quetiapine uses seroquel for anxiety side effects of seroquel

LesGeommaPoothe quivp

scdbayvdimmitterixnifm

trazodone overdose http://trazodoneud.com/ - trazodone half life trazodone 50 mg trazodone for anxiety trazodone dosage

injebyben petdn

jurxbgjxhtThyncycsu

what is quetiapine used for http://quetiapineseroquelik.com/ - quetiapine for sleep seroquel 200 mg how long does seroquel stay in your system what is quetiapine

rjhdmrgfsdvsegififleconnaredosm

can you buy viagra online http://emmapharmsr.com/ - buy viagra online where to buy viagra online viagra online usa buy generic viagra online

Dertelerneavest wpeiy

Gamsalolamp kygfv