Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Currently, I am using IPTABLES to ban people from accessing my site. Using this format in IPTABLES:

  iptables -I INPUT -s -j DROP -m comment --comment "whatever I have to say"

I would like to instead have it setup where iptables will redirect that specific person (IP in this case) to a webpage where it says they are banned, and the steps involved to get unbanned. Rather I do this using apache, another IP, redirecting them to a specific port, whatever the case may be I would like to not access anything of mine except that one webpage telling them how to be unbanned.

share|improve this question

To do this with iptables you could setup a virtual server in apache listening on an alternate port with the docroot set to the instructions for how to be un-banned.

iptables -t nat -I PREROUTING -p tcp --dport 80 -s -j DNAT --to-destination $server_ip_address:$alternate_apache_port
share|improve this answer
This is what I was looking for. Thanks. Now if I can only perfect the damn Vhosts. – Brian Dec 31 '09 at 3:35

Your Answer


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