Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

hi in gateway base on linux how can redirect all internet accesses to port 80 in gateway. (any internet request redirect to port 80 in gateway).

can do this by iptables? or any other idea?

share|improve this question

1 Answer 1

Why do you want to do this? It seems like a fundamentally bad idea. It would go against every known standard of expected operation that exists.

That said, you could do this using the PREROUTING chain in iptables. These rules will work for the following assumptions:

  • eth0 is your public interface
  • You only need TCP redirected
  • Your public IP address is 192.1.1.1
  • You only want to redirect ports 1 through 65535

Rule:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dst 192.1.1.1 --dport 1:65535 -j REDIRECT --to-port 80
share|improve this answer
    
He may just mean all http traffic redirected to the gateway. –  Steven Feb 15 '11 at 3:44
    
looks like mikrotik hotspot, i want to redirect all internet request to a local webserver. –  haw3d Feb 16 '11 at 9:58

Your Answer

 
discard

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.