Solved

need some pointers for iptables

Posted on 2002-05-15
6
211 Views
Last Modified: 2010-03-18
I've been reading docs for iptables for a week now, and still can't figure out how to do what I want to do. Here it is :

I have a firewall (one public interface, one private interface.) with 3 web servers behind it, I want the servers on a private subnet, say 192.168.0.2, 192.168.0.3,192.168.0.4.

All three servers have different hostname, and I have sufficient public IPs to handle them.

I need to set the firewall so that when it gets a request for www1.domain.com it forwards to 192.168.0.2, www2.domain.com goes to 192.168.0.3, and so on.

Can someone come up with a sample iptables script for me please ?
0
Comment
Question by:cgirouard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:zzconsumer
ID: 7026513
I guess this cannot be done using iptables, because as far as I know it cannot handle DNS names - it's "just" an IP filter. I think what you need is to run squid on that machine, because it can act as a virtual host accelerator.

Edit squid's config file just like:
        httpd_accel_host otherhost.foo.com
        httpd_accel_port 80
This should work.

You might use iptables if you redirect ports - meaning e.g. www.domain.com goes to 192.168.0.2 and www.domain.com:81 goes to 192.168.0.3 and so on.
0
 
LVL 1

Accepted Solution

by:
zzconsumer earned 100 total points
ID: 7027092
I just read a part of the Apache documentation today. Maybe what you need is mentioned there, so you don't need to run a squid proxy:

http://www.apache.org/dist/httpd/apache-1.3.23-docs.pdf.zip

You may want to have a look at chapter 17, where there is an example on how to redirect a virtual server. The intention is another one, but as far as I can see, you might achieve what you need that way.
0
 
LVL 3

Expert Comment

by:DVB
ID: 7048601
What you want is static NAT. iptables can do this quite well, IIRC.
See the documentation on the REDIRECT target on how to achieve this.
Actually, why not give each server a publically routable IP address and remove the need to NAT?
0
 

Expert Comment

by:CleanupPing
ID: 9078486
cgirouard:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 10004261
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: zzconsumer {http:#7027092}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

paullamhkg
EE Cleanup Volunteer
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CPU#7 stuck for 22s! 4 335
Prevent login on dead linux home directories 3 85
Exploits in Kali Linux 4 424
Linux : when to add the entries in /etc/hosts file 22 104
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question