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.

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 127.0.0.1 it will load my app. But if they enter any other web address it would redirect back to 127.0.0.1?

Thanks everyone!

share|improve this question
1  
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  
127.0.0.1 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
2  
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
add comment

migrated from stackoverflow.com May 18 '12 at 12:55

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

1 Answer

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 127.0.0.1 -j REDIRECT --to-ports 80-80 127.0.0.1 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
add comment

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.