We have an EC2 server with 400 domains / vhosts on amazon's ec2. We use just one single public IP (1.1.1.1). Because of NAT we use the internal IP (10.1.2.0) in apaches config. So far so good.
Some cronscripts need to access the hosted domains but these cronjobs are also hosted on the same machine. Because of the NAT it's not possible to reach any of the hosted domains by hostname from the localhost. I've been trying to figure it out with iptables, but no luck
Looks like this is not working:
iptables -t nat -A PREROUTING -p tcp -d 1.1.1.1 -j DNAT --to 10.1.2.0
Any thoughts? Of course i can add al 400+ domains to /etc/hosts, but then i have to keep track of all the domains and it isnt very flexible. Ofcourse we can also change the way the cronjobs are working, but we need a 'quick' fix right now. Is this possible with iptables?