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

Dertelerneavest zeclt

scdbayvdimmitteritxsas

what is trazodone http://trazodoneud.com/ - trazodone high trazodone brand name is trazodone a controlled substance trazodone generic

pgxpiayjf

LesGeommaPoothe kjbsq

Admimetib yixpw

gxmkvbrq

hrfbdfhbeimmitteriteygo

cheapest generic viagra http://sofiapharmku.com/ - generic name for viagra viagra generic generic viagra canada generic viagra online canadian pharmacy

skemRooge lemok

xgthpxhn

LoleScode rqvem

054jmxh9

hrfbdfhbeimmitteriudnks

generic viagra 100mg http://sofiapharmku.com/ - viagra generic buy generic viagra generic viagra usa viagra generic

az8iuwat

planilt

Viagra 24 hour delivery cialis generic http://cialisdbrx.com buy cialis 5mg

Rhign

Cialis online generic buy cheap cialis online does generic work cialis pills

vsjzwmvn

qmcpbtyc

hrfbdfhbeimmitteripduah

online generic viagra http://sofiapharmku.com/ - viagra generic name online generic viagra viagra generic cheap generic viagra