Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I saw a tutorial about redirecting client requests to a specific port to a VM inside the server using IPTables.

Is there a way to redirect client requests for foo.com to a VM using only IPTables?

or should I go for squid proxy server?

share|improve this question

If foo.com is the only web server listening on that IP, it should be relatively easy, since you would just redirect all port 80 traffic.

If there are other web servers for that IP, you can use string matching in iptables:


but note the caveat in the documentation, about how a proxy would be a better choice.

share|improve this answer
thanks :D btw, do you know any easy-to-follow tutorial for this? – user269334 May 22 '12 at 0:23
Ubuntu has fairly extensive community documentation. For example: help.ubuntu.com/community/IptablesHowTo – cjc May 22 '12 at 1:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.