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

viagra online

viagra and smoking weed buy viagra viagra bez recepty biaЕ‚ystok buy viagra online hat viagra verfallsdatum

order cialis online by GaireEmople

tadalafil tablete iskustva http://cialsagen.com/ cheap generic cialis, how to make sildenafil most effective

buy online viagra from AlanaWaR

where to buy viagra online when will viagra go generic generic viagra for sale https://www.viagraeiu.com/

buy viagra professional by AlanaWaR

how to buy viagra online http://www.viagraeiu.com/ viagra online without preion http://viagraeiu.com/

buy viagra online in canada JosephGon

u http://viagrarow.com viagra generic availability
cheap viagra uk online how to get viagra in one day

Intuisp

buy cialis online
compare prices cialis 20
http://buycialisgenmrxonline.com
tinnitus cialis online pharmacy
cialis

Enquink

cialis coupon
search cialis generic cialis
http://buycialisgenmrxonline.com
generic cialis online
buy cialis generic

Moopime

buy cialis
is there generic cialis
http://vvvrxbuycialisonline.com
buy soft cialis
cheap cialis

Broonee

buy cialis generic
generic cialis 10 mg
http://buycialisgenmrxonline.com
levaquin inhaler cialis pills
cialis

amburse

generic viagra online
viagra before and after
http://genviagrammrx.com
viagra kamagra
buy viagra online

poedy

buy cialis
buy cialis in the uk
http://buycialisgenmrxonline.com
buy cialis online without a prescription
buy cialis online

roand

buy cialis generic
buy generic cialis in shanghai
http://buycialisgenmrxonline.com
generic cialis any good
generic cialis

Joiva

buy cialis
generic cialis vs brand cialis
http://buycialisgenmrxonline.com
buying cialis at shoppers drug mart
buy cialis generic

nanty

buy cialis online
cheap online female cialis
http://buycialisgenmrxonline.com
cialis 5mg price prescription
cialis