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

nuyseloimmitteriqqcur

best canadian online pharmacy http://canadianpharmacyonlinesrvh.com/ - online pharmacy online pharmacy canada online canadian pharmacy canadian pharmacy online

jurxbgjxhtThyncimph

quetiapine overdose http://quetiapineseroquelik.com/ - seroquel and alcohol seroquel withdrawal quetiapine interactions how long does seroquel stay in your system

lialstaus yasyi

nuyseloimmitteripjxdv

canada pharmacy online http://canadianpharmacyonlinesrvh.com/ - online canadian pharmacy online pharmacy canadian online pharmacy online canadian pharmacy

rrgtcklg

nqvsczezix

buy cialis online WilliamaLak

can i take cialis and drink alcohol
generic cialis for sale
side effects of cialis black
cialis
cialis feeling cold

betyggbc

hrfbdfhbeimmitterihelsk

does generic viagra work http://sofiapharmku.com/ - when will viagra go generic cheapest generic viagra generic viagra 100mg best place to buy generic viagra online

xwz7v17o

LesGeommaPoothe qobgs

Bleancecluffnip dtxkc

lialstaus yqtqu

juinumn

Buy generic cialis maintain an erection http://cialisdbrx.com buy generic cialis canada

0wkckets

scdbayvdimmitteriwjbwq

trazodone 100 mg http://trazodoneud.com/ - what is trazodone used for trazodone sleep trazodone weight gain trazodone alcohol

scdbayvdimmitteriklofc

trazodone for anxiety http://trazodoneud.com/ - trazodone 50 mg for sleep is trazodone a narcotic is trazodone a controlled substance side effects of trazodone