Server Fault is a question and answer site for system and network administrators. 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

How can I restrict my network connections to a only my web-server?

EG, a user would connect to my network (WIFI/LAN) when they open a web browser and enter it will load my app. But if they enter any other web address it would redirect back to

Thanks everyone!

share|improve this question

migrated from May 18 '12 at 12:55

This question came from our site for professional and enthusiast programmers.

That's more of a network/infrastructure question than a programming question, i.e. off topic here. – deceze May 15 '12 at 7:16
4 will never load your app on any machine that is not the one where your app is running. It is the loopback device which will never send anything over the wire. – ThiefMaster May 15 '12 at 7:18
This kind of setup is generally known as "captive portal". There are both open source (e.g. CoovaAP) and commercial solutions available to accomplish this. – jhonkola May 15 '12 at 7:24
Thanks, thats why Im asking the questions because I have NO idea were to start or what to look for. Ill try find more info on "captive portal". – afro360 May 15 '12 at 7:27

You can setup a firewall using iptables (or whichever firewall you prefer) and create a rule that will redirect other traffic to your desired IP address. You will need to put the firewall between the LAN and the router/internet source. An iptables rule for this action would look like this: -A PREROUTING -d -j REDIRECT --to-ports 80-80 being the IP address that you want to redirect traffic to. 80-80 is the port range of the rule. In this case only the HTTP traffic is being redirected. To redirect HTTPS traffic as well you would create another rule just like this but change 80-80 to 443-443.

share|improve this answer

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.